type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
async () => { await $unitAdd.click(); const unitFill = await $$gatheringMarkerPaths.last().getAttribute("style"); await browser.actions() .mouseMove(lajiFormLocate("gatherings.0.units.0").getWebElement()) .perform(); const unitFillAfterLocationHover = await $$gatheringMarkerPaths.last().getAttribute("style"); expect(await unitFill).not.toBe(unitFillAfterLocationHover); await removeUnit(0, 1); }
luomus/laji-form
test/trip-report-spec.ts
TypeScript
ArrowFunction
async () => { await browser.actions() .mouseMove($getLocationButtonFor(0, 0).getWebElement()) .perform(); expect(await $locationPeeker.isDisplayed()).toBe(true); }
luomus/laji-form
test/trip-report-spec.ts
TypeScript
ArrowFunction
async () => { await browser.actions() .mouseMove($getLocationButtonFor(0, 0).getWebElement()) .perform(); await browser.wait(protractor.ExpectedConditions.visibilityOf($locationPeeker.$(".leaflet-container")), 5000, "Map peeker waiting timeout"); const $$peekerPaths = $$("#root_gatherings_0_units_0-location-peeker .vector-marker path"); expect(await $$peekerPaths.count()).not.toBe(0); const firstFill = await $$peekerPaths.first().getAttribute("fill"); const secondFill = await $$peekerPaths.last().getAttribute("fill"); expect(await firstFill).not.toBe(secondFill); }
luomus/laji-form
test/trip-report-spec.ts
TypeScript
ArrowFunction
async () => { await $gatheringAdd.click(); await clickLocationButtonAndAddLocation(1, 0); await waitUntilBlockingLoaderHides(6000); expect(await $$gatheringMarkerPaths.count()).toBe(1); await $("#root_gatherings_1-delete").click(); await $("#root_gatherings_1-delete-confirm-yes").click(); if (!googleApiKey) { await waitUntilBlockingLoaderHides(6000); } }
luomus/laji-form
test/trip-report-spec.ts
TypeScript
ArrowFunction
async () => { await $(".informal-taxon-group-chooser").click(); const getFieldCount = () => lajiFormLocate("gatherings.0.units.0").$$("input").count(); const fieldCount = await getFieldCount(); const $birdButton = element(by.className("MVL.1")).element(by.xpath("..")).$$("button").last(); // eslint-disable-line protractor/no-by-xpath await browser.wait(protractor.ExpectedConditions.visibilityOf($birdButton), 5000, "Bird button didn't show up"); await $birdButton.click(); await browser.wait(protractor.ExpectedConditions.visibilityOf(lajiFormLocate("gatherings.0.units.0.twitched")), 4000, "Bird field didn't appear"); expect(await fieldCount).not.toBe(await getFieldCount()); }
luomus/laji-form
test/trip-report-spec.ts
TypeScript
ArrowFunction
async () => { await $unitAdd.click(); const {resolve, remove} = await form.mockImageUpload("gatherings.0.units.1"); await form.$locate("gatherings.0.units.0").$$("td").first().click(); await resolve(); await form.$locate("gatherings.0.units.1").$$("td").first().click(); expect(await form.getImageArrayField("gatherings.0.units.1").$$imgs.count()).toBe(1); await remove(); await removeUnit(0, 1); }
luomus/laji-form
test/trip-report-spec.ts
TypeScript
ArrowFunction
async () => { await $unitAdd.click(); const {resolve, remove} = await form.mockImageUpload("gatherings.0.units.1"); await form.$locate("gatherings.0.units.0").$$("td").first().click(); await removeUnit(0, 1); await resolve(); await remove(); expect(await form.failedJobs.$container.isPresent()).toBe(false); }
luomus/laji-form
test/trip-report-spec.ts
TypeScript
ClassDeclaration
export class ArrowData { /** * Entity id where is arrow mapped to */ id: string; /** * label of mapped entity */ label: string; /** * Base feature for mapping */ word?: string; /** * Create new ArrowData instance * * @param id id * @param label label of mapped entity */ constructor (id: string, label: string) { this.id = id this.label = label } }
matejikj/Similarity_visualisation
src/models/ArrowData.ts
TypeScript
ArrowFunction
() => Orphanage
jmininel/NLW_3_HAPPY
backend/src/models/Image.ts
TypeScript
ArrowFunction
orphanage => orphanage.images
jmininel/NLW_3_HAPPY
backend/src/models/Image.ts
TypeScript
ClassDeclaration
@Entity('images') export default class Image { @PrimaryGeneratedColumn('increment') id: number; @Column() path: string; @ManyToOne(() => Orphanage, orphanage => orphanage.images) @JoinColumn({ name: 'orphanage_id' }) orphanage : Orphanage; }
jmininel/NLW_3_HAPPY
backend/src/models/Image.ts
TypeScript
ArrowFunction
() => ( <CardHeader style={
BlueBaseJS/plugin-react-native-paper
src/components/CardHeader/_stories_/CardHeader.stories.tsx
TypeScript
FunctionDeclaration
function merge<TObject, TSource>( object: TObject, source: TSource ): TObject & TSource;
kateract/interactive-node
types/lodash.merge.d.ts
TypeScript
FunctionDeclaration
function merge<TObject, TSource1, TSource2>( object: TObject, source1: TSource1, source2: TSource2 ): TObject & TSource1 & TSource2;
kateract/interactive-node
types/lodash.merge.d.ts
TypeScript
FunctionDeclaration
function merge<TObject, TSource1, TSource2, TSource3>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3 ): TObject & TSource1 & TSource2 & TSource3;
kateract/interactive-node
types/lodash.merge.d.ts
TypeScript
FunctionDeclaration
function merge<TObject, TSource1, TSource2, TSource3, TSource4>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): TObject & TSource1 & TSource2 & TSource3 & TSource4;
kateract/interactive-node
types/lodash.merge.d.ts
TypeScript
FunctionDeclaration
function merge<TResult>( object: any, ...otherArgs: any[] ): TResult;
kateract/interactive-node
types/lodash.merge.d.ts
TypeScript
FunctionDeclaration
/** * Resolve the x-ts-type in the schema object * @param spec - Controller spec * @param schema - Schema object */ function processSchemaExtensions( spec: ControllerSpec, schema?: SchemaObject | (ReferenceObject & ISpecificationExtension), ) { debug(' processing extensions in schema: %j', schema); if (!schema) return; assignRelatedSchemas(spec, schema.definitions); delete schema.definitions; /** * check if we have been provided a `not` * `not` is valid in many cases- here we're checking for * `not: { schema: {'x-ts-type': SomeModel }} */ if (schema.not) { processSchemaExtensions(spec, schema.not); } /** * check for schema.allOf, schema.oneOf, schema.anyOf arrays first. * You cannot provide BOTH a defnintion AND one of these keywords. */ /* istanbul ignore else */ const hasOwn = (prop: string) => schema != null && Object.prototype.hasOwnProperty.call(schema, prop); if (SCHEMA_ARR_KEYS.some(k => hasOwn(k))) { SCHEMA_ARR_KEYS.forEach((k: MixKey) => { /* istanbul ignore else */ if (schema?.[k] && Array.isArray(schema[k])) { schema[k].forEach((r: (SchemaObject | ReferenceObject)[]) => { processSchemaExtensions(spec, r); }); } }); } else { if (isReferenceObject(schema)) return; const tsType = schema[TS_TYPE_KEY]; debug(' %s => %o', TS_TYPE_KEY, tsType); if (tsType) { schema = resolveSchema(tsType, schema); if (schema.$ref) generateOpenAPISchema(spec, tsType); // We don't want a Function type in the final spec. delete schema[TS_TYPE_KEY]; return; } if (schema.type === 'array') { processSchemaExtensions(spec, schema.items); } else if (schema.type === 'object') { if (schema.properties) { for (const p in schema.properties) { processSchemaExtensions(spec, schema.properties[p]); } } } } }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
FunctionDeclaration
/** * Generate json schema for a given x-ts-type * @param spec - Controller spec * @param tsType - TS Type */ function generateOpenAPISchema(spec: ControllerSpec, tsType: Function) { spec.components = spec.components ?? {}; spec.components.schemas = spec.components.schemas ?? {}; if (tsType.name in spec.components.schemas) { // Preserve user-provided definitions debug(' skipping type %j as already defined', tsType.name || tsType); return; } const jsonSchema = getJsonSchema(tsType); const openapiSchema = jsonToSchemaObject(jsonSchema); assignRelatedSchemas(spec, openapiSchema.definitions); delete openapiSchema.definitions; debug(' defining schema for %j: %j', tsType.name, openapiSchema); spec.components.schemas[tsType.name] = openapiSchema; }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
FunctionDeclaration
/** * Assign related schemas from definitions to the controller spec * @param spec - Controller spec * @param definitions - Schema definitions */ function assignRelatedSchemas( spec: ControllerSpec, definitions?: SchemasObject, ) { if (!definitions) return; debug( ' assigning related schemas: ', definitions && Object.keys(definitions), ); spec.components = spec.components ?? {}; spec.components.schemas = spec.components.schemas ?? {}; const outputSchemas = spec.components.schemas; for (const key in definitions) { // Preserve user-provided definitions if (key in outputSchemas) continue; const relatedSchema = definitions[key]; debug(' defining referenced schema for %j: %j', key, relatedSchema); outputSchemas[key] = relatedSchema; } }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
FunctionDeclaration
/** * Get the controller spec for the given class * @param constructor - Controller class */ export function getControllerSpec(constructor: Function): ControllerSpec { let spec = MetadataInspector.getClassMetadata<ControllerSpec>( OAI3Keys.CONTROLLER_SPEC_KEY, constructor, {ownMetadataOnly: true}, ); if (!spec) { spec = resolveControllerSpec(constructor); MetadataInspector.defineMetadata( OAI3Keys.CONTROLLER_SPEC_KEY.key, spec, constructor, ); } return spec; }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
FunctionDeclaration
/** * Describe the provided Model as a reference to a definition shared by multiple * endpoints. The definition is included in the returned schema. * * @example * * ```ts * const schema = { * $ref: '#/components/schemas/Product', * definitions: { * Product: { * title: 'Product', * properties: { * // etc. * } * } * } * } * ``` * * @param modelCtor - The model constructor (e.g. `Product`) * @param options - Additional options */ export function getModelSchemaRef<T extends object>( modelCtor: Function & {prototype: T}, options?: JsonSchemaOptions<T>, ): SchemaRef { const jsonSchema = getJsonSchemaRef(modelCtor, options); return jsonToSchemaObject(jsonSchema) as SchemaRef; }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
(p, i) => { if (p == null) return false; paramIndexes.push(i); return true; }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
p => { // Per OpenAPI spec, `required` must be `true` for path parameters if (p.in === 'path') { p.required = true; } return p; }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
(p, i) => { if (p == null) return false; bodyIndexes.push(i); return true; }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
(ctor: Function) => !includes([String, Number, Boolean, Array, Object], ctor)
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
(prop: string) => schema != null && Object.prototype.hasOwnProperty.call(schema, prop)
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
k => hasOwn(k)
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
(k: MixKey) => { /* istanbul ignore else */ if (schema?.[k] && Array.isArray(schema[k])) { schema[k].forEach((r: (SchemaObject | ReferenceObject)[]) => { processSchemaExtensions(spec, r); }); } }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
(r: (SchemaObject | ReferenceObject)[]) => { processSchemaExtensions(spec, r); }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
InterfaceDeclaration
export interface ControllerSpec { /** * The base path on which the Controller API is served. * If it is not included, the API is served directly under the host. * The value MUST start with a leading slash (/). */ basePath?: string; /** * The available paths and operations for the API. */ paths: PathObject; /** * OpenAPI components.schemas generated from model metadata */ components?: ComponentsObject; }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
InterfaceDeclaration
/** * Data structure for REST related metadata */ export interface RestEndpoint { verb: string; path: string; spec?: OperationObject; }
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
TypeAliasDeclaration
declare type MixKey = 'allOf' | 'anyOf' | 'oneOf';
krishna-maitretech/loopback-next
packages/openapi-v3/src/controller-spec.ts
TypeScript
ArrowFunction
({paneInstance}) => { return ( <BasePanel panelId={`pane-${paneInstance.instanceId}` as UIPanelId}
Mu-L/theatre
theatre/studio/src/panels/BasePanel/ExtensionPaneWrapper.tsx
TypeScript
ArrowFunction
(props) => { return ( <ErrorContainer> An Error occured rendering this pane. Open the console for more info. <pre> {JSON.stringify( {message: props.error.message, stack: props.error.stack}, null, 2, )} </pre> </ErrorContainer> ) }
Mu-L/theatre
theatre/studio/src/panels/BasePanel/ExtensionPaneWrapper.tsx
TypeScript
ArrowFunction
({ paneInstance, }) => { const Comp = paneInstance.definition.component const closePane = useCallback(() => { getStudio().paneManager.destroyPane( paneInstance.instanceId as PaneInstanceId, ) }, [paneInstance]) return ( <Container> <PanelDragZone> <TitleBar> <PaneTools> <ClosePanelButton onClick={closePane} title={'Close Pane'}> <IoClose /> </ClosePanelButton> </PaneTools> <Title>{paneInstance.instanceId}</Title> </TitleBar> </PanelDragZone> <F2> <ErrorBoundary FallbackComponent={ErrorFallback}> <Comp paneId={paneInstance.instanceId} /> </ErrorBoundary> </F2> </Container>
Mu-L/theatre
theatre/studio/src/panels/BasePanel/ExtensionPaneWrapper.tsx
TypeScript
ArrowFunction
() => { getStudio().paneManager.destroyPane( paneInstance.instanceId as PaneInstanceId, ) }
Mu-L/theatre
theatre/studio/src/panels/BasePanel/ExtensionPaneWrapper.tsx
TypeScript
ArrowFunction
(vue: any) => { componentsName.forEach((i) => { vue.component(i, components[i]); }); vue.use(noty); }
isabella232/skywalking-rocketbot-ui
src/components/index.ts
TypeScript
ArrowFunction
(i) => { vue.component(i, components[i]); }
isabella232/skywalking-rocketbot-ui
src/components/index.ts
TypeScript
ArrowFunction
() => <></>;
Sumit2399/design-system
core/components/patterns/datePicker/dateAndTimePicker.story.tsx
TypeScript
ClassDeclaration
@Injectable({ providedIn: 'root' }) export class CyNodeService { constructor(public http: HttpClient) { } getData(name: any): Observable<any> { return this.http.get('assets/' + name + '.cyjs') } getStylesheet(name: any): Observable<any> { return this.http.get('assets/' + name + '.json') } }
bryanl/cytoscape-angular
example-project/src/app/cy-node.service.ts
TypeScript
MethodDeclaration
getData(name: any): Observable<any> { return this.http.get('assets/' + name + '.cyjs') }
bryanl/cytoscape-angular
example-project/src/app/cy-node.service.ts
TypeScript
MethodDeclaration
getStylesheet(name: any): Observable<any> { return this.http.get('assets/' + name + '.json') }
bryanl/cytoscape-angular
example-project/src/app/cy-node.service.ts
TypeScript
ArrowFunction
() => { const dispatch = useDispatch(); const handleInputChange = (e: ChangeEvent<HTMLFormElement>): void => { dispatch(inputFilterAction(e.target.value)); }; return ( <div className='row'> <form className='col s10' onChange={handleInputChange}> <div className='row'> <div className='input-field col s12'> <i className='material-icons prefix'>mode_edit</i> <textarea id='icon_prefix2' className='materialize-textarea' ></textarea> <label htmlFor='icon_prefix2'>Serch here...</label> </div> </div> </form> </div>
Aztek2008/swapi-ava-app
src/components/InputFilter/InputFilter.tsx
TypeScript
ArrowFunction
(e: ChangeEvent<HTMLFormElement>): void => { dispatch(inputFilterAction(e.target.value)); }
Aztek2008/swapi-ava-app
src/components/InputFilter/InputFilter.tsx
TypeScript
ArrowFunction
props => { const { trigger: triggerFromProps, children: childrenFromProps, ...rest } = props; let trigger = triggerFromProps; let children = childrenFromProps; React.Children.forEach(children, child => { if (isValidElement(child) && child.type === Wrapper) { trigger = child.props.children; children = _.without(props.children as ReactNodeArray, child); } }); return ( <PopupSemanticUiReact {...rest} trigger={trigger}> {children} </PopupSemanticUiReact>
cloudify-cosmo/cloudify-ui-components
src/components/popups/Popup/Popup.tsx
TypeScript
ArrowFunction
child => { if (isValidElement(child) && child.type === Wrapper) { trigger = child.props.children; children = _.without(props.children as ReactNodeArray, child); } }
cloudify-cosmo/cloudify-ui-components
src/components/popups/Popup/Popup.tsx
TypeScript
InterfaceDeclaration
interface AdditionalPopupProperties { Header: typeof PopupSemanticUiReact.Header; Content: typeof PopupSemanticUiReact.Content; Trigger: typeof Wrapper; }
cloudify-cosmo/cloudify-ui-components
src/components/popups/Popup/Popup.tsx
TypeScript
TypeAliasDeclaration
export type PopupProps = SemanticUiPopupProps;
cloudify-cosmo/cloudify-ui-components
src/components/popups/Popup/Popup.tsx
TypeScript
FunctionDeclaration
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ /** * Executes the commands needed to get a list of devices from ADB */ declare function getDevices(adbPath: string): Array<string>;
1-8192/DogsBestFriendApp
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/adb.d.ts
TypeScript
FunctionDeclaration
/** * Gets available CPUs of devices from ADB */ declare function getAvailableCPUs(adbPath: string, device: string): Array<string>;
1-8192/DogsBestFriendApp
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/adb.d.ts
TypeScript
FunctionDeclaration
/** * Gets the CPU architecture of a device from ADB */ declare function getCPU(adbPath: string, device: string): string | null;
1-8192/DogsBestFriendApp
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/adb.d.ts
TypeScript
ArrowFunction
(): IUseCommentsManagement => { const [comments, setComments] = useState([]); const fetchComments = () => { return fetch('https://jsonplaceholder.typicode.com/comments') .then((response) => response.json()) .then((data) => { setComments(data); }); }; return { comments, fetchComments }; }
mingyuchoo/jest-setup-series
25-ts-react-testing-library/src/09-custom-hooks/hooks/useCommentsManagement.ts
TypeScript
ArrowFunction
() => { return fetch('https://jsonplaceholder.typicode.com/comments') .then((response) => response.json()) .then((data) => { setComments(data); }); }
mingyuchoo/jest-setup-series
25-ts-react-testing-library/src/09-custom-hooks/hooks/useCommentsManagement.ts
TypeScript
ArrowFunction
(data) => { setComments(data); }
mingyuchoo/jest-setup-series
25-ts-react-testing-library/src/09-custom-hooks/hooks/useCommentsManagement.ts
TypeScript
InterfaceDeclaration
interface IUseCommentsManagement { comments: never[]; fetchComments: () => Promise<void>; }
mingyuchoo/jest-setup-series
25-ts-react-testing-library/src/09-custom-hooks/hooks/useCommentsManagement.ts
TypeScript
ClassDeclaration
@Module({ imports: [ GraphQLModule.forRoot({ playground: true, installSubscriptionHandlers: true, autoSchemaFile: 'schema.gql', }), ], providers: [AppService, AppResolver], }) export class AppModule {}
greenreign/test-gql-subscriptions
src/app.module.ts
TypeScript
InterfaceDeclaration
export interface IProxyApi { send(channel: string, ...data: any[]): void; receive(channel: string, handler: (...data: any[]) => void): void; }
greggbjensen/power-runner
src/app/core/models/iproxy-api.ts
TypeScript
ClassDeclaration
export class CreateBruce implements Seed { public async seed(factory: Factory, connection: Connection): Promise<User> { // const userFactory = factory<User, { role: string }>(User as any); // const adminUserFactory = userFactory({ role: 'admin' }); // const bruce = await adminUserFactory.make(); // console.log(bruce); // const bruce2 = await adminUserFactory.seed(); // console.log(bruce2); // const bruce3 = await adminUserFactory // .map(async (e: User) => { // e.firstName = 'Bruce'; // return e; // }) // .seed(); // console.log(bruce3); // return bruce; // const connection = await factory.getConnection(); const em = connection.createEntityManager(); const user = new User(); user.id = uuid.v1(); user.firstName = 'Muchlish'; user.lastName = 'Choruddin'; user.email = 'muchlishchoeruddin96@gmail.com'; user.username = 'Mcx002'; user.password = 'admin1234'; user.user_stat = UserStat.admin; return await em.save(user); } }
Mcx002/MyDefaultBackendProject-TypeScript
src/database/seeds/CreateBruce.ts
TypeScript
MethodDeclaration
public async seed(factory: Factory, connection: Connection): Promise<User> { // const userFactory = factory<User, { role: string }>(User as any); // const adminUserFactory = userFactory({ role: 'admin' }); // const bruce = await adminUserFactory.make(); // console.log(bruce); // const bruce2 = await adminUserFactory.seed(); // console.log(bruce2); // const bruce3 = await adminUserFactory // .map(async (e: User) => { // e.firstName = 'Bruce'; // return e; // }) // .seed(); // console.log(bruce3); // return bruce; // const connection = await factory.getConnection(); const em = connection.createEntityManager(); const user = new User(); user.id = uuid.v1(); user.firstName = 'Muchlish'; user.lastName = 'Choruddin'; user.email = 'muchlishchoeruddin96@gmail.com'; user.username = 'Mcx002'; user.password = 'admin1234'; user.user_stat = UserStat.admin; return await em.save(user); }
Mcx002/MyDefaultBackendProject-TypeScript
src/database/seeds/CreateBruce.ts
TypeScript
ArrowFunction
() => '[id="sign-out-btn"]'
IT-Labs/Cypress-workshop
cypress/pageObjects/logout/logout.elements.ts
TypeScript
ClassDeclaration
export class LogoutPageElements { static get elementsLogout() { return { getBtnLogout: () => '[id="sign-out-btn"]' }; } }
IT-Labs/Cypress-workshop
cypress/pageObjects/logout/logout.elements.ts
TypeScript
ArrowFunction
props => ( <svg width="1em"
pwcong/rc-component-x
packages/icon/icons/arrow-up-circle.tsx
TypeScript
FunctionDeclaration
/** * Creates a client-side Guid string. * @returns A string representation of a Guid. */ export function generateGuid(): string { let guid = "", idx = 0; for (idx = 0; idx < 32; idx += 1) { let guidDigitsItem = Math.random() * 16 | 0; switch (idx) { case 8: case 12: case 16: case 20: guid += "-"; break; } guid += guidDigitsItem.toString(16); } return guid; }
testingPowerBI/powerbi
src/Clients/VisualsExtensibility/telemetry/generateGuid.ts
TypeScript
ArrowFunction
(result) => { if (result.token) { console.log(result.token); } else if (result.error) { console.log(result.error.message); } }
jon-armen/ngx-stripe
projects/ngx-stripe-tester/src/app/stripe-test-03/stripe-test-03.component.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-test-03', template: ` <app-section maxWidth="900"> <mat-toolbar color="secondary" section-content-header> <span>Card Example</span> </mat-toolbar> <div section-content> <p>Minimum example, just fill the form and get your token</p> <ngx-stripe-card [options]="cardOptions" [elementsOptions]="elementsOptions" ></ngx-stripe-card> <button (click)="buy()">CLICK</button> </div> </app-section> `, styles: [] }) export class Test03Component { @ViewChild(StripeCardComponent) card: StripeCardComponent; cardOptions: StripeCardElementOptions = { style: { base: { iconColor: '#666EE8', color: '#31325F', fontWeight: '300', fontFamily: '"Helvetica Neue", Helvetica, sans-serif', fontSize: '18px', '::placeholder': { color: '#CFD7E0' } } } }; elementsOptions: StripeElementsOptions = { locale: 'es' }; constructor(private stripeService: StripeService) {} buy() { this.stripeService .createToken(this.card.getCard(), { name: 'Ricardo' }) .subscribe((result) => { if (result.token) { console.log(result.token); } else if (result.error) { console.log(result.error.message); } }); } }
jon-armen/ngx-stripe
projects/ngx-stripe-tester/src/app/stripe-test-03/stripe-test-03.component.ts
TypeScript
MethodDeclaration
buy() { this.stripeService .createToken(this.card.getCard(), { name: 'Ricardo' }) .subscribe((result) => { if (result.token) { console.log(result.token); } else if (result.error) { console.log(result.error.message); } }); }
jon-armen/ngx-stripe
projects/ngx-stripe-tester/src/app/stripe-test-03/stripe-test-03.component.ts
TypeScript
FunctionDeclaration
export function getActiveTool(): ITool { return toolMap[activeTool.value]; }
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
FunctionDeclaration
export function toggleActiveMode(): void { activeToolMode.value = activeToolMode.value === ToolMode.Build ? ToolMode.Play : ToolMode.Build; if (!buildTools.some((t) => t[0] === activeTool.value) || !playTools.some((t) => t[0] === activeTool.value)) { activeTool.value = ToolName.Select; } const tool = getActiveTool(); for (const permitted of tool.permittedTools) { if (!(permitted.early ?? false)) continue; toolMap[permitted.name].onToolsModeChange(activeToolMode.value, permitted.features); } tool.onToolsModeChange(activeToolMode.value, getFeatures(activeTool.value)); for (const permitted of tool.permittedTools) { if (permitted.early ?? false) continue; toolMap[permitted.name].onToolsModeChange(activeToolMode.value, permitted.features); } }
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
FunctionDeclaration
export function getFeatures(tool: ToolName): ToolFeatures { return activeModeTools.value.find((t) => t[0] === tool)?.[1] ?? {}; }
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
FunctionDeclaration
export function activateTool(tool: ToolName): void { toolMap[tool].onSelect(); }
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
FunctionDeclaration
export function deactivateTool(tool: ToolName): void { toolMap[tool].onDeselect(); }
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
ArrowFunction
() => (activeToolMode.value === ToolMode.Build ? buildTools : playTools)
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
ArrowFunction
(newTool, oldTool) => { toolMap[oldTool].onDeselect(); toolMap[newTool].onSelect(); }
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
ArrowFunction
(t) => t[0] === activeTool.value
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
ArrowFunction
(t) => t[0] === tool
CalebKoch/PlanarAlly
client/src/game/tools/tools.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-footer', templateUrl: './footer.component.html', styleUrls: ['./footer.component.scss'] }) export class FooterComponent implements OnInit { constructor () { } ngOnInit (): void { } }
tomuk91/gamingnewswebsite
resources/frontend/angular/src/app/core/components/footer/footer.component.ts
TypeScript
MethodDeclaration
ngOnInit (): void { }
tomuk91/gamingnewswebsite
resources/frontend/angular/src/app/core/components/footer/footer.component.ts
TypeScript
InterfaceDeclaration
/** * * @export * @interface DeviceType */ export interface DeviceType { /** * * @type {number} * @memberof DeviceType */ id?: number; /** * * @type {string} * @memberof DeviceType */ url?: string; /** * * @type {NestedManufacturer} * @memberof DeviceType */ manufacturer: NestedManufacturer; /** * * @type {string} * @memberof DeviceType */ model: string; /** * * @type {string} * @memberof DeviceType */ slug: string; /** * * @type {string} * @memberof DeviceType */ display_name?: string; /** * Discrete part number (optional) * @type {string} * @memberof DeviceType */ part_number?: string; /** * * @type {number} * @memberof DeviceType */ u_height?: number; /** * Device consumes both front and rear rack faces * @type {boolean} * @memberof DeviceType */ is_full_depth?: boolean; /** * * @type {SubdeviceRole} * @memberof DeviceType */ subdevice_role?: SubdeviceRole; /** * * @type {string} * @memberof DeviceType */ front_image?: string; /** * * @type {string} * @memberof DeviceType */ rear_image?: string; /** * * @type {string} * @memberof DeviceType */ comments?: string; /** * * @type {Array<NestedTag>} * @memberof DeviceType */ tags?: Array<NestedTag>; /** * * @type {object} * @memberof DeviceType */ custom_fields?: object; /** * * @type {string} * @memberof DeviceType */ created?: string; /** * * @type {string} * @memberof DeviceType */ last_updated?: string; /** * * @type {number} * @memberof DeviceType */ device_count?: number; }
yoldi/netbox-nodejs-api
src/models/device-type.ts
TypeScript
ClassDeclaration
class SomeClass { foo!: number; bar?: string; baz: number | undefined; constructor({foo, bar, baz}: SomeInterface) { this.foo = foo; this.bar = bar; this.baz = baz; } }
younho9/ts-indexify
index.test-d.ts
TypeScript
InterfaceDeclaration
interface SomeInterface { foo: number; bar?: string; baz: number | undefined; }
younho9/ts-indexify
index.test-d.ts
TypeScript
TypeAliasDeclaration
type SomeType = { foo: number; bar?: string; baz: number | undefined; };
younho9/ts-indexify
index.test-d.ts
TypeScript
TypeAliasDeclaration
type Dict = Record<string, unknown>;
younho9/ts-indexify
index.test-d.ts
TypeScript
ArrowFunction
(modulo) => { ROUTES.map((route) => { if (modulo.getPkidmodulo() == route.valor) { //console.log(modulo.getNombremodulo()); nuevosRoutes.push(route) } }) }
tekodan/dashboard_v2
src/app/components/sidebar/sidebar.component.ts
TypeScript
ArrowFunction
(route) => { if (modulo.getPkidmodulo() == route.valor) { //console.log(modulo.getNombremodulo()); nuevosRoutes.push(route) } }
tekodan/dashboard_v2
src/app/components/sidebar/sidebar.component.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-sidebar', templateUrl: './sidebar.component.html', styleUrls: ['./sidebar.component.css'] }) export class SidebarComponent implements OnInit { menuItems: any[]; public identity; urlimagen: string = '../' + GLOBAL.urlBase + '/assets/img/empleado.png'; nombreUsuario: string; modulos: Modulo[]; constructor() { this.identity = this.getIdentity(); if (this.identity.rutaimagen != null) { let imagen: string = this.identity.rutaimagen; this.urlimagen = GLOBAL.urlImagen + (imagen.substring(3)); } this.nombreUsuario = this.identity.name + " " + this.identity.surname; } ngOnInit() { this.mostrarMenus(); } isMobileMenu() { if ($(window).width() > 991) { return false; } return true; }; mostrarMenus() { this.modulos = plainToClass(Modulo, this.identity.modulos); let nuevosRoutes: RouteInfo[] = []; this.modulos.map((modulo) => { ROUTES.map((route) => { if (modulo.getPkidmodulo() == route.valor) { //console.log(modulo.getNombremodulo()); nuevosRoutes.push(route) } }) }); console.log(nuevosRoutes); this.menuItems = nuevosRoutes.filter(menuItem => menuItem); //this.menuItems = ROUTES.filter(menuItem => menuItem); } //Obtener de manera globar los datos del usuario getIdentity() { let identity = JSON.parse(localStorage.getItem('identity')); if (identity != "undefined") { this.identity = identity; } else { this.identity = null; } return this.identity; } }
tekodan/dashboard_v2
src/app/components/sidebar/sidebar.component.ts
TypeScript
InterfaceDeclaration
declare interface RouteInfo { path: string; title: string; icon: string; class: string; valor: number; }
tekodan/dashboard_v2
src/app/components/sidebar/sidebar.component.ts
TypeScript
MethodDeclaration
ngOnInit() { this.mostrarMenus(); }
tekodan/dashboard_v2
src/app/components/sidebar/sidebar.component.ts
TypeScript
MethodDeclaration
isMobileMenu() { if ($(window).width() > 991) { return false; } return true; }
tekodan/dashboard_v2
src/app/components/sidebar/sidebar.component.ts
TypeScript
MethodDeclaration
mostrarMenus() { this.modulos = plainToClass(Modulo, this.identity.modulos); let nuevosRoutes: RouteInfo[] = []; this.modulos.map((modulo) => { ROUTES.map((route) => { if (modulo.getPkidmodulo() == route.valor) { //console.log(modulo.getNombremodulo()); nuevosRoutes.push(route) } }) }); console.log(nuevosRoutes); this.menuItems = nuevosRoutes.filter(menuItem => menuItem); //this.menuItems = ROUTES.filter(menuItem => menuItem); }
tekodan/dashboard_v2
src/app/components/sidebar/sidebar.component.ts
TypeScript
MethodDeclaration
//Obtener de manera globar los datos del usuario getIdentity() { let identity = JSON.parse(localStorage.getItem('identity')); if (identity != "undefined") { this.identity = identity; } else { this.identity = null; } return this.identity; }
tekodan/dashboard_v2
src/app/components/sidebar/sidebar.component.ts
TypeScript
FunctionDeclaration
function authNoOp( req: Express.Request, res: Express.Response, next: (err?: Error) => void) { // @ts-ignore req.user = { 'sub' : nextAuth0UserId, 'https://machinelearningforkids.co.uk/api/role' : nextAuth0UserRole, 'https://machinelearningforkids.co.uk/api/tenant' : nextAuth0UserTenant, }; next(); }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript
FunctionDeclaration
function emptyClass(): Promise<{ [id: string]: auth0objects.Student }> { return Promise.resolve({}); }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript
FunctionDeclaration
function testCreateProject(classid: string, user: string, crowd: boolean): Promise<any> { return request(testServer) .post('/api/classes/' + classid + '/students/' + user + '/projects') .send({ name : uuid(), type : 'text', language : 'en', isCrowdSourced : crowd }) .expect('Content-Type', /json/) .expect(httpstatus.CREATED) .then((res) => { return res.body; }); }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript
FunctionDeclaration
function testGetProjects(classid: string, user: string): Promise<any> { return request(testServer) .get('/api/classes/' + classid + '/students/' + user + '/projects') .expect('Content-Type', /json/) .expect(httpstatus.OK) .then((res) => { return res.body; }); }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript
FunctionDeclaration
function testSetUser(classid: string, user: string) { nextAuth0UserTenant = classid; nextAuth0UserId = user; nextAuth0UserRole = 'student'; }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript
FunctionDeclaration
function testSetTeacher(classid: string, user: string) { testSetUser(classid, user); nextAuth0UserRole = 'supervisor'; }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript
FunctionDeclaration
function compareProjects(objA: any, objB: any) { if (objA.id > objB.id) { return 1; } if (objA.id < objB.id) { return -1; } return 0; }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript
FunctionDeclaration
async function testVerifyAll( classid: string, studentA: string, studentB: string, teacherId: string, expected: any) { expected.studentA.sort(compareProjects); expected.studentB.sort(compareProjects); expected.teacher.sort(compareProjects); testSetUser(classid, studentA); let projects = await testGetProjects(classid, studentA); projects.sort(compareProjects); assert.deepStrictEqual(projects, expected.studentA); testSetUser(classid, studentB); projects = await testGetProjects(classid, studentB); projects.sort(compareProjects); assert.deepStrictEqual(projects, expected.studentB); testSetTeacher(classid, teacherId); projects = await testGetProjects(classid, teacherId); projects.sort(compareProjects); assert.deepStrictEqual(projects, expected.teacher); }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript
ArrowFunction
async () => { authStub = sinon.stub(auth, 'authenticate').callsFake(authNoOp); studentsByUserIdStub = sinon.stub(auth0users, 'getStudentsByUserId').callsFake(emptyClass); await store.init(); testServer = testapiserver(); return store.deleteProjectsByClassId(TESTCLASS); }
OwenG88/taxinomitis
src/tests/restapi/projects.ts
TypeScript