type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
InterfaceDeclaration
export interface ListOpsItemEventsCommandInput extends ListOpsItemEventsRequest { }
dwardu89/aws-ssm-parameter-store
node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/commands/ListOpsItemEventsCommand.d.ts
TypeScript
InterfaceDeclaration
export interface ListOpsItemEventsCommandOutput extends ListOpsItemEventsResponse, __MetadataBearer { }
dwardu89/aws-ssm-parameter-store
node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/commands/ListOpsItemEventsCommand.d.ts
TypeScript
MethodDeclaration
resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: SSMClientResolvedConfig, options?: __HttpHandlerOptions): Handler<ListOpsItemEventsCommandInput, ListOpsItemEventsCommandOutput>;
dwardu89/aws-ssm-parameter-store
node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/commands/ListOpsItemEventsCommand.d.ts
TypeScript
InterfaceDeclaration
export interface SortableGameVersion { gameVersionPadded: string; gameVersion: string; gameVersionReleaseDate: Date; gameVersionName: string; }
dkraemer/mc-tools-old
src/curse-forge/responses/SortableGameVersion.ts
TypeScript
ArrowFunction
() => { let component: CreateNewInvitationComponent; let fixture: ComponentFixture<CreateNewInvitationComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ CreateNewInvitationComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(CreateNewInvitationComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); }
duchai9800ttbm/HBC
src/app/layout/package/package-detail/package-detail-file-attend/interview-negotiation/create-interview/create-new-invitation/create-new-invitation.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ declarations: [ CreateNewInvitationComponent ] }) .compileComponents(); }
duchai9800ttbm/HBC
src/app/layout/package/package-detail/package-detail-file-attend/interview-negotiation/create-interview/create-new-invitation/create-new-invitation.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(CreateNewInvitationComponent); component = fixture.componentInstance; fixture.detectChanges(); }
duchai9800ttbm/HBC
src/app/layout/package/package-detail/package-detail-file-attend/interview-negotiation/create-interview/create-new-invitation/create-new-invitation.component.spec.ts
TypeScript
ArrowFunction
() => { describe('add', () => { it('adds single', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); }); it('adds center lower overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 4)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(3); }); it('adds center upper overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(4, 7)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(4); }); it('adds center total overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 7)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(3); }); it('adds to s_left', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 3)); expect(root.left.center).to.equal(3); }); it('adds to s_right', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(6, 8)); expect(root.right.center).to.equal(7); }); }); describe('.pointIntersection()', () => { it('none returns 0', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); expect(tree.pointIntersections(root, 3)).to.equal(0); }); it('returns single', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); expect(tree.pointIntersections(root, 3)).to.equal(1); }); it('returns duplicate single', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(3, 5)); expect(tree.pointIntersections(root, 3)).to.equal(2); }); it('returns duplicate single', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(3, 5)); expect(tree.pointIntersections(root, 3)).to.equal(2); }); it('returns left overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(3, 3)); expect(tree.pointIntersections(root, 3)).to.equal(2); }); it('returns left->right overlap', () => { const root = tree.insert(undefined, new tree.Interval(5, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(2, 2)); tree.insert(root, new tree.Interval(3, 3)); expect(tree.pointIntersections(root, 3)).to.equal(2); }); it('returns right overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(5, 5)); expect(tree.pointIntersections(root, 5)).to.equal(2); }); it('returns right->left overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(6, 6)); tree.insert(root, new tree.Interval(5, 5)); expect(tree.pointIntersections(root, 5)).to.equal(2); }); }); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { it('adds single', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); }); it('adds center lower overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 4)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(3); }); it('adds center upper overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(4, 7)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(4); }); it('adds center total overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 7)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(3); }); it('adds to s_left', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 3)); expect(root.left.center).to.equal(3); }); it('adds to s_right', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(6, 8)); expect(root.right.center).to.equal(7); }); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 4)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(3); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(4, 7)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(4); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 7)); expect(root.center).to.equal(4); expect(root.intervals[0].low).to.equal(4); expect(root.intervals[1].low).to.equal(3); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 3)); expect(root.left.center).to.equal(3); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(6, 8)); expect(root.right.center).to.equal(7); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { it('none returns 0', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); expect(tree.pointIntersections(root, 3)).to.equal(0); }); it('returns single', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); expect(tree.pointIntersections(root, 3)).to.equal(1); }); it('returns duplicate single', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(3, 5)); expect(tree.pointIntersections(root, 3)).to.equal(2); }); it('returns duplicate single', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(3, 5)); expect(tree.pointIntersections(root, 3)).to.equal(2); }); it('returns left overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(3, 3)); expect(tree.pointIntersections(root, 3)).to.equal(2); }); it('returns left->right overlap', () => { const root = tree.insert(undefined, new tree.Interval(5, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(2, 2)); tree.insert(root, new tree.Interval(3, 3)); expect(tree.pointIntersections(root, 3)).to.equal(2); }); it('returns right overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(5, 5)); expect(tree.pointIntersections(root, 5)).to.equal(2); }); it('returns right->left overlap', () => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(6, 6)); tree.insert(root, new tree.Interval(5, 5)); expect(tree.pointIntersections(root, 5)).to.equal(2); }); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); expect(tree.pointIntersections(root, 3)).to.equal(0); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); expect(tree.pointIntersections(root, 3)).to.equal(1); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(3, 5)); expect(tree.pointIntersections(root, 3)).to.equal(2); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(3, 3)); expect(tree.pointIntersections(root, 3)).to.equal(2); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(5, 5)); tree.insert(root, new tree.Interval(3, 5)); tree.insert(root, new tree.Interval(2, 2)); tree.insert(root, new tree.Interval(3, 3)); expect(tree.pointIntersections(root, 3)).to.equal(2); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(5, 5)); expect(tree.pointIntersections(root, 5)).to.equal(2); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ArrowFunction
() => { const root = tree.insert(undefined, new tree.Interval(4, 5)); tree.insert(root, new tree.Interval(6, 6)); tree.insert(root, new tree.Interval(5, 5)); expect(tree.pointIntersections(root, 5)).to.equal(2); }
bmancini55/algorithms
test/interval-tree-centered.spec.ts
TypeScript
ClassDeclaration
@Injectable() export class TasksService { constructor( @InjectRepository(TaskRepository) private taskRepository: TaskRepository, ) {} async getTasks(filterDto: GetTasksFilterDto, user: User): Promise<Task[]> { return this.taskRepository.getTasks(filterDto, user); } async getTaskById(id: number, user: User): Promise<Task> { const found = await this.taskRepository.findOne({ where: { id, userId: user.id }, }); if (!found) { throw new NotFoundException(`Task with ID "${id}" not found`); } return found; } async createTask(createTaskDto: CreateTaskDto, user: User): Promise<Task> { return this.taskRepository.createTask(createTaskDto, user); } async updateTaskStatus( id: number, status: TaskStatus, user: User, ): Promise<Task> { const task = await this.getTaskById(id, user); task.status = status; await task.save(); return task; } async deleteTask(id: number, user: User): Promise<void> { const result = await this.taskRepository.delete({ id, userId: user.id }); if (!result.affected) { throw new NotFoundException(`Task with ID "${id}" not found`); } } }
bantek89/nestjs-task-management
src/tasks/tasks.service.ts
TypeScript
MethodDeclaration
async getTasks(filterDto: GetTasksFilterDto, user: User): Promise<Task[]> { return this.taskRepository.getTasks(filterDto, user); }
bantek89/nestjs-task-management
src/tasks/tasks.service.ts
TypeScript
MethodDeclaration
async getTaskById(id: number, user: User): Promise<Task> { const found = await this.taskRepository.findOne({ where: { id, userId: user.id }, }); if (!found) { throw new NotFoundException(`Task with ID "${id}" not found`); } return found; }
bantek89/nestjs-task-management
src/tasks/tasks.service.ts
TypeScript
MethodDeclaration
async createTask(createTaskDto: CreateTaskDto, user: User): Promise<Task> { return this.taskRepository.createTask(createTaskDto, user); }
bantek89/nestjs-task-management
src/tasks/tasks.service.ts
TypeScript
MethodDeclaration
async updateTaskStatus( id: number, status: TaskStatus, user: User, ): Promise<Task> { const task = await this.getTaskById(id, user); task.status = status; await task.save(); return task; }
bantek89/nestjs-task-management
src/tasks/tasks.service.ts
TypeScript
MethodDeclaration
async deleteTask(id: number, user: User): Promise<void> { const result = await this.taskRepository.delete({ id, userId: user.id }); if (!result.affected) { throw new NotFoundException(`Task with ID "${id}" not found`); } }
bantek89/nestjs-task-management
src/tasks/tasks.service.ts
TypeScript
ArrowFunction
(پیشفرض: زبان سیستم)
trappist/graviocoin
src/qt/locale/bitcoin_fa.ts
TypeScript
FunctionDeclaration
function createField(properties: FieldPropertiesDto) { return new FieldDto(1, 'field1', false, false, false, 'languages', properties); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { it('should update isLocked property when locking', () => { const field_1 = createField(createProperties('String')); const field_2 = field_1.lock(); expect(field_2.isLocked).toBeTruthy(); }); it('should update isHidden property when hiding', () => { const field_1 = createField(createProperties('String')); const field_2 = field_1.hide(); expect(field_2.isHidden).toBeTruthy(); }); it('should update isHidden property when showing', () => { const field_1 = createField(createProperties('String')).hide(); const field_2 = field_1.show(); expect(field_2.isHidden).toBeFalsy(); }); it('should update isDisabled property when disabling', () => { const field_1 = createField(createProperties('String')); const field_2 = field_1.disable(); expect(field_2.isDisabled).toBeTruthy(); }); it('should update isDisabled property when enabling', () => { const field_1 = createField(createProperties('String')).disable(); const field_2 = field_1.enable(); expect(field_2.isDisabled).toBeFalsy(); }); it('should update properties property when updating', () => { const newProperty = createProperties('Number'); const field_1 = createField(createProperties('String')); const field_2 = field_1.update(newProperty); expect(field_2.properties).toEqual(newProperty); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field_1 = createField(createProperties('String')); const field_2 = field_1.lock(); expect(field_2.isLocked).toBeTruthy(); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field_1 = createField(createProperties('String')); const field_2 = field_1.hide(); expect(field_2.isHidden).toBeTruthy(); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field_1 = createField(createProperties('String')).hide(); const field_2 = field_1.show(); expect(field_2.isHidden).toBeFalsy(); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field_1 = createField(createProperties('String')); const field_2 = field_1.disable(); expect(field_2.isDisabled).toBeTruthy(); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field_1 = createField(createProperties('String')).disable(); const field_2 = field_1.enable(); expect(field_2.isDisabled).toBeFalsy(); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const newProperty = createProperties('Number'); const field_1 = createField(createProperties('String')); const field_2 = field_1.update(newProperty); expect(field_2.properties).toEqual(newProperty); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field = createField(new AssetsFieldPropertiesDto(null, null, null, true, false, 1, 1)); it('should create validators', () => { expect(field.createValidators(false).length).toBe(3); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to asset count', () => { expect(field.formatValue([1, 2, 3])).toBe('3 Asset(s)'); }); it('should return zero formatting if other type', () => { expect(field.formatValue(1)).toBe('0 Assets'); }); it('should return null for default properties', () => { expect(field.defaultValue()).toBeNull(); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.createValidators(false).length).toBe(3); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(null)).toBe(''); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue([1, 2, 3])).toBe('3 Asset(s)'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(1)).toBe('0 Assets'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.defaultValue()).toBeNull(); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field = createField(new TagsFieldPropertiesDto(null, null, null, true, false, 1, 1)); it('should create validators', () => { expect(field.createValidators(false).length).toBe(3); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to asset count', () => { expect(field.formatValue(['hello', 'squidex', 'cms'])).toBe('hello, squidex, cms'); }); it('should return zero formatting if other type', () => { expect(field.formatValue(1)).toBe(''); }); it('should return null for default properties', () => { expect(field.defaultValue()).toBeNull(); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(['hello', 'squidex', 'cms'])).toBe('hello, squidex, cms'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(1)).toBe(''); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field = createField(new BooleanFieldPropertiesDto(null, null, null, true, false, 'Checkbox')); it('should create validators', () => { expect(field.createValidators(false).length).toBe(1); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to Yes if true', () => { expect(field.formatValue(true)).toBe('Yes'); }); it('should format to No if false', () => { expect(field.formatValue(false)).toBe('No'); }); it('should return default value for default properties', () => { Object.assign(field.properties, { defaultValue : true }); expect(field.defaultValue()).toBeTruthy(); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.createValidators(false).length).toBe(1); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(true)).toBe('Yes'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(false)).toBe('No'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { Object.assign(field.properties, { defaultValue : true }); expect(field.defaultValue()).toBeTruthy(); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const now = DateTime.parseISO_UTC('2017-10-12T16:30:10Z'); const field = createField(new DateTimeFieldPropertiesDto(null, null, null, true, false, 'Date')); it('should create validators', () => { expect(field.createValidators(false).length).toBe(1); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to input if parsing failed', () => { expect(field.formatValue(true)).toBe(true); }); it('should format to date', () => { const dateField = createField(new DateTimeFieldPropertiesDto(null, null, null, true, false, 'Date')); expect(dateField.formatValue('2017-12-12T16:00:00Z')).toBe('2017-12-12'); }); it('should format to date time', () => { const dateTimeField = createField(new DateTimeFieldPropertiesDto(null, null, null, true, false, 'DateTime')); expect(dateTimeField.formatValue('2017-12-12T16:00:00Z')).toBe('2017-12-12 16:00:00'); }); it('should return default for DateFieldProperties', () => { Object.assign(field.properties, { defaultValue: '2017-10-12T16:00:00Z' }); expect(field.defaultValue()).toEqual('2017-10-12T16:00:00Z'); }); it('should return calculated date when Today for DateFieldProperties', () => { Object.assign(field.properties, { calculatedDefaultValue: 'Today' }); expect((<any>field).properties.getDefaultValue(now)).toEqual('2017-10-12'); }); it('should return calculated date when Now for DateFieldProperties', () => { Object.assign(field.properties, { calculatedDefaultValue: 'Now' }); expect((<any>field).properties.getDefaultValue(now)).toEqual('2017-10-12T16:30:10Z'); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(true)).toBe(true); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const dateField = createField(new DateTimeFieldPropertiesDto(null, null, null, true, false, 'Date')); expect(dateField.formatValue('2017-12-12T16:00:00Z')).toBe('2017-12-12'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const dateTimeField = createField(new DateTimeFieldPropertiesDto(null, null, null, true, false, 'DateTime')); expect(dateTimeField.formatValue('2017-12-12T16:00:00Z')).toBe('2017-12-12 16:00:00'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { Object.assign(field.properties, { defaultValue: '2017-10-12T16:00:00Z' }); expect(field.defaultValue()).toEqual('2017-10-12T16:00:00Z'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { Object.assign(field.properties, { calculatedDefaultValue: 'Today' }); expect((<any>field).properties.getDefaultValue(now)).toEqual('2017-10-12'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { Object.assign(field.properties, { calculatedDefaultValue: 'Now' }); expect((<any>field).properties.getDefaultValue(now)).toEqual('2017-10-12T16:30:10Z'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field = createField(new GeolocationFieldPropertiesDto(null, null, null, true, false, 'Default')); it('should create validators', () => { expect(field.createValidators(false).length).toBe(1); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to latitude and longitude', () => { expect(field.formatValue({ latitude: 42, longitude: 3.14 })).toBe('3.14, 42'); }); it('should return null for default properties', () => { expect(field.defaultValue()).toBeNull(); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue({ latitude: 42, longitude: 3.14 })).toBe('3.14, 42'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field = createField(new JsonFieldPropertiesDto(null, null, null, true, false)); it('should create validators', () => { expect(field.createValidators(false).length).toBe(1); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to constant', () => { expect(field.formatValue({})).toBe('<Json />'); }); it('should return null for default properties', () => { expect(field.defaultValue()).toBeNull(); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue({})).toBe('<Json />'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field = createField(new NumberFieldPropertiesDto(null, null, null, true, false, 'Input', undefined, 3, 1, [1, 2, 3])); it('should create validators', () => { expect(field.createValidators(false).length).toBe(4); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to number', () => { expect(field.formatValue(42)).toBe(42); }); it('should return default value for default properties', () => { Object.assign(field.properties, { defaultValue: 13 }); expect(field.defaultValue()).toEqual(13); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.createValidators(false).length).toBe(4); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(42)).toBe(42); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { Object.assign(field.properties, { defaultValue: 13 }); expect(field.defaultValue()).toEqual(13); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field = createField(new ReferencesFieldPropertiesDto(null, null, null, true, false, 1, 1)); it('should create validators', () => { expect(field.createValidators(false).length).toBe(3); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to asset count', () => { expect(field.formatValue([1, 2, 3])).toBe('3 Reference(s)'); }); it('should return zero formatting if other type', () => { expect(field.formatValue(1)).toBe('0 References'); }); it('should return null for default properties', () => { expect(field.defaultValue()).toBeNull(); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue([1, 2, 3])).toBe('3 Reference(s)'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue(1)).toBe('0 References'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { const field = createField(new StringFieldPropertiesDto(null, null, null, true, false, 'Input', undefined, 'pattern', undefined, 3, 1, ['1', '2'])); it('should create validators', () => { expect(field.createValidators(false).length).toBe(5); }); it('should format to empty string if null', () => { expect(field.formatValue(null)).toBe(''); }); it('should format to string', () => { expect(field.formatValue('hello')).toBe('hello'); }); it('should return default value for default properties', () => { Object.assign(field.properties, { defaultValue: 'MyDefault' }); expect(field.defaultValue()).toEqual('MyDefault'); }); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.createValidators(false).length).toBe(5); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { expect(field.formatValue('hello')).toBe('hello'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
() => { Object.assign(field.properties, { defaultValue: 'MyDefault' }); expect(field.defaultValue()).toEqual('MyDefault'); }
blakecodes/squidex
src/Squidex/app/shared/services/schemas.fields.spec.ts
TypeScript
ArrowFunction
r => r.compile()
quenktechnologies/facets-mongodb
lib/index.ts
TypeScript
ClassDeclaration
/** * MongoDBFilterCompiler provides a compiler for converting a valid search-filters * string into a valid mongodb filter. * * These filters are intended to be used with the mongodb package and may not * work with more opinionated libraries. */ export class MongoDBFilterCompiler { constructor( public options: Partial<Options> = {}, public policies: AvailablePolicies = {}, public terms = term.requiredTerms) { } /** * toTerm is an alternative to direct compilation. * * Instead of the compiled result a Term is produced that can be compiled * later. */ toTerm(enabled: EnabledPolicies, src: Source): Except<Term> { let { terms, policies, options } = this; return source2Term(newContext(terms, merge(availablePolicies, policies), options), enabled, src); } /** * compile a Source string into a filter according to the EnabledPolicies * provided. * * The EnabledPolicies can make use of the builtin availableProperties * exported by using the key name instead of a Policy definition. * * The options and policies passed in the constructor are merged with * the defaults to allow additional options and AvailablePolicies to be * specified. */ compile(enabled: EnabledPolicies, src: Source): Except<Object> { return this.toTerm(enabled, src).chain(r => r.compile()); } }
quenktechnologies/facets-mongodb
lib/index.ts
TypeScript
TypeAliasDeclaration
/** * AvailablePolicies specialised for this module. */ export type AvailablePolicies = _AvailablePolicies<Object>;
quenktechnologies/facets-mongodb
lib/index.ts
TypeScript
TypeAliasDeclaration
/** * EnabledPolicies specialised to this module. */ export type EnabledPolicies = _EnabledPolicies<Object>;
quenktechnologies/facets-mongodb
lib/index.ts
TypeScript
MethodDeclaration
/** * toTerm is an alternative to direct compilation. * * Instead of the compiled result a Term is produced that can be compiled * later. */ toTerm(enabled: EnabledPolicies, src: Source): Except<Term> { let { terms, policies, options } = this; return source2Term(newContext(terms, merge(availablePolicies, policies), options), enabled, src); }
quenktechnologies/facets-mongodb
lib/index.ts
TypeScript
MethodDeclaration
/** * compile a Source string into a filter according to the EnabledPolicies * provided. * * The EnabledPolicies can make use of the builtin availableProperties * exported by using the key name instead of a Policy definition. * * The options and policies passed in the constructor are merged with * the defaults to allow additional options and AvailablePolicies to be * specified. */ compile(enabled: EnabledPolicies, src: Source): Except<Object> { return this.toTerm(enabled, src).chain(r => r.compile()); }
quenktechnologies/facets-mongodb
lib/index.ts
TypeScript
TypeAliasDeclaration
type Props = HeadingProps;
CatchRelease/arbor
src/AccordionSection/StyledAccordionHeading.ts
TypeScript
FunctionDeclaration
// helpers for building the winston loggers function buildConsoleLogger(level = "info") { return function (config) { return winston.createLogger({ format: winston.format.combine( winston.format.timestamp(), winston.format.colorize(), winston.format.printf((info) => { return `${info.timestamp} - ${info.level}: ${ info.message } ${stringifyExtraMessagePropertiesForConsole(info)}`; }) ), level, levels: winston.config.syslog.levels, transports: [new winston.transports.Console()], }); }; }
actionhero/actionhero
src/config/logger.ts
TypeScript
FunctionDeclaration
function buildFileLogger(path, level = "info", maxFiles = undefined) { return function (config) { const filename = `${path}/${config.process.id}-${config.process.env}.log`; return winston.createLogger({ format: winston.format.combine( winston.format.timestamp(), winston.format.json() ), level, levels: winston.config.syslog.levels, transports: [ new winston.transports.File({ filename, maxFiles, }), ], }); }; }
actionhero/actionhero
src/config/logger.ts
TypeScript
FunctionDeclaration
function stringifyExtraMessagePropertiesForConsole(info) { const skippedProperties = ["message", "timestamp", "level"]; let response = ""; for (const key in info) { const value = info[key]; if (skippedProperties.includes(key)) { continue; } if (value === undefined || value === null || value === "") { continue; } response += `${key}=${value} `; } return response; }
actionhero/actionhero
src/config/logger.ts
TypeScript
ArrowFunction
(config) => { const loggers: ActionheroConfigLoggerBuilderArray = []; loggers.push(buildConsoleLogger(process.env.LOG_LEVEL)); config.general.paths.log.forEach((p) => { loggers.push(buildFileLogger(p, process.env.LOG_LEVEL)); }); return { loggers, maxLogStringLength: 100, // the maximum length of param to log (we will truncate) maxLogArrayLength: 10, // the maximum number of items in an array to log before collapsing into one message }; }
actionhero/actionhero
src/config/logger.ts
TypeScript
ArrowFunction
(p) => { loggers.push(buildFileLogger(p, process.env.LOG_LEVEL)); }
actionhero/actionhero
src/config/logger.ts
TypeScript
ArrowFunction
(config) => { const loggers: ActionheroConfigLoggerBuilderArray = []; loggers.push(buildConsoleLogger("crit")); config.general.paths.log.forEach((p) => { loggers.push(buildFileLogger(p, "debug", 1)); }); return { loggers }; }
actionhero/actionhero
src/config/logger.ts
TypeScript
ArrowFunction
(p) => { loggers.push(buildFileLogger(p, "debug", 1)); }
actionhero/actionhero
src/config/logger.ts
TypeScript
ArrowFunction
(info) => { return `${info.timestamp} - ${info.level}: ${ info.message } ${stringifyExtraMessagePropertiesForConsole(info)}`; }
actionhero/actionhero
src/config/logger.ts
TypeScript
TypeAliasDeclaration
/* The loggers defined here will eventually be available via `import { loggers } from "actionhero"` You may want to customize how Actionhero sets the log level. By default, you can use `process.env.LOG_LEVEL` to change each logger's level (default: 'info') learn more about winston v3 loggers @ - https://github.com/winstonjs/winston - https://github.com/winstonjs/winston/blob/master/docs/transports.md */ type ActionheroConfigLoggerBuilderArray = Array< (config: any) => winston.Logger >;
actionhero/actionhero
src/config/logger.ts
TypeScript
ArrowFunction
() => createStyles({ root: { height: '72px', fontSize: '16px', }, })
Boulevard/create-booking-flow
components/molecules/MobileSelectedServiceSelector/useStyles.ts
TypeScript
ArrowFunction
(theme: Theme) => ({ block: { padding: theme.spacing(2, 2), cursor: 'pointer', borderBottom: `1px solid ${theme.palette.custom.lightGray}`, }, row: { display: 'flex', flexDirection: 'row', }, arrow: { marginRight: '20px', }, itemName: { fontSize: '16px', }, formControl: { '& .MuiInput-underline:hover:not(.Mui-disabled):before': { borderColor: 'white', }, }, selectRoot: { fontSize: '16px', fontWeight: 700, borderBottom: `1px solid ${theme.palette.custom.lightGray}`, '&:before': { borderColor: 'white', }, '&:after': { borderColor: 'white', }, '&:focus-within .MuiSelect-standard': { backgroundColor: 'white', }, '& .MuiInput-input': { paddingLeft: '16px', lineHeight: '66px', }, }, icon: { fill: `${colors.primary.main}`, marginRight: '10px', }, })
Boulevard/create-booking-flow
components/molecules/MobileSelectedServiceSelector/useStyles.ts
TypeScript
ClassDeclaration
export class TiltLoader extends Loader { constructor( manager?: LoadingManager ); load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>; parse( data: ArrayBuffer ): Group; }
assad-ali/web-ar-test
marker/node_modules/super-three/examples/jsm/loaders/TiltLoader.d.ts
TypeScript
MethodDeclaration
load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
assad-ali/web-ar-test
marker/node_modules/super-three/examples/jsm/loaders/TiltLoader.d.ts
TypeScript
MethodDeclaration
loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
assad-ali/web-ar-test
marker/node_modules/super-three/examples/jsm/loaders/TiltLoader.d.ts
TypeScript
MethodDeclaration
parse( data: ArrayBuffer ): Group;
assad-ali/web-ar-test
marker/node_modules/super-three/examples/jsm/loaders/TiltLoader.d.ts
TypeScript
FunctionDeclaration
/* returns [ sum(x_i * x_i), sum(x_i * y_i), sum(x_i * z_i), sum(y_i * x_i), sum(y_i * y_i), sum(y_i * z_i), sum(z_i * x_i), sum(z_i * y_i), sum(z_i * z_i) ] */ function transformSqrdComponentsByMatrix3x3(matrix: Matrix3x3, sqrd: Vector3): Matrix3x3 { const m = matrix; const x2 = (m[0])**2 * sqrd[0] + (m[3])**2 * sqrd[1] + (m[6])**2 * sqrd[2]; const y2 = (m[1])**2 * sqrd[0] + (m[4])**2 * sqrd[1] + (m[7])**2 * sqrd[2]; const z2 = (m[2])**2 * sqrd[0] + (m[5])**2 * sqrd[1] + (m[8])**2 * sqrd[2]; const xy = m[0] * m[1] * sqrd[0] + m[3] * m[4] * sqrd[1] + m[6] * m[7] * sqrd[2]; const yz = m[1] * m[2] * sqrd[0] + m[4] * m[5] * sqrd[1] + m[7] * m[8] * sqrd[2]; const zx = m[2] * m[0] * sqrd[0] + m[5] * m[3] * sqrd[1] + m[8] * m[6] * sqrd[2]; return [ x2, xy, zx, xy, y2, yz, zx, yz, z2 ] }
flurrux/rigidbody-rotation-sim
lib/inertia-tensor-transformation.ts
TypeScript
FunctionDeclaration
/* sum means the sum over all particles sumsOfSingles: [ sum(x_i), sum(y_i), sum(z_i) ] sumsOfPairs: [ sum(x_i * x_i), sum(x_i * y_i), sum(x_i * z_i), sum(y_i * x_i), sum(y_i * y_i), sum(y_i * z_i), sum(z_i * x_i), sum(z_i * y_i), sum(z_i * z_i) ] */ function calculateTranslatedInertiaTensorComponents( sumsOfPairs: number[], mass: number, translation: Vector3): number[] { const [tx, ty, tz] = translation; return [ sumsOfPairs[0] + mass * tx**2, sumsOfPairs[4] + mass * ty**2, sumsOfPairs[8] + mass * tz**2, sumsOfPairs[1] + mass * tx * ty, sumsOfPairs[5] + mass * ty * tz, sumsOfPairs[6] + mass * tz * tx ] }
flurrux/rigidbody-rotation-sim
lib/inertia-tensor-transformation.ts
TypeScript
FunctionDeclaration
/* components: [ x^2, y^2, z^2, x*y, y*z, z*x ] */ function createInertiaTensorFromComponents(components: number[]): Matrix3x3 { const c = components; return [ c[1] + c[2], -c[3], -c[5], -c[3], c[2] + c[0], -c[4], -c[5], -c[4], c[0] + c[1] ] }
flurrux/rigidbody-rotation-sim
lib/inertia-tensor-transformation.ts
TypeScript
FunctionDeclaration
export function calculateSqrdComponentsFromInertiaVector(inertiaVector: Vector3): Vector3 { const sqrdSum = (inertiaVector[0] + inertiaVector[1] + inertiaVector[2]) / 2; return subtract([sqrdSum, sqrdSum, sqrdSum], inertiaVector); }
flurrux/rigidbody-rotation-sim
lib/inertia-tensor-transformation.ts
TypeScript