type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
()=>{ this.navCtrl.setRoot(HomePage); }
fkurtulus/IonicFirebaseApp
src/pages/login/login.ts
TypeScript
ArrowFunction
error=>{ this.loading.dismiss().then(()=>{ const alert : Alert = this.alertCtrl.create({ message:error.message, buttons:[{text:'OK',role:'cancel'}] }); alert.present(); }); }
fkurtulus/IonicFirebaseApp
src/pages/login/login.ts
TypeScript
ArrowFunction
()=>{ const alert : Alert = this.alertCtrl.create({ message:error.message, buttons:[{text:'OK',role:'cancel'}] }); alert.present(); }
fkurtulus/IonicFirebaseApp
src/pages/login/login.ts
TypeScript
ClassDeclaration
@IonicPage() @Component({ selector: 'page-login', templateUrl: 'login.html', }) export class LoginPage { public loginForm : FormGroup; public loading : Loading; constructor(public navCtrl: NavController, public navParams: NavParams, public loadingCtrl:LoadingController, public alertCtrl:AlertController,public authProvider:AuthProvider,formBuilder:FormBuilder) { this.loginForm = formBuilder.group({ email: ['',Validators.compose([Validators.required,EmailValidator.isValid])], password: ['',Validators.compose([Validators.required,Validators.minLength(6)])] }); } goToSignup():void{ this.navCtrl.push('SignupPage'); } goToResetPassword():void{ this.navCtrl.push('PasswordRestartPage'); } loginUser():void{ if(!this.loginForm.valid){ console.log('Not Valid'); }else{ const email = this.loginForm.value.email; const pass = this.loginForm.value.password; this.authProvider.loginUser(email,pass).then(authData=>{ this.loading.dismiss().then(()=>{ this.navCtrl.setRoot(HomePage); }); }, error=>{ this.loading.dismiss().then(()=>{ const alert : Alert = this.alertCtrl.create({ message:error.message, buttons:[{text:'OK',role:'cancel'}] }); alert.present(); }); }); this.loading = this.loadingCtrl.create(); this.loading.present(); } } ionViewDidLoad() { console.log('ionViewDidLoad LoginPage'); } }
fkurtulus/IonicFirebaseApp
src/pages/login/login.ts
TypeScript
MethodDeclaration
goToSignup():void{ this.navCtrl.push('SignupPage'); }
fkurtulus/IonicFirebaseApp
src/pages/login/login.ts
TypeScript
MethodDeclaration
goToResetPassword():void{ this.navCtrl.push('PasswordRestartPage'); }
fkurtulus/IonicFirebaseApp
src/pages/login/login.ts
TypeScript
MethodDeclaration
loginUser():void{ if(!this.loginForm.valid){ console.log('Not Valid'); }else{ const email = this.loginForm.value.email; const pass = this.loginForm.value.password; this.authProvider.loginUser(email,pass).then(authData=>{ this.loading.dismiss().then(()=>{ this.navCtrl.setRoot(HomePage); }); }, error=>{ this.loading.dismiss().then(()=>{ const alert : Alert = this.alertCtrl.create({ message:error.message, buttons:[{text:'OK',role:'cancel'}] }); alert.present(); }); }); this.loading = this.loadingCtrl.create(); this.loading.present(); } }
fkurtulus/IonicFirebaseApp
src/pages/login/login.ts
TypeScript
ArrowFunction
(data: string[]) => data.map(option => { return { key: option, selected: false, }; })
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
option => { return { key: option, selected: false, }; }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
key => key === id
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
() => { const { options, question } = this.props; return !!options ? options : emptyList(question.options); }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
(id: string) => { const { dispatch, question } = this.props; const inclusiveOption = question.inclusiveOption; const dataItem = this._getData().find( (option: Option) => option.key === id ); if (!!dataItem) { const toggled = !dataItem.selected; let data = this._isExclusive(id) ? emptyList(question.options) : this._getData().slice(0); data = data.map((option: Option) => { if (inclusiveOption === id && !this._isExclusive(option.key)) { return { key: option.key, selected: true, }; } if (this._isExclusive(option.key) && !this._isExclusive(id)) { return { key: option.key, selected: false, }; } if (inclusiveOption === option.key && inclusiveOption !== id) { return { key: option.key, selected: false, }; } return { key: option.key, selected: option.key === id ? toggled : option.selected, }; }); dispatch(updateAnswer({ options: data }, question)); } }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
(option: Option) => option.key === id
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
(option: Option) => { if (inclusiveOption === id && !this._isExclusive(option.key)) { return { key: option.key, selected: true, }; } if (this._isExclusive(option.key) && !this._isExclusive(id)) { return { key: option.key, selected: false, }; } if (inclusiveOption === option.key && inclusiveOption !== id) { return { key: option.key, selected: false, }; } return { key: option.key, selected: option.key === id ? toggled : option.selected, }; }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
(option: Option) => ( <OptionItem highlighted={highlighted}
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
(state: StoreState, props: Props) => ({ options: getAnswer(state, props.question), })
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ArrowFunction
() => { this.props.onPressItem(this.props.id); }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ClassDeclaration
class OptionList extends React.PureComponent<Props> { _isExclusive(id: string): boolean { return (this.props.question.exclusiveOptions || []).some(key => key === id); } _getData = () => { const { options, question } = this.props; return !!options ? options : emptyList(question.options); }; _onPressItem = (id: string) => { const { dispatch, question } = this.props; const inclusiveOption = question.inclusiveOption; const dataItem = this._getData().find( (option: Option) => option.key === id ); if (!!dataItem) { const toggled = !dataItem.selected; let data = this._isExclusive(id) ? emptyList(question.options) : this._getData().slice(0); data = data.map((option: Option) => { if (inclusiveOption === id && !this._isExclusive(option.key)) { return { key: option.key, selected: true, }; } if (this._isExclusive(option.key) && !this._isExclusive(id)) { return { key: option.key, selected: false, }; } if (inclusiveOption === option.key && inclusiveOption !== id) { return { key: option.key, selected: false, }; } return { key: option.key, selected: option.key === id ? toggled : option.selected, }; }); dispatch(updateAnswer({ options: data }, question)); } }; render() { const { highlighted, question } = this.props; const options = question.options; return ( <View style={styles.container}> {this._getData().map((option: Option) => ( <OptionItem highlighted={highlighted} id={option.key} key={option.key} selected={option.selected} style={ option.key === options[options.length - 1] && styles.itemLast } onPressItem={this._onPressItem} /> ))} </View> ); } }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
ClassDeclaration
class Item extends React.Component<ItemProps & WithNamespaces> { shouldComponentUpdate(props: ItemProps & WithNamespaces) { return ( this.props.highlighted != props.highlighted || this.props.selected != props.selected || this.props.style != props.style || this.props.id != props.id ); } _onPress = () => { this.props.onPressItem(this.props.id); }; render() { const { highlighted, id, selected, t } = this.props; return ( <TouchableOpacity style={[styles.item, this.props.style]} onPress={this._onPress} > <View style={[ styles.checkbox, selected && styles.checkboxSelected, !!highlighted && HIGHLIGHT_STYLE, ]} > {selected && ( <Feather name="check" color={"white"} size={FEATHER_SIZE} /> )}
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
InterfaceDeclaration
interface Props { question: OptionQuestion; highlighted?: boolean; options?: Option[]; dispatch(action: Action): void; }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
InterfaceDeclaration
interface ItemProps { highlighted?: boolean; id: string; selected: boolean; style?: StyleProp<ViewStyle>; onPressItem(id: string): void; }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
MethodDeclaration
_isExclusive(id: string): boolean { return (this.props.question.exclusiveOptions || []).some(key => key === id); }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
MethodDeclaration
render() { const { highlighted, question } = this.props; const options = question.options; return ( <View style={styles.container}> {this._getData().map((option: Option) => ( <OptionItem highlighted={highlighted} id={option.key} key={option.key} selected={option.selected} style={ option.key === options[options.length - 1] && styles.itemLast } onPressItem={this._onPressItem} /> ))} </View> ); }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
MethodDeclaration
shouldComponentUpdate(props: ItemProps & WithNamespaces) { return ( this.props.highlighted != props.highlighted || this.props.selected != props.selected || this.props.style != props.style || this.props.id != props.id ); }
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
MethodDeclaration
render() { const { highlighted, id, selected, t } = this.props; return ( <TouchableOpacity style={[styles.item, this.props.style]} onPress={this._onPress} > <View style={[ styles.checkbox, selected && styles.checkboxSelected, !!highlighted && HIGHLIGHT_STYLE, ]} > {selected && ( <Feather name="check" color={"white"} size={FEATHER_SIZE} /> )}
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
MethodDeclaration
t(`surveyOption:${id
rgatkinson/audere
FluStudy_us/src/ui/components/OptionList.tsx
TypeScript
FunctionDeclaration
/** * Virtual Network resource. */ export function getVirtualNetwork(args: GetVirtualNetworkArgs, opts?: pulumi.InvokeOptions): Promise<GetVirtualNetworkResult> { if (!opts) { opts = {} } if (!opts.version) { opts.version = utilities.getVersion(); } return pulumi.runtime.invoke("azure-nextgen:network/v20200501:getVirtualNetwork", { "expand": args.expand, "resourceGroupName": args.resourceGroupName, "virtualNetworkName": args.virtualNetworkName, }, opts); }
pulumi/pulumi-azure-nextgen
sdk/nodejs/network/v20200501/getVirtualNetwork.ts
TypeScript
InterfaceDeclaration
export interface GetVirtualNetworkArgs { /** * Expands referenced resources. */ readonly expand?: string; /** * The name of the resource group. */ readonly resourceGroupName: string; /** * The name of the virtual network. */ readonly virtualNetworkName: string; }
pulumi/pulumi-azure-nextgen
sdk/nodejs/network/v20200501/getVirtualNetwork.ts
TypeScript
InterfaceDeclaration
/** * Virtual Network resource. */ export interface GetVirtualNetworkResult { /** * The AddressSpace that contains an array of IP address ranges that can be used by subnets. */ readonly addressSpace?: outputs.network.v20200501.AddressSpaceResponse; /** * Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. */ readonly bgpCommunities?: outputs.network.v20200501.VirtualNetworkBgpCommunitiesResponse; /** * The DDoS protection plan associated with the virtual network. */ readonly ddosProtectionPlan?: outputs.network.v20200501.SubResourceResponse; /** * The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network. */ readonly dhcpOptions?: outputs.network.v20200501.DhcpOptionsResponse; /** * Indicates if DDoS protection is enabled for all the protected resources in the virtual network. It requires a DDoS protection plan associated with the resource. */ readonly enableDdosProtection?: boolean; /** * Indicates if VM protection is enabled for all the subnets in the virtual network. */ readonly enableVmProtection?: boolean; /** * A unique read-only string that changes whenever the resource is updated. */ readonly etag: string; /** * Resource ID. */ readonly id?: string; /** * Array of IpAllocation which reference this VNET. */ readonly ipAllocations?: outputs.network.v20200501.SubResourceResponse[]; /** * Resource location. */ readonly location?: string; /** * Resource name. */ readonly name: string; /** * The provisioning state of the virtual network resource. */ readonly provisioningState: string; /** * The resourceGuid property of the Virtual Network resource. */ readonly resourceGuid: string; /** * A list of subnets in a Virtual Network. */ readonly subnets?: outputs.network.v20200501.SubnetResponse[]; /** * Resource tags. */ readonly tags?: {[key: string]: string}; /** * Resource type. */ readonly type: string; /** * A list of peerings in a Virtual Network. */ readonly virtualNetworkPeerings?: outputs.network.v20200501.VirtualNetworkPeeringResponse[]; }
pulumi/pulumi-azure-nextgen
sdk/nodejs/network/v20200501/getVirtualNetwork.ts
TypeScript
ClassDeclaration
/** * PersistencePromise<> is essentially a re-implementation of Promise<> except * it has a .next() method instead of .then() and .next() and .catch() callbacks * are executed synchronously when a PersistencePromise resolves rather than * asynchronously (Promise<> implementations use setImmediate() or similar). * * This is necessary to interoperate with IndexedDB which will automatically * commit transactions if control is returned to the event loop without * synchronously initiating another operation on the transaction. * * NOTE: .then() and .catch() only allow a single consumer, unlike normal * Promises. */ export declare class PersistencePromise<T> { private nextCallback; private catchCallback; private result; private error; private isDone; private callbackAttached; constructor(callback: (resolve: Resolver<T>, reject: Rejector) => void); catch<R>(fn: (error: Error) => R | PersistencePromise<R>): PersistencePromise<R>; next<R>(nextFn?: FulfilledHandler<T, R>, catchFn?: RejectedHandler<R>): PersistencePromise<R>; toPromise(): Promise<T>; private wrapUserFunction; private wrapSuccess; private wrapFailure; static resolve(): PersistencePromise<void>; static resolve<R>(result: R): PersistencePromise<R>; static reject<R>(error: Error): PersistencePromise<R>; static waitFor(all: { forEach: (cb: (el: PersistencePromise<any>) => void) => void; }): PersistencePromise<void>; /** * Given an array of predicate functions that asynchronously evaluate to a * boolean, implements a short-circuiting `or` between the results. Predicates * will be evaluated until one of them returns `true`, then stop. The final * result will be whether any of them returned `true`. */ static or(predicates: Array<() => PersistencePromise<boolean>>): PersistencePromise<boolean>; /** * Given an iterable, call the given function on each element in the * collection and wait for all of the resulting concurrent PersistencePromises * to resolve. */ static forEach<R, S>(collection: { forEach: (cb: (r: R, s: S) => void) => void; }, f: ((r: R, s: S) => PersistencePromise<void>) | ((r: R) => PersistencePromise<void>)): PersistencePromise<void>; static forEach<R>(collection: { forEach: (cb: (r: R) => void) => void; }, f: (r: R) => PersistencePromise<void>): PersistencePromise<void>; }
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
TypeAliasDeclaration
/** * @license * Copyright 2017 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export declare type FulfilledHandler<T, R> = ((result: T) => R | PersistencePromise<R>) | null;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
TypeAliasDeclaration
export declare type RejectedHandler<R> = ((reason: Error) => R | PersistencePromise<R>) | null;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
TypeAliasDeclaration
export declare type Resolver<T> = (value?: T) => void;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
TypeAliasDeclaration
export declare type Rejector = (error: Error) => void;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
catch<R>(fn: (error: Error) => R | PersistencePromise<R>): PersistencePromise<R>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
next<R>(nextFn?: FulfilledHandler<T, R>, catchFn?: RejectedHandler<R>): PersistencePromise<R>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
toPromise(): Promise<T>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
static resolve(): PersistencePromise<void>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
static resolve<R>(result: R): PersistencePromise<R>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
static reject<R>(error: Error): PersistencePromise<R>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
static waitFor(all: { forEach: (cb: (el: PersistencePromise<any>) => void) => void; }): PersistencePromise<void>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
/** * Given an array of predicate functions that asynchronously evaluate to a * boolean, implements a short-circuiting `or` between the results. Predicates * will be evaluated until one of them returns `true`, then stop. The final * result will be whether any of them returned `true`. */ static or(predicates: Array<() => PersistencePromise<boolean>>): PersistencePromise<boolean>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
/** * Given an iterable, call the given function on each element in the * collection and wait for all of the resulting concurrent PersistencePromises * to resolve. */ static forEach<R, S>(collection: { forEach: (cb: (r: R, s: S) => void) => void; }, f: ((r: R, s: S) => PersistencePromise<void>) | ((r: R) => PersistencePromise<void>)): PersistencePromise<void>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
MethodDeclaration
static forEach<R>(collection: { forEach: (cb: (r: R) => void) => void; }, f: (r: R) => PersistencePromise<void>): PersistencePromise<void>;
Akshayy99/Battleship-dAPP
node_modules/@firebase/firestore/dist/src/local/persistence_promise.d.ts
TypeScript
ClassDeclaration
export class UsersEntity { id: number; name: string; email: string; password: string; }
plankton07/study-nest2
src/users/entity/users.entity.ts
TypeScript
ArrowFunction
() => expect(stack)
alex-berger/aws-cdk
packages/@aws-cdk/aws-certificatemanager/test/test.dns-validated-certificate.ts
TypeScript
MethodDeclaration
'creates CloudFormation Custom Resource'(test: Test) { const stack = new Stack(); const exampleDotComZone = new PublicHostedZone(stack, 'ExampleDotCom', { zoneName: 'example.com' }); new DnsValidatedCertificate(stack, 'Certificate', { domainName: 'test.example.com', hostedZone: exampleDotComZone, }); expect(stack).to(haveResource('AWS::CloudFormation::CustomResource', { DomainName: 'test.example.com', ServiceToken: { 'Fn::GetAtt': [ 'CertificateCertificateRequestorFunction5E845413', 'Arn' ] }, HostedZoneId: { Ref: 'ExampleDotCom4D1B83AA', } })); expect(stack).to(haveResource('AWS::Lambda::Function', { Handler: 'index.certificateRequestHandler', Runtime: 'nodejs8.10', Timeout: 900, })); expect(stack).to(haveResource('AWS::IAM::Policy', { PolicyName: 'CertificateCertificateRequestorFunctionServiceRoleDefaultPolicy3C8845BC', Roles: [ { Ref: 'CertificateCertificateRequestorFunctionServiceRoleC04C13DA', } ], PolicyDocument: { Version: '2012-10-17', Statement: [ { Action: [ 'acm:RequestCertificate', 'acm:DescribeCertificate', 'acm:DeleteCertificate' ], Effect: 'Allow', Resource: '*' }, { Action: 'route53:GetChange', Effect: 'Allow', Resource: '*' }, { Action: 'route53:changeResourceRecordSets', Effect: 'Allow', Resource: { 'Fn::Join': [ '', [ 'arn:aws:route53:::hostedzone/', { Ref: 'ExampleDotCom4D1B83AA' } ] ] } }, ], } })); test.done(); }
alex-berger/aws-cdk
packages/@aws-cdk/aws-certificatemanager/test/test.dns-validated-certificate.ts
TypeScript
MethodDeclaration
'export and import'(test: Test) { const stack = new Stack(); const helloDotComZone = new PublicHostedZone(stack, 'HelloDotCom', { zoneName: 'hello.com' }); const refProps = new DnsValidatedCertificate(stack, 'Cert', { domainName: 'hello.com', hostedZone: helloDotComZone, }).export(); test.ok('certificateArn' in refProps); test.done(); }
alex-berger/aws-cdk
packages/@aws-cdk/aws-certificatemanager/test/test.dns-validated-certificate.ts
TypeScript
MethodDeclaration
'adds validation error on domain mismatch'(test: Test) { const stack = new Stack(); const helloDotComZone = new PublicHostedZone(stack, 'HelloDotCom', { zoneName: 'hello.com' }); new DnsValidatedCertificate(stack, 'Cert', { domainName: 'example.com', hostedZone: helloDotComZone, }); // a bit of a hack: expect(stack) will trigger validation. test.throws(() => expect(stack), /DNS zone hello.com is not authoritative for certificate domain name example.com/); test.done(); }
alex-berger/aws-cdk
packages/@aws-cdk/aws-certificatemanager/test/test.dns-validated-certificate.ts
TypeScript
ArrowFunction
async ( app: JupyterFrontEnd, palette: ICommandPalette, editorServices: IEditorServices, status: ILabStatus, themeManager: IThemeManager | null ) => { console.log('Elyra - metadata extension is activated!'); const openMetadataEditor = (args: { schema: string; namespace: string; name?: string; onSave: () => void; }): void => { let widgetLabel: string; if (args.name) { widgetLabel = args.name; } else { widgetLabel = `New ${args.schema}`; } const widgetId = `${METADATA_EDITOR_ID}:${args.namespace}:${ args.schema }:${args.name ? args.name : 'new'}`; const openWidget = find( app.shell.widgets('main'), (widget: Widget, index: number) => { return widget.id == widgetId; } ); if (openWidget) { app.shell.activateById(widgetId); return; } const metadataEditorWidget = new MetadataEditor({ ...args, editorServices, status }); metadataEditorWidget.title.label = widgetLabel; metadataEditorWidget.id = widgetId; metadataEditorWidget.title.closable = true; metadataEditorWidget.title.icon = textEditorIcon; metadataEditorWidget.addClass(METADATA_EDITOR_ID); app.shell.add(metadataEditorWidget, 'main'); updateTheme(); }; app.commands.addCommand(`${METADATA_EDITOR_ID}:open`, { execute: (args: any) => { openMetadataEditor(args); } }); const updateTheme = (): void => { const isLight = themeManager.theme && themeManager.isLight(themeManager.theme); document .querySelectorAll(`.${METADATA_EDITOR_ID}`) .forEach((element: any) => { if (isLight) { element.className = element.className .replace(new RegExp(`${BP_DARK_THEME_CLASS}`, 'gi'), '') .trim(); } else { element.className += ` ${BP_DARK_THEME_CLASS}`; } }); }; if (themeManager) { themeManager.themeChanged.connect(updateTheme); } const openMetadataWidget = (args: { display_name: string; namespace: string; schema: string; icon: string; }): void => { const labIcon = LabIcon.resolve({ icon: args.icon }); const widgetId = `${METADATA_WIDGET_ID}:${args.namespace}:${args.schema}`; const metadataWidget = new MetadataWidget({ app, display_name: args.display_name, namespace: args.namespace, schema: args.schema, icon: labIcon }); metadataWidget.id = widgetId; metadataWidget.title.icon = labIcon; metadataWidget.title.caption = args.display_name; if ( find(app.shell.widgets('left'), value => value.id === widgetId) == undefined ) { app.shell.add(metadataWidget, 'left', { rank: 1000 }); } app.shell.activateById(widgetId); }; const openMetadataCommand: string = commandIDs.openMetadata; app.commands.addCommand(openMetadataCommand, { label: (args: any) => args['label'], execute: (args: any) => { // Rank has been chosen somewhat arbitrarily to give priority // to the running sessions widget in the sidebar. openMetadataWidget(args); } }); // Add command to close metadata tab const closeTabCommand: string = commandIDs.closeTabCommand; app.commands.addCommand(closeTabCommand, { label: 'Close Tab', execute: args => { const contextNode: HTMLElement | undefined = app.contextMenuHitTest( node => !!node.dataset.id ); if (contextNode) { const id = contextNode.dataset['id']!; const widget = find( app.shell.widgets('left'), (widget: Widget, index: number) => { return widget.id === id; } ); if (widget) { widget.dispose(); } } } }); app.contextMenu.addItem({ selector: '[data-id^="elyra-metadata:"]:not([data-id$="code-snippet"]):not([data-id$="runtimes:kfp"])', command: closeTabCommand }); try { const schemas = await MetadataService.getAllSchema(); for (const schema of schemas) { let icon = 'ui-components:text-editor'; let title = schema.title; if (schema.uihints) { if (schema.uihints.icon) { icon = schema.uihints.icon; } if (schema.uihints.title) { title = schema.uihints.title; } } palette.addItem({ command: commandIDs.openMetadata, args: { label: `Manage ${title}`, display_name: schema.title, namespace: schema.namespace, schema: schema.name, icon: icon }, category: 'Elyra' }); } } catch (error) { RequestErrors.serverError(error); } }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(args: { schema: string; namespace: string; name?: string; onSave: () => void; }): void => { let widgetLabel: string; if (args.name) { widgetLabel = args.name; } else { widgetLabel = `New ${args.schema}`; } const widgetId = `${METADATA_EDITOR_ID}:${args.namespace}:${ args.schema }:${args.name ? args.name : 'new'}`; const openWidget = find( app.shell.widgets('main'), (widget: Widget, index: number) => { return widget.id == widgetId; } ); if (openWidget) { app.shell.activateById(widgetId); return; } const metadataEditorWidget = new MetadataEditor({ ...args, editorServices, status }); metadataEditorWidget.title.label = widgetLabel; metadataEditorWidget.id = widgetId; metadataEditorWidget.title.closable = true; metadataEditorWidget.title.icon = textEditorIcon; metadataEditorWidget.addClass(METADATA_EDITOR_ID); app.shell.add(metadataEditorWidget, 'main'); updateTheme(); }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(widget: Widget, index: number) => { return widget.id == widgetId; }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(args: any) => { openMetadataEditor(args); }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(): void => { const isLight = themeManager.theme && themeManager.isLight(themeManager.theme); document .querySelectorAll(`.${METADATA_EDITOR_ID}`) .forEach((element: any) => { if (isLight) { element.className = element.className .replace(new RegExp(`${BP_DARK_THEME_CLASS}`, 'gi'), '') .trim(); } else { element.className += ` ${BP_DARK_THEME_CLASS}`; } }); }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(element: any) => { if (isLight) { element.className = element.className .replace(new RegExp(`${BP_DARK_THEME_CLASS}`, 'gi'), '') .trim(); } else { element.className += ` ${BP_DARK_THEME_CLASS}`; } }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(args: { display_name: string; namespace: string; schema: string; icon: string; }): void => { const labIcon = LabIcon.resolve({ icon: args.icon }); const widgetId = `${METADATA_WIDGET_ID}:${args.namespace}:${args.schema}`; const metadataWidget = new MetadataWidget({ app, display_name: args.display_name, namespace: args.namespace, schema: args.schema, icon: labIcon }); metadataWidget.id = widgetId; metadataWidget.title.icon = labIcon; metadataWidget.title.caption = args.display_name; if ( find(app.shell.widgets('left'), value => value.id === widgetId) == undefined ) { app.shell.add(metadataWidget, 'left', { rank: 1000 }); } app.shell.activateById(widgetId); }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
value => value.id === widgetId
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(args: any) => args['label']
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(args: any) => { // Rank has been chosen somewhat arbitrarily to give priority // to the running sessions widget in the sidebar. openMetadataWidget(args); }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
args => { const contextNode: HTMLElement | undefined = app.contextMenuHitTest( node => !!node.dataset.id ); if (contextNode) { const id = contextNode.dataset['id']!; const widget = find( app.shell.widgets('left'), (widget: Widget, index: number) => { return widget.id === id; } ); if (widget) { widget.dispose(); } } }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
node => !!node.dataset.id
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ArrowFunction
(widget: Widget, index: number) => { return widget.id === id; }
chinhuang007/elyra
packages/metadata/src/index.ts
TypeScript
ClassDeclaration
@Module({ imports: [ TransactionsModule, TypeOrmModule.forRoot({ type: 'mysql', host: 'localhost', port: 3306, username: 'learn', password: 'plokij121', database: 'learn', entities: [__dirname + '/**/*.entity{.ts,.js}'], synchronize: true, }), ], controllers: [AppController], providers: [AppService], }) export class AppModule { }
nagyll92/mfa_back
src/app.module.ts
TypeScript
ClassDeclaration
@NgModule({ imports: [ CommonModule ], exports: [ BasicContent ], declarations: [ BasicContent ], providers: [ ContentStore ] }) export class BasicContentModule { }
awadyn/ng2-webpack
src/app/dashboard/tiles/basic-content/basic-content.module.ts
TypeScript
FunctionDeclaration
/** * This sample demonstrates how to Creates or updates the storage account credential * * @summary Creates or updates the storage account credential * x-ms-original-file: specification/storSimple1200Series/resource-manager/Microsoft.StorSimple/stable/2016-10-01/examples/StorageAccountCredentialsCreateOrUpdate.json */ async function storageAccountCredentialsCreateOrUpdate() { const subscriptionId = "9eb689cd-7243-43b4-b6f6-5c65cb296641"; const credentialName = "DummySacForSDKTest"; const resourceGroupName = "ResourceGroupForSDKTest"; const managerName = "hAzureSDKOperations"; const storageAccount: StorageAccountCredential = { name: "DummySacForSDKTest", accessKey: { encryptionAlgorithm: "RSAES_PKCS1_v_1_5", encryptionCertificateThumbprint: "D73DB57C4CDD6761E159F8D1E8A7D759424983FD", value: "Ev1tm0QBmpGGm4a58GkqLqx8veJEEgQtg5K3Jizpmy7JdSv9dlcRwk59THw6KIdMDlEHcS8mPyneBtOEQsh4wkcFB7qrmQz+KsRAyIhEm6bwPEm3qN8+aDDzNcXn/6vu/sqV0AP7zit9/s7SxXGxjKrz4zKnOy16/DbzRRmUHNO+HO6JUM0cUfHXTX0mEecbsXqBq0A8IEG8z+bJgXX1EhoGkzE6yVsObm4S1AcKrLiwWjqmSLji5Q8gGO+y4KTTmC3p45h5GHHXjJyOccHhySWDAffxnTzUD/sOoh+aD2VkAYrL3DdnkVzhAdfcZfVI4soONx7tYMloZIVsfW1M2Q==" }, cloudType: "Azure", enableSSL: "Enabled", endPoint: "blob.core.windows.net", location: "West US", login: "SacForSDKTest" }; const credential = new DefaultAzureCredential(); const client = new StorSimpleManagementClient(credential, subscriptionId); const result = await client.storageAccountCredentials.beginCreateOrUpdateAndWait( credentialName, resourceGroupName, managerName, storageAccount ); console.log(result); }
AikoBB/azure-sdk-for-js
sdk/storsimple1200series/arm-storsimple1200series/samples-dev/storageAccountCredentialsCreateOrUpdateSample.ts
TypeScript
InterfaceDeclaration
/** * @ignore */ export default interface Functor<A, B, M> { map: (f: (a: A) => B) => M; }
astuanax/fun-monad
dist/types/Functor.d.ts
TypeScript
FunctionDeclaration
export function modifyH5WebpackChain (ctx: IPluginContext, chain) { setStyleLoader(ctx, chain) setVueLoader(chain) setLoader(chain) setTaroApiLoader(chain) }
Banlangenn/taro
packages/taro-plugin-vue3/src/webpack.h5.ts
TypeScript
FunctionDeclaration
function setStyleLoader (ctx: IPluginContext, chain) { const config = ctx.initialConfig.h5 || {} const { styleLoaderOption = {} } = config chain.module .rule('customStyle') .merge({ use: [{ loader: 'style-loader', options: styleLoaderOption }] }) }
Banlangenn/taro
packages/taro-plugin-vue3/src/webpack.h5.ts
TypeScript
FunctionDeclaration
function setVueLoader (chain) { const vueLoaderPath = getVueLoaderPath() // plugin const { VueLoaderPlugin } = require(vueLoaderPath) chain .plugin('vueLoaderPlugin') .use(VueLoaderPlugin) // loader const vueLoaderOption = { transformAssetUrls: { video: ['src', 'poster'], 'live-player': 'src', audio: 'src', source: 'src', image: 'src', 'cover-image': 'src', 'taro-video': ['src', 'poster'], 'taro-live-player': 'src', 'taro-audio': 'src', 'taro-source': 'src', 'taro-image': 'src', 'taro-cover-image': 'src' }, compilerOptions: { // https://github.com/vuejs/vue-next/blob/master/packages/compiler-core/src/options.ts nodeTransforms: [(node: RootNode | TemplateChildNode) => { if (node.type === 1 /* ELEMENT */) { node = node as ElementNode const nodeName = node.tag if (DEFAULT_Components.has(nodeName)) { node.tag = `taro-${nodeName}` node.tagType = 1 /* 0: ELEMENT, 1: COMPONENT */ } } }] } } chain.module .rule('vue') .test(REG_VUE) .use('vueLoader') .loader(vueLoaderPath) .options(vueLoaderOption) }
Banlangenn/taro
packages/taro-plugin-vue3/src/webpack.h5.ts
TypeScript
FunctionDeclaration
function setLoader (chain) { chain.plugin('mainPlugin') .tap(args => { args[0].loaderMeta = getLoaderMeta() return args }) }
Banlangenn/taro
packages/taro-plugin-vue3/src/webpack.h5.ts
TypeScript
FunctionDeclaration
function setTaroApiLoader (chain) { chain.merge({ module: { rule: { 'process-import-taro': { test: /taro-h5[\\/]dist[\\/]index/, loader: require.resolve('./api-loader') } } } }) }
Banlangenn/taro
packages/taro-plugin-vue3/src/webpack.h5.ts
TypeScript
ArrowFunction
(node: RootNode | TemplateChildNode) => { if (node.type === 1 /* ELEMENT */) { node = node as ElementNode const nodeName = node.tag if (DEFAULT_Components.has(nodeName)) { node.tag = `taro-${nodeName}` node.tagType = 1 /* 0: ELEMENT, 1: COMPONENT */ } } }
Banlangenn/taro
packages/taro-plugin-vue3/src/webpack.h5.ts
TypeScript
ArrowFunction
args => { args[0].loaderMeta = getLoaderMeta() return args }
Banlangenn/taro
packages/taro-plugin-vue3/src/webpack.h5.ts
TypeScript
FunctionDeclaration
export function addSmartEditFeatures(options: SpartacusSmartEditOptions): Rule { return (tree: Tree, _context: SchematicContext) => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); return chain([addSmartEditFeature(options)]); }; }
boli-sap/spartacus
feature-libs/smartedit/schematics/add-smartedit/index.ts
TypeScript
FunctionDeclaration
function addSmartEditFeature(options: SpartacusSmartEditOptions): Rule { return addLibraryFeature(options, { folderName: SMARTEDIT_FOLDER_NAME, name: SMARTEDIT_FEATURE_NAME, featureModule: { name: SMARTEDIT_MODULE, importPath: SPARTACUS_SMARTEDIT, }, rootModule: { name: SMARTEDIT_ROOT_MODULE, importPath: SPARTACUS_SMARTEDIT_ROOT, }, assets: { input: SPARTACUS_SMARTEDIT_ASSETS, glob: '**/*', }, }); }
boli-sap/spartacus
feature-libs/smartedit/schematics/add-smartedit/index.ts
TypeScript
ArrowFunction
(tree: Tree, _context: SchematicContext) => { const packageJson = readPackageJson(tree); validateSpartacusInstallation(packageJson); return chain([addSmartEditFeature(options)]); }
boli-sap/spartacus
feature-libs/smartedit/schematics/add-smartedit/index.ts
TypeScript
ArrowFunction
(): PackageInfo => { const pkgPath = dirname(fileURLToPath(import.meta.url)) try { const pkg = readFileSync(resolve(pkgPath, "../package.json"), "utf8") const { description, version } = JSON.parse(pkg) as { description: string version: string } return { description, version } } catch (e) { return { description: "", version: "" } } }
citycide/tablemark-cli
src/cli.ts
TypeScript
ArrowFunction
part => { if (part === "") { return "left" } if (!Object.keys(alignmentOptions).includes(part.toLowerCase())) { throw new Error(`Expected an Alignment, got "${part}"`) } return part as Alignment }
citycide/tablemark-cli
src/cli.ts
TypeScript
ArrowFunction
() => "\n"
citycide/tablemark-cli
src/cli.ts
TypeScript
ArrowFunction
() => Infinity
citycide/tablemark-cli
src/cli.ts
TypeScript
ArrowFunction
args => { const options: TablemarkOptions = Object.assign({}, args, { caseHeaders: !args.noCaseHeaders, columns: [] }) for (const [name, align] of zip(args.column, args.align)) { options.columns!.push({ name, align }) } // write results to stdout process.stdout.write(convert(args.inputFile, options) + "\n") }
citycide/tablemark-cli
src/cli.ts
TypeScript
InterfaceDeclaration
interface PackageInfo { description: string version: string }
citycide/tablemark-cli
src/cli.ts
TypeScript
MethodDeclaration
async from(input) { return input.map(part => { if (part === "") { return "left" } if (!Object.keys(alignmentOptions).includes(part.toLowerCase())) { throw new Error(`Expected an Alignment, got "${part}"`) } return part as Alignment }) }
citycide/tablemark-cli
src/cli.ts
TypeScript
MethodDeclaration
async from(input) { const content = input === "-" ? await getStdin() : read(input) if (content === "" && process.stdin.isTTY) { return [] } return parse(content) }
citycide/tablemark-cli
src/cli.ts
TypeScript
FunctionDeclaration
export default function installAsJQueryPlugin($: any): void { if (!$) throw new Error( 'Filterizr as a jQuery plugin, requires jQuery to work. If you would prefer to use the vanilla JS version, please use the correct bundle file.' ); // Add filterizr method on jQuery prototype $.fn.filterizr = function(): any { const selector = `.${$.trim(this.get(0).className).replace(/\s+/g, '.')}`; const args = arguments; // user is instantiating Filterizr if ( (!this._fltr && args.length === 0) || (args.length === 1 && typeof args[0] === 'object') ) { const options = args.length > 0 ? args[0] : defaultOptions; this._fltr = new Filterizr(selector, options); } // otherwise call the method called else if (args.length >= 1 && typeof args[0] === 'string') { const method = args[0]; const methodArgs = Array.prototype.slice.call(args, 1); const filterizr = this._fltr; switch (method) { case 'filter': filterizr.filter(...methodArgs); return this; case 'insertItem': filterizr.insertItem(...methodArgs); return this; case 'removeItem': filterizr.removeItem(...methodArgs); return this; case 'toggleFilter': filterizr.toggleFilter(...methodArgs); return this; case 'sort': filterizr.sort(...methodArgs); return this; case 'shuffle': filterizr.shuffle(...methodArgs); return this; case 'search': filterizr.search(...methodArgs); return this; case 'setOptions': filterizr.setOptions(...methodArgs); return this; case 'destroy': filterizr.destroy(...methodArgs); // Kill internal reference to Filterizr instance delete this._fltr; return this; default: throw new Error( `Filterizr: ${method} is not part of the Filterizr API. Please refer to the docs for more information.` ); } } return this; }; }
125126dxr/LAB
node_modules/filterizr/src/Filterizr/installAsJQueryPlugin.ts
TypeScript
ArrowFunction
(image: HTMLImageElement): HTMLCanvasElement => { const { canvas, context } = createCanvas(image.naturalWidth, image.naturalHeight) if (context) { context.drawImage(image, 0, 0, image.naturalWidth, image.naturalHeight) } return canvas }
jeetiss/image-fns
src/from-image.ts
TypeScript
ArrowFunction
(params: Params) => this.heroService.getHero(+params['id'])
teving/angular-tour-of-heroes
app/hero-detail.component.ts
TypeScript
ArrowFunction
hero => this.hero = hero
teving/angular-tour-of-heroes
app/hero-detail.component.ts
TypeScript
ClassDeclaration
@Component({ moduleId: module.id, selector: 'my-hero-detail', templateUrl: 'hero-detail.component.html', styleUrls: ['hero-detail.component.css'] }) export class HeroDetailComponent implements OnInit { @Input() hero: Hero; constructor( private heroService: HeroService, private route: ActivatedRoute, private location: Location ) {} ngOnInit(): void { this.route.params .switchMap((params: Params) => this.heroService.getHero(+params['id'])) .subscribe(hero => this.hero = hero); } goBack(): void { this.location.back(); } save(): void{ this.heroService.update(this.hero) .then(() => this.goBack()); } }
teving/angular-tour-of-heroes
app/hero-detail.component.ts
TypeScript
MethodDeclaration
ngOnInit(): void { this.route.params .switchMap((params: Params) => this.heroService.getHero(+params['id'])) .subscribe(hero => this.hero = hero); }
teving/angular-tour-of-heroes
app/hero-detail.component.ts
TypeScript
MethodDeclaration
goBack(): void { this.location.back(); }
teving/angular-tour-of-heroes
app/hero-detail.component.ts
TypeScript
MethodDeclaration
save(): void{ this.heroService.update(this.hero) .then(() => this.goBack()); }
teving/angular-tour-of-heroes
app/hero-detail.component.ts
TypeScript
ArrowFunction
({ children, }: { children?: string; }): JSX.Element => { const [open, setOpen] = useState(true); return ( <Dialog open={open} fullWidth> <AppBar position="relative"> <Toolbar> <Stack width="100%" justifyContent="center" alignItems="center"> <Typography>エラー</Typography> </Stack> </Toolbar> </AppBar> <DialogContent> <DialogContentText> 何らかの不具合で分析できませんでした。ごめんね! </DialogContentText> {children && <DialogContentText>{children}</DialogContentText>} </DialogContent> <DialogActions sx={{ justifyContent: "center" }}> <Box> <Button variant="contained" size="large" onClick={()
okomeworld/dadamore
src/features/Analyzer/components/ErrorDialog.tsx
TypeScript
ArrowFunction
email => email.uid === uid
tharkana/node-email-api
src/model/emailModel.ts
TypeScript
ArrowFunction
(email) => email.status == status
tharkana/node-email-api
src/model/emailModel.ts
TypeScript
ClassDeclaration
export default class EmailModel { emailList: Array<Email>; constructor() { this.emailList = [{ uid: '123', to: '[email protected]', body: "test", subject: "yellow", status: 'SENT' }, { uid: '213', to: '[email protected]', body: "test", subject: "yellow", status: 'QUEUED' } ]; } create(email: Email) { const newEmail: Email = { uid: uuid.v4(), to: email.to, body: email.body, subject: email.subject, status: email.status, createdDate: moment.now(), modifiedDate: moment.now() }; this.emailList.push(newEmail); return newEmail } findOne(uid: string) { return this.emailList.find(email => email.uid === uid); } findAll() { return this.emailList; } findByStatus(status: string) { return this.emailList.filter((email) => email.status == status); } update(data: Email) { if (data && data.uid) { const email = this.findOne(data.uid); if (email) { const index = this.emailList.indexOf(email); this.emailList[index].body = data.body || email.body; this.emailList[index].to = data.to || email.to; this.emailList[index].subject = data.subject || email.subject; this.emailList[index].status = data.status || email.status; this.emailList[index].modifiedDate = moment.now() return this.emailList[index]; } else { throw new Error("record not found"); } } else { throw new Error('Should Provide uid in Email object'); } } delete(id: string) { const email = this.findOne(id); if (email) { const index = this.emailList.indexOf(email); this.emailList.splice(index, 1); return email; } else { return undefined; } } }
tharkana/node-email-api
src/model/emailModel.ts
TypeScript
InterfaceDeclaration
export interface Email { uid?: string; to: string; body: string; subject: string; status: string; createdDate?: number; modifiedDate?: number; }
tharkana/node-email-api
src/model/emailModel.ts
TypeScript
MethodDeclaration
create(email: Email) { const newEmail: Email = { uid: uuid.v4(), to: email.to, body: email.body, subject: email.subject, status: email.status, createdDate: moment.now(), modifiedDate: moment.now() }; this.emailList.push(newEmail); return newEmail }
tharkana/node-email-api
src/model/emailModel.ts
TypeScript
MethodDeclaration
findOne(uid: string) { return this.emailList.find(email => email.uid === uid); }
tharkana/node-email-api
src/model/emailModel.ts
TypeScript
MethodDeclaration
findAll() { return this.emailList; }
tharkana/node-email-api
src/model/emailModel.ts
TypeScript