type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
FunctionDeclaration
export function run() { print("test exn") glb1 = x = 0 nested() assert(glb1 == 11) /* assert(test4(() => { }) == 10) assert(test4(() => { throw "foo" }) == 20) */ print("test exn done") }
ASDAlexander77/TypeScriptCompiler
docs/bugs/bug5.ts
TypeScript
FunctionDeclaration
function main() { exceptions.run(); }
ASDAlexander77/TypeScriptCompiler
docs/bugs/bug5.ts
TypeScript
ArrowFunction
() => { it('🥩 base use', () => { const wrapper = mount({ render() { return ( <BasicLayout title={title} logo={logoSrc} layout="side" navTheme="light" contentWidth="Fluid" contentStyle={{ minHeight: '300px' }} rightContentRender={() => ( <div class="custom-header-right-content"> <span>custom-right-content</span> </div> )}
Houtaroy/pro-layout
tests/index.test.tsx
TypeScript
ArrowFunction
() => { const wrapper = mount({ render() { return ( <BasicLayout title={title} logo={logoSrc} layout="side" navTheme="light" contentWidth="Fluid" contentStyle={{ minHeight: '300px' }} rightContentRender={() => ( <div class="custom-header-right-content"> <span>custom-right-content</span> </div>
Houtaroy/pro-layout
tests/index.test.tsx
TypeScript
ArrowFunction
() => { const wrapper = mount({ render() { return ( <BasicLayout title={title} logo={logoSrc}> <div>content</div> </BasicLayout> ); }
Houtaroy/pro-layout
tests/index.test.tsx
TypeScript
ArrowFunction
async () => { const wrapper = mount({ props: { theme: { type: String, default: 'light', }, layout: { type: String, default: 'mix', }, }, render() { return ( <BasicLayout navTheme={this.theme} layout={this.layout}> <div>content</div> </BasicLayout> ); }
Houtaroy/pro-layout
tests/index.test.tsx
TypeScript
MethodDeclaration
render() { return ( <BasicLayout title={title} logo={logoSrc} layout="side" navTheme="light" contentWidth="Fluid" contentStyle={{ minHeight: '300px' }}
Houtaroy/pro-layout
tests/index.test.tsx
TypeScript
MethodDeclaration
render() { return ( <BasicLayout title={title} logo={logoSrc}> <div>content</div> </BasicLayout>
Houtaroy/pro-layout
tests/index.test.tsx
TypeScript
MethodDeclaration
render() { return ( <BasicLayout navTheme={this.theme} layout={this.layout}> <div>content</div> </BasicLayout>
Houtaroy/pro-layout
tests/index.test.tsx
TypeScript
FunctionDeclaration
function delay(duration: number): Promise<any> { return new Promise(function(resolve, reject) { setTimeout(function() { resolve(); }, duration); }); }
emjimadhu/alosaur-boilerplate
src/areas/info/info.controller.ts
TypeScript
ClassDeclaration
@Controller('/info') export class InfoController { @Get('/text') text() { return Content(`Hello info1`); } @Get('/time') async time() { await delay(500); return Content(`Hello info2`); } }
emjimadhu/alosaur-boilerplate
src/areas/info/info.controller.ts
TypeScript
MethodDeclaration
@Get('/text') text() { return Content(`Hello info1`); }
emjimadhu/alosaur-boilerplate
src/areas/info/info.controller.ts
TypeScript
MethodDeclaration
@Get('/time') async time() { await delay(500); return Content(`Hello info2`); }
emjimadhu/alosaur-boilerplate
src/areas/info/info.controller.ts
TypeScript
InterfaceDeclaration
/** * This interface defines a complete generic visitor for a parse tree produced * by `CommandParser`. * * @param <Result> The return type of the visit operation. Use `void` for * operations with no return type. */ export interface CommandVisitor<Result> extends ParseTreeVisitor<Result> { /** * Visit a parse tree produced by the `OutputTo` * labeled alternative in `CommandParser.output`. * @param ctx the parse tree * @return the visitor result */ visitOutputTo?: (ctx: OutputToContext) => Result; /** * Visit a parse tree produced by the `OutputSave` * labeled alternative in `CommandParser.output`. * @param ctx the parse tree * @return the visitor result */ visitOutputSave?: (ctx: OutputSaveContext) => Result; /** * Visit a parse tree produced by the `OutputPrint` * labeled alternative in `CommandParser.output`. * @param ctx the parse tree * @return the visitor result */ visitOutputPrint?: (ctx: OutputPrintContext) => Result; /** * Visit a parse tree produced by the `OutputPrintTitle` * labeled alternative in `CommandParser.output`. * @param ctx the parse tree * @return the visitor result */ visitOutputPrintTitle?: (ctx: OutputPrintTitleContext) => Result; /** * Visit a parse tree produced by the `ServerLocale` * labeled alternative in `CommandParser.server`. * @param ctx the parse tree * @return the visitor result */ visitServerLocale?: (ctx: ServerLocaleContext) => Result; /** * Visit a parse tree produced by the `ServerTimezone` * labeled alternative in `CommandParser.server`. * @param ctx the parse tree * @return the visitor result */ visitServerTimezone?: (ctx: ServerTimezoneContext) => Result; /** * Visit a parse tree produced by the `ServerFormat` * labeled alternative in `CommandParser.server`. * @param ctx the parse tree * @return the visitor result */ visitServerFormat?: (ctx: ServerFormatContext) => Result; /** * Visit a parse tree produced by the `ServerDeleteMoment` * labeled alternative in `CommandParser.server`. * @param ctx the parse tree * @return the visitor result */ visitServerDeleteMoment?: (ctx: ServerDeleteMomentContext) => Result; /** * Visit a parse tree produced by the `MessagePrint` * labeled alternative in `CommandParser.message`. * @param ctx the parse tree * @return the visitor result */ visitMessagePrint?: (ctx: MessagePrintContext) => Result; /** * Visit a parse tree produced by the `MessageTitle` * labeled alternative in `CommandParser.message`. * @param ctx the parse tree * @return the visitor result */ visitMessageTitle?: (ctx: MessageTitleContext) => Result; /** * Visit a parse tree produced by the `CommandServer` * labeled alternative in `CommandParser.command`. * @param ctx the parse tree * @return the visitor result */ visitCommandServer?: (ctx: CommandServerContext) => Result; /** * Visit a parse tree produced by the `CommandMoment` * labeled alternative in `CommandParser.command`. * @param ctx the parse tree * @return the visitor result */ visitCommandMoment?: (ctx: CommandMomentContext) => Result; /** * Visit a parse tree produced by the `CommandMessage` * labeled alternative in `CommandParser.command`. * @param ctx the parse tree * @return the visitor result */ visitCommandMessage?: (ctx: CommandMessageContext) => Result; /** * Visit a parse tree produced by the `CommandHelp` * labeled alternative in `CommandParser.command`. * @param ctx the parse tree * @return the visitor result */ visitCommandHelp?: (ctx: CommandHelpContext) => Result; /** * Visit a parse tree produced by the `MomentNow` * labeled alternative in `CommandParser.moment`. * @param ctx the parse tree * @return the visitor result */ visitMomentNow?: (ctx: MomentNowContext) => Result; /** * Visit a parse tree produced by the `MomentLoad` * labeled alternative in `CommandParser.moment`. * @param ctx the parse tree * @return the visitor result */ visitMomentLoad?: (ctx: MomentLoadContext) => Result; /** * Visit a parse tree produced by the `MomentInput` * labeled alternative in `CommandParser.moment`. * @param ctx the parse tree * @return the visitor result */ visitMomentInput?: (ctx: MomentInputContext) => Result; /** * Visit a parse tree produced by the `MomentInputWoQ` * labeled alternative in `CommandParser.moment`. * @param ctx the parse tree * @return the visitor result */ visitMomentInputWoQ?: (ctx: MomentInputWoQContext) => Result; /** * Visit a parse tree produced by `CommandParser.command`. * @param ctx the parse tree * @return the visitor result */ visitCommand?: (ctx: CommandContext) => Result; /** * Visit a parse tree produced by `CommandParser.help`. * @param ctx the parse tree * @return the visitor result */ visitHelp?: (ctx: HelpContext) => Result; /** * Visit a parse tree produced by `CommandParser.server`. * @param ctx the parse tree * @return the visitor result */ visitServer?: (ctx: ServerContext) => Result; /** * Visit a parse tree produced by `CommandParser.message`. * @param ctx the parse tree * @return the visitor result */ visitMessage?: (ctx: MessageContext) => Result; /** * Visit a parse tree produced by `CommandParser.moment`. * @param ctx the parse tree * @return the visitor result */ visitMoment?: (ctx: MomentContext) => Result; /** * Visit a parse tree produced by `CommandParser.output`. * @param ctx the parse tree * @return the visitor result */ visitOutput?: (ctx: OutputContext) => Result; }
PhoenixIra/count-endtime
src/parser/CommandVisitor.ts
TypeScript
ArrowFunction
async (context: number) => { const viewingKey: Buffer | undefined = spendingKey !== undefined ? await sapling.getExtendedFullViewingKeyFromSpendingKey(spendingKey) : undefined const spendDescriptions: TezosSaplingSpendDescription[] = spendingKey !== undefined ? await this.forgeSaplingInputs(context, spendingKey, inputs, merkleTree, antiReplay) : [] const outputDescriptions: TezosSaplingOutputDescription[] = await this.forgeSaplingOutputs(context, viewingKey, outputs) const balance: BigNumber = this.calculateTransactionBalance(inputs, outputs) const sighash: Buffer = this.createTransactionSighash(spendDescriptions, outputDescriptions, antiReplay) const bindingSignature: Buffer = await this.createBindingSignature(context, balance.toFixed(), sighash) return { spendDescriptions, outputDescriptions, bindingSignature, balance, root: merkleTree.root } }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
ArrowFunction
(sum: BigNumber, next: TezosSaplingInput) => sum.plus(next.value)
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
ArrowFunction
(sum: BigNumber, next: TezosSaplingOutput) => sum.plus(next.value)
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
ClassDeclaration
export class TezosSaplingForger { constructor( private readonly cryptoClient: TezosSaplingCryptoClient, private readonly state: TezosSaplingState, private readonly encoder: TezosSaplingEncoder, private readonly externalProvider?: TezosSaplingExternalMethodProvider ) {} public async forgeSaplingTransaction( inputs: TezosSaplingInput[], outputs: TezosSaplingOutput[], merkleTree: TezosSaplingStateTree, antiReplay: string, spendingKey?: Buffer ): Promise<TezosSaplingTransaction> { return this.withProvingContext(async (context: number) => { const viewingKey: Buffer | undefined = spendingKey !== undefined ? await sapling.getExtendedFullViewingKeyFromSpendingKey(spendingKey) : undefined const spendDescriptions: TezosSaplingSpendDescription[] = spendingKey !== undefined ? await this.forgeSaplingInputs(context, spendingKey, inputs, merkleTree, antiReplay) : [] const outputDescriptions: TezosSaplingOutputDescription[] = await this.forgeSaplingOutputs(context, viewingKey, outputs) const balance: BigNumber = this.calculateTransactionBalance(inputs, outputs) const sighash: Buffer = this.createTransactionSighash(spendDescriptions, outputDescriptions, antiReplay) const bindingSignature: Buffer = await this.createBindingSignature(context, balance.toFixed(), sighash) return { spendDescriptions, outputDescriptions, bindingSignature, balance, root: merkleTree.root } }) } private async forgeSaplingInputs( context: number, spendingKey: Buffer, inputs: TezosSaplingInput[], merkleTree: TezosSaplingStateTree, antiReplay: string ): Promise<TezosSaplingSpendDescription[]> { const ar: Buffer = await sapling.randR() const descriptions: TezosSaplingSpendDescription[] = [] for (const input of inputs) { const unsignedSpendDescription: SaplingUnsignedSpendDescription = await this.prepareSpendDescription( context, spendingKey, (await TezosSaplingAddress.fromValue(input.address)).raw, input.rcm, ar, input.value, merkleTree.root, await this.state.getWitness(merkleTree, new BigNumber(input.pos)) ) const sighash: Buffer = this.createInputSighash(unsignedSpendDescription, antiReplay) const signedSpendDescription: SaplingSpendDescription = await sapling.signSpendDescription( unsignedSpendDescription, spendingKey, ar, sighash ) if (signedSpendDescription.spendAuthSig === undefined) { throw new Error('Spend signing failed') } descriptions.push({ cv: signedSpendDescription.cv, nf: signedSpendDescription.nf, rk: signedSpendDescription.rk, proof: signedSpendDescription.proof, signature: signedSpendDescription.spendAuthSig }) } return descriptions } private async forgeSaplingOutputs( context: number, viewingKey: Buffer | undefined, outputs: TezosSaplingOutput[] ): Promise<TezosSaplingOutputDescription[]> { const rcm: Buffer = await sapling.randR() const descriptions: TezosSaplingOutputDescription[] = [] for (const output of outputs) { const esk: Buffer = await sapling.randR() const outputDescription: SaplingPartialOutputDescription = await this.preparePartialOutputDescription( context, (await TezosSaplingAddress.fromValue(output.address)).raw, rcm, esk, output.value ) const ciphertext: TezosSaplingCiphertext = await this.cryptoClient.encryptCiphertext( output, outputDescription, rcm, esk, new BigNumber(output.value).gt(0) ? viewingKey : undefined ) descriptions.push({ cm: outputDescription.cm, proof: outputDescription.proof, ciphertext }) } return descriptions } private createTransactionSighash( spends: TezosSaplingSpendDescription[], outputs: TezosSaplingOutputDescription[], antiReplay: string ): Buffer { const spendBytes: Buffer = this.encoder.encodeSpendDescriptions(spends) const outputBytes: Buffer = this.encoder.encodeOutputDescriptions(outputs) return Buffer.from( blake2bAsBytes(Buffer.concat([spendBytes, outputBytes]), 256, { key: Buffer.from(antiReplay) }) ) } private createInputSighash(spend: SaplingUnsignedSpendDescription, antiReplay: string): Buffer { const toSign: Buffer = Buffer.concat([spend.cv, spend.nf, spend.rk, spend.proof]) return Buffer.from(blake2bAsBytes(toSign, 256, { key: Buffer.from(antiReplay) })) } private calculateTransactionBalance(inputs: TezosSaplingInput[], outputs: TezosSaplingOutput[]): BigNumber { const spendBalance: BigNumber = inputs.reduce((sum: BigNumber, next: TezosSaplingInput) => sum.plus(next.value), new BigNumber(0)) const outBalance: BigNumber = outputs.reduce((sum: BigNumber, next: TezosSaplingOutput) => sum.plus(next.value), new BigNumber(0)) return spendBalance.minus(outBalance) } private async withProvingContext(action: (context: number) => Promise<TezosSaplingTransaction>): Promise<TezosSaplingTransaction> { const method = this.externalProvider?.withProvingContext ?? sapling.withProvingContext return method(action) } private async prepareSpendDescription( context: number, spendingKey: Buffer, address: Buffer, rcm: string, ar: Buffer, value: string, root: string, merklePath: string ): Promise<SaplingUnsignedSpendDescription> { const method = this.externalProvider?.prepareSpendDescription ?? sapling.prepareSpendDescription return method(context, spendingKey, address, rcm, ar, value, root, merklePath) } private async preparePartialOutputDescription( context: number, address: Buffer, rcm: Buffer, esk: Buffer, value: string ): Promise<SaplingPartialOutputDescription> { const method = this.externalProvider?.preparePartialOutputDescription ?? sapling.preparePartialOutputDescription return method(context, address, rcm, esk, value) } private async createBindingSignature(context: number, balance: string, sighash: Buffer): Promise<Buffer> { const method = this.externalProvider?.createBindingSignature ?? sapling.createBindingSignature return method(context, balance, sighash) } }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
public async forgeSaplingTransaction( inputs: TezosSaplingInput[], outputs: TezosSaplingOutput[], merkleTree: TezosSaplingStateTree, antiReplay: string, spendingKey?: Buffer ): Promise<TezosSaplingTransaction> { return this.withProvingContext(async (context: number) => { const viewingKey: Buffer | undefined = spendingKey !== undefined ? await sapling.getExtendedFullViewingKeyFromSpendingKey(spendingKey) : undefined const spendDescriptions: TezosSaplingSpendDescription[] = spendingKey !== undefined ? await this.forgeSaplingInputs(context, spendingKey, inputs, merkleTree, antiReplay) : [] const outputDescriptions: TezosSaplingOutputDescription[] = await this.forgeSaplingOutputs(context, viewingKey, outputs) const balance: BigNumber = this.calculateTransactionBalance(inputs, outputs) const sighash: Buffer = this.createTransactionSighash(spendDescriptions, outputDescriptions, antiReplay) const bindingSignature: Buffer = await this.createBindingSignature(context, balance.toFixed(), sighash) return { spendDescriptions, outputDescriptions, bindingSignature, balance, root: merkleTree.root } }) }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private async forgeSaplingInputs( context: number, spendingKey: Buffer, inputs: TezosSaplingInput[], merkleTree: TezosSaplingStateTree, antiReplay: string ): Promise<TezosSaplingSpendDescription[]> { const ar: Buffer = await sapling.randR() const descriptions: TezosSaplingSpendDescription[] = [] for (const input of inputs) { const unsignedSpendDescription: SaplingUnsignedSpendDescription = await this.prepareSpendDescription( context, spendingKey, (await TezosSaplingAddress.fromValue(input.address)).raw, input.rcm, ar, input.value, merkleTree.root, await this.state.getWitness(merkleTree, new BigNumber(input.pos)) ) const sighash: Buffer = this.createInputSighash(unsignedSpendDescription, antiReplay) const signedSpendDescription: SaplingSpendDescription = await sapling.signSpendDescription( unsignedSpendDescription, spendingKey, ar, sighash ) if (signedSpendDescription.spendAuthSig === undefined) { throw new Error('Spend signing failed') } descriptions.push({ cv: signedSpendDescription.cv, nf: signedSpendDescription.nf, rk: signedSpendDescription.rk, proof: signedSpendDescription.proof, signature: signedSpendDescription.spendAuthSig }) } return descriptions }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private async forgeSaplingOutputs( context: number, viewingKey: Buffer | undefined, outputs: TezosSaplingOutput[] ): Promise<TezosSaplingOutputDescription[]> { const rcm: Buffer = await sapling.randR() const descriptions: TezosSaplingOutputDescription[] = [] for (const output of outputs) { const esk: Buffer = await sapling.randR() const outputDescription: SaplingPartialOutputDescription = await this.preparePartialOutputDescription( context, (await TezosSaplingAddress.fromValue(output.address)).raw, rcm, esk, output.value ) const ciphertext: TezosSaplingCiphertext = await this.cryptoClient.encryptCiphertext( output, outputDescription, rcm, esk, new BigNumber(output.value).gt(0) ? viewingKey : undefined ) descriptions.push({ cm: outputDescription.cm, proof: outputDescription.proof, ciphertext }) } return descriptions }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private createTransactionSighash( spends: TezosSaplingSpendDescription[], outputs: TezosSaplingOutputDescription[], antiReplay: string ): Buffer { const spendBytes: Buffer = this.encoder.encodeSpendDescriptions(spends) const outputBytes: Buffer = this.encoder.encodeOutputDescriptions(outputs) return Buffer.from( blake2bAsBytes(Buffer.concat([spendBytes, outputBytes]), 256, { key: Buffer.from(antiReplay) }) ) }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private createInputSighash(spend: SaplingUnsignedSpendDescription, antiReplay: string): Buffer { const toSign: Buffer = Buffer.concat([spend.cv, spend.nf, spend.rk, spend.proof]) return Buffer.from(blake2bAsBytes(toSign, 256, { key: Buffer.from(antiReplay) })) }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private calculateTransactionBalance(inputs: TezosSaplingInput[], outputs: TezosSaplingOutput[]): BigNumber { const spendBalance: BigNumber = inputs.reduce((sum: BigNumber, next: TezosSaplingInput) => sum.plus(next.value), new BigNumber(0)) const outBalance: BigNumber = outputs.reduce((sum: BigNumber, next: TezosSaplingOutput) => sum.plus(next.value), new BigNumber(0)) return spendBalance.minus(outBalance) }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private async withProvingContext(action: (context: number) => Promise<TezosSaplingTransaction>): Promise<TezosSaplingTransaction> { const method = this.externalProvider?.withProvingContext ?? sapling.withProvingContext return method(action) }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private async prepareSpendDescription( context: number, spendingKey: Buffer, address: Buffer, rcm: string, ar: Buffer, value: string, root: string, merklePath: string ): Promise<SaplingUnsignedSpendDescription> { const method = this.externalProvider?.prepareSpendDescription ?? sapling.prepareSpendDescription return method(context, spendingKey, address, rcm, ar, value, root, merklePath) }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private async preparePartialOutputDescription( context: number, address: Buffer, rcm: Buffer, esk: Buffer, value: string ): Promise<SaplingPartialOutputDescription> { const method = this.externalProvider?.preparePartialOutputDescription ?? sapling.preparePartialOutputDescription return method(context, address, rcm, esk, value) }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
MethodDeclaration
private async createBindingSignature(context: number, balance: string, sighash: Buffer): Promise<Buffer> { const method = this.externalProvider?.createBindingSignature ?? sapling.createBindingSignature return method(context, balance, sighash) }
7alip/airgap-coin-lib
packages/core/src/protocols/tezos/sapling/utils/TezosSaplingForger.ts
TypeScript
FunctionDeclaration
function getPageMeta(pageContext: PageContext): IPageMeta { const title = // For static titles (defined in the `export { documentProps }` of the page's `.page.js`) pageContext.pageExports.documentProps?.title || // For dynamic tiles (defined in the `export addContextProps()` of the page's `.page.server.js`) pageContext.documentProps?.title || 'Demo'; const description = pageContext.pageExports.documentProps?.description || pageContext.documentProps?.description; return { title, description }; }
bnn1/vite-plugin-ssr-vue-starter
src/common/utils/getPageMeta.ts
TypeScript
InterfaceDeclaration
interface IPageMeta { title: string; description: string; }
bnn1/vite-plugin-ssr-vue-starter
src/common/utils/getPageMeta.ts
TypeScript
ClassDeclaration
@Component({ selector: 'register', templateUrl: './register.html', }) export class Register { public form:FormGroup; public name:AbstractControl; public email:AbstractControl; public password:AbstractControl; public repeatPassword:AbstractControl; public passwords:FormGroup; public submitted:boolean = false; constructor(fb:FormBuilder) { this.form = fb.group({ 'name': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'email': ['', Validators.compose([Validators.required, EmailValidator.validate])], 'passwords': fb.group({ 'password': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'repeatPassword': ['', Validators.compose([Validators.required, Validators.minLength(4)])] }, {validator: EqualPasswordsValidator.validate('password', 'repeatPassword')}) }); this.name = this.form.controls['name']; this.email = this.form.controls['email']; this.passwords = <FormGroup> this.form.controls['passwords']; this.password = this.passwords.controls['password']; this.repeatPassword = this.passwords.controls['repeatPassword']; } public onSubmit(values:Object):void { this.submitted = true; if (this.form.valid) { // your code goes here // console.log(values); } } }
CamiloRguez/Web-App
src/app/pages/register/register.component.ts
TypeScript
MethodDeclaration
public onSubmit(values:Object):void { this.submitted = true; if (this.form.valid) { // your code goes here // console.log(values); } }
CamiloRguez/Web-App
src/app/pages/register/register.component.ts
TypeScript
FunctionDeclaration
function convertToResource(item: any, processingState: ProcessingState): IResource { let result = (item as IResource) || null; if (typeof item === "string") { result = processingState.resourceMap[item] || (processingState.resourceMap[item] = { iri: item, type: new TypesCollection([hydra.Link]) }); } return result; }
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
FunctionDeclaration
export function collection(mappings: { [property: string]: IPropertyMapping; }): { [property: string]: IPropertyMapping } { mappings[hydra.totalItems] = { default: 0, propertyName: "totalItems", required: true, type: [hydra.Collection as string] }; mappings[hydra.member] = { default: members => new ResourceFilterableCollection(members), propertyName: "members", type: [hydra.Collection as string] }; mappings[hydra.memberTemplate] = { default: memberTemplates => memberTemplates[0] || null, propertyName: "memberTemplate", type: [hydra.Collection as string] }; mappings[hydra.collection] = { default: collections => new ResourceFilterableCollection(collections), propertyName: "collections", required: true }; mappings[hydra.view] = { default: views => views[0] || null, propertyName: "view", type: [hydra.Collection as string] }; mappings[hydra.first] = { default: (first, processingState) => convertToResource(first[0], processingState), propertyName: "first", type: [hydra.PartialCollectionView as string] }; mappings[hydra.last] = { default: (last, processingState) => convertToResource(last[0], processingState), propertyName: "last", type: [hydra.PartialCollectionView as string] }; mappings[hydra.next] = { default: (next, processingState) => convertToResource(next[0], processingState), propertyName: "next", type: [hydra.PartialCollectionView as string] }; mappings[hydra.previous] = { default: (previous, processingState) => convertToResource(previous[0], processingState), propertyName: "previous", type: [hydra.PartialCollectionView as string] }; return mappings; }
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
ArrowFunction
members => new ResourceFilterableCollection(members)
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
ArrowFunction
memberTemplates => memberTemplates[0] || null
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
ArrowFunction
collections => new ResourceFilterableCollection(collections)
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
ArrowFunction
views => views[0] || null
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
ArrowFunction
(first, processingState) => convertToResource(first[0], processingState)
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
ArrowFunction
(last, processingState) => convertToResource(last[0], processingState)
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
ArrowFunction
(next, processingState) => convertToResource(next[0], processingState)
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
ArrowFunction
(previous, processingState) => convertToResource(previous[0], processingState)
hypermedia-app/Heracles.ts
src/JsonLd/collection.ts
TypeScript
FunctionDeclaration
function Nest({ children, error, errorMessage, fields, itemProps, label, showInlineError, ...props }: NestFieldProps) { return ( <div {...filterDOMProps(props)}> {label && <label>{label}</label>} {!!(error && showInlineError) && <div>{errorMessage}</div>} {children || fields.map(field => ( <AutoField key={field} name={field} {...itemProps} /> ))} </div> ); } export default connectField<NestFieldProps>(Nest);
Back2bikes/uniforms
packages/uniforms-antd/src/NestField.tsx
TypeScript
ArrowFunction
field => ( <AutoField key={field}
Back2bikes/uniforms
packages/uniforms-antd/src/NestField.tsx
TypeScript
TypeAliasDeclaration
export type NestFieldProps = HTMLFieldProps< object, HTMLDivElement, { itemProps?: object } >;
Back2bikes/uniforms
packages/uniforms-antd/src/NestField.tsx
TypeScript
ArrowFunction
() => { const theme = useTheme(); return ( <$Actions> <TextArea id="MessagesForm_Message" css={` margin-bottom: ${theme.spacing.s}; `}
City-of-Helsinki/kesaseteli
frontend/shared/src/components/messaging/Actions.tsx
TypeScript
FunctionDeclaration
function addressUnwrapper(x: any): string { const addr = extractAddrM(x); return !addr ? x : addr.slice(0, 2) === '0x' ? addr : addressToHex(addr); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
<X extends CBR_Val>(t:ALGO_Ty<X>, v:X) => t.toNet(v)
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(bv: CBR_Null): NV => (void(bv), new Uint8Array([]))
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): CBR_Null => (void(nv), null)
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(bv: CBR_Bool): NV => new Uint8Array([bv ? 1 : 0])
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): CBR_Bool => nv[0] == 1
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(bv: CBR_UInt): NV => { try { return ethers.utils.zeroPad(ethers.utils.arrayify(bv), 8) } catch (e) { throw new Error(`toNet: ${bv} is out of range [0, ${UInt_max}]`); } }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): CBR_UInt => { // debug(`fromNet: UInt`, nv); // if (getDEBUG()) console.log(nv); return ethers.BigNumber.from(nv.slice(0, 8)); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(len:number) => ({ toNet: (bv: CBR_Bytes): NV => ( ethers.utils.toUtf8Bytes(bv) ), fromNet: (nv: NV): CBR_Bytes => ( ethers.utils.toUtf8String(nv.slice(0, len)) ), })
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(bv: CBR_Bytes): NV => ( ethers.utils.toUtf8Bytes(bv) )
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): CBR_Bytes => ( ethers.utils.toUtf8String(nv.slice(0, len)) )
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(len:number) => ({ netSize: len, netName: `byte[${len}]`, toNet: (bv: string): NV => { return ethers.utils.arrayify(bv); }, fromNet: (nv: NV): string => { return ethers.utils.hexlify(nv.slice(0, len)); } })
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(bv: string): NV => { return ethers.utils.arrayify(bv); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): string => { return ethers.utils.hexlify(nv.slice(0, len)); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(len:number): ALGO_Ty<CBR_Bytes> => ({ ...CBR.BT_Bytes(len), ...stringyNet(len), netSize: bigNumberToNumber(len), netName: `byte[${len}]`, })
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(x: string): string => '0x' + Buffer.from(algosdk.decodeAddress(x).publicKey).toString('hex')
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(hexAddr: string): string => algosdk.encodeAddress(Buffer.from(hexAddr.slice(2), 'hex'))
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(x: any): string|false => { const addr: string|false = (x && x.networkAccount && x.networkAccount.addr) || (x && x.addr) || (typeof x === 'string' && x); //debug(`extractAddrM`, {x, addr}); return addr; }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(x:any): string => { const a = extractAddrM(x); //debug(`extractAddr`, {x, a}); if ( a === false ) { throw Error(`Expected address, got ${x}`); } return a; }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(uv: unknown): CBR_Address => { const val = addressUnwrapper(uv); const hs = CBR.BT_Address.canonicalize(val || uv); // We are filling up with zeros if the address is less than 32 bytes return hs.padEnd(32*2+2, '0'); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
( co: ALGO_Ty<CBR_Val>, size_u: unknown, ): ALGO_Ty<CBR_Array> => { const size = bigNumberToNumber(bigNumberify(size_u)); debug('T_Array', co, size); const asTuple = T_Tuple(new Array(size).fill(co)); debug('T_Array', asTuple); const { netSize, toNet, fromNet } = asTuple; return { ...CBR.BT_Array(co, size), netSize, toNet, fromNet, netName: `${co.netName}[${size}]`, }; }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
( cos: Array<ALGO_Ty<CBR_Val>>, ): ALGO_Ty<CBR_Tuple> => ({ ...CBR.BT_Tuple(cos), netSize: ( cos.reduce(((acc:number, co:ALGO_Ty<CBR_Val>): number => acc + co.netSize), 0) ), toNet: (bv: CBR_Tuple): NV => { const val = cos.map((co, i) => co.toNet(bv[i])); return ethers.utils.concat(val); }, // TODO: share more code w/ T_Array.fromNet fromNet: (nv: NV): CBR_Tuple => { //debug(`Tuple.fromNet`, cos.map((x) => x.name), nv); const chunks: Array<CBR_Val> = new Array(cos.length).fill(null); let rest = nv; for (const i in cos) { const co = cos[i]; chunks[i] = co.fromNet(rest.slice(0, co.netSize)); rest = rest.slice(co.netSize); } return chunks; }, netName: `(${cos.map(c => c.netName).join(',')})`, })
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(acc:number, co:ALGO_Ty<CBR_Val>): number => acc + co.netSize
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(bv: CBR_Tuple): NV => { const val = cos.map((co, i) => co.toNet(bv[i])); return ethers.utils.concat(val); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(co, i) => co.toNet(bv[i])
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): CBR_Tuple => { //debug(`Tuple.fromNet`, cos.map((x) => x.name), nv); const chunks: Array<CBR_Val> = new Array(cos.length).fill(null); let rest = nv; for (const i in cos) { const co = cos[i]; chunks[i] = co.fromNet(rest.slice(0, co.netSize)); rest = rest.slice(co.netSize); } return chunks; }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
c => c.netName
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
( cos: Array<[string, ALGO_Ty<CBR_Val>]>, ): ALGO_Ty<CBR_Struct> => ({ ...CBR.BT_Struct(cos), netSize: ( cos.reduce((acc, co) => acc + co[1].netSize, 0) ), toNet: (bv: CBR_Struct): NV => { const val = cos.map(([k, co]) => co.toNet(bv[k])); return ethers.utils.concat(val); }, // TODO: share more code w/ T_Array.fromNet fromNet: (nv: NV): CBR_Struct => { const obj: any = {}; let rest = nv; for (const i in cos) { const [k, co] = cos[i]; obj[k] = co.fromNet(rest.slice(0, co.netSize)); rest = rest.slice(co.netSize); } return obj; }, netName: `(${cos.map(c => c[1].netName).join(',')})`, })
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(acc, co) => acc + co[1].netSize
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(bv: CBR_Struct): NV => { const val = cos.map(([k, co]) => co.toNet(bv[k])); return ethers.utils.concat(val); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
([k, co]) => co.toNet(bv[k])
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): CBR_Struct => { const obj: any = {}; let rest = nv; for (const i in cos) { const [k, co] = cos[i]; obj[k] = co.fromNet(rest.slice(0, co.netSize)); rest = rest.slice(co.netSize); } return obj; }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
c => c[1].netName
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
( coMap: {[key: string]: ALGO_Ty<CBR_Val>} ): ALGO_Ty<CBR_Object> => { const cos = Object.values(coMap); const netSize = cos.reduce((acc, co) => acc + co.netSize, 0); const {ascLabels} = labelMaps(coMap); return { ...CBR.BT_Object(coMap), netSize, toNet: (bv: CBR_Object): NV => { const chunks = ascLabels.map((label) => coMap[label].toNet(bv[label]) ); return ethers.utils.concat(chunks); }, // TODO: share more code w/ T_Array.fromNet and T_Tuple.fromNet fromNet: (nv: NV): CBR_Object => { const obj: {[key: string]: CBR_Val} = {}; let rest = nv; for (const iStr in ascLabels) { const i = parseInt(iStr); const label = ascLabels[i]; const co = coMap[label]; obj[label] = co.fromNet(rest.slice(0, co.netSize)); rest = rest.slice(co.netSize); } return obj; }, netName: `(${cos.map(c => c.netName).join(',')})`, } }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(acc, co) => acc + co.netSize
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(bv: CBR_Object): NV => { const chunks = ascLabels.map((label) => coMap[label].toNet(bv[label]) ); return ethers.utils.concat(chunks); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(label) => coMap[label].toNet(bv[label])
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): CBR_Object => { const obj: {[key: string]: CBR_Val} = {}; let rest = nv; for (const iStr in ascLabels) { const i = parseInt(iStr); const label = ascLabels[i]; const co = coMap[label]; obj[label] = co.fromNet(rest.slice(0, co.netSize)); rest = rest.slice(co.netSize); } return obj; }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
( coMap: {[key: string]: ALGO_Ty<CBR_Val>} ): ALGO_Ty<CBR_Data> => { const cos = Object.values(coMap); const cosSizes = cos.map((co) => co.netSize); const valSize = Math.max(...cosSizes); const netSize = valSize + 1; debug(`T_Data`, { cos, cosSizes, valSize, netSize }); const {ascLabels, labelMap} = labelMaps(coMap); return { ...CBR.BT_Data(coMap), netSize, toNet: ([label, val]: CBR_Data): NV => { const i = labelMap[label]; const lab_nv = new Uint8Array([i]); const val_co = coMap[label]; const val_nv = val_co.toNet(val); const padding = new Uint8Array(valSize - val_nv.length); return ethers.utils.concat([lab_nv, val_nv, padding]); }, fromNet: (nv: NV): CBR_Data => { const i = nv[0]; const label = ascLabels[i]; const val_co = coMap[label]; debug({nv, i, label, val_co}); const rest = nv.slice(1); const sliceTo = val_co.netSize; const val = val_co.fromNet(rest.slice(0, sliceTo)); return [label, val]; }, netName: `(byte,byte[${valSize}])`, } }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(co) => co.netSize
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
([label, val]: CBR_Data): NV => { const i = labelMap[label]; const lab_nv = new Uint8Array([i]); const val_co = coMap[label]; const val_nv = val_co.toNet(val); const padding = new Uint8Array(valSize - val_nv.length); return ethers.utils.concat([lab_nv, val_nv, padding]); }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(nv: NV): CBR_Data => { const i = nv[0]; const label = ascLabels[i]; const val_co = coMap[label]; debug({nv, i, label, val_co}); const rest = nv.slice(1); const sliceTo = val_co.netSize; const val = val_co.fromNet(rest.slice(0, sliceTo)); return [label, val]; }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
ArrowFunction
(x: unknown, y: unknown): boolean => T_Token.canonicalize(x).eq(T_Token.canonicalize(y))
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
TypeAliasDeclaration
type BigNumber = ethers.BigNumber;
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
TypeAliasDeclaration
// NV = Net Value export type NV = Uint8Array;
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
TypeAliasDeclaration
export type ALGO_Ty<BV extends CBR_Val> = { name: string, canonicalize: (uv: unknown) => BV, netSize: number toNet(bv: BV): NV, fromNet(nv: NV): BV, netName: string, }
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
TypeAliasDeclaration
export type Token = CBR_UInt;
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
TypeAliasDeclaration
export type Contract = CBR_UInt;
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
TypeAliasDeclaration
export type PayAmt = MkPayAmt<Token>;
FrankSzendzielarz/reach-lang
js/stdlib/ts/ALGO_compiled.ts
TypeScript
TypeAliasDeclaration
export type _Props = { collapseRef: React.RefObject<HTMLDivElement>; toggleNavigation: () => void; links: { href: string; text: string }[]; moreLinks: { href: string; text: string }[]; linkClass: (pathname: string) => string; };
jamband/expericana
src/layouts/header/types.ts
TypeScript
ArrowFunction
(value: string) => { const deferred: IDeferred<boolean> = this.$q.defer(); ApplicationNameValidator.validate(value, this.cloudProviders).then((result: IApplicationNameValidationResult) => { if (result.errors.length) { deferred.reject(); } else { deferred.resolve(); } }); return deferred.promise; }
Click2Cloud-neutron/deck
app/scripts/modules/core/src/application/modal/validation/validateApplicationName.directive.ts
TypeScript
ArrowFunction
(result: IApplicationNameValidationResult) => { if (result.errors.length) { deferred.reject(); } else { deferred.resolve(); } }
Click2Cloud-neutron/deck
app/scripts/modules/core/src/application/modal/validation/validateApplicationName.directive.ts
TypeScript
ArrowFunction
() => this.model.$validate()
Click2Cloud-neutron/deck
app/scripts/modules/core/src/application/modal/validation/validateApplicationName.directive.ts
TypeScript
ArrowFunction
($scope: IScope, _$element: JQuery, $attrs: IValidateNameAttrs, ctrl: INgModelController) => { const $ctrl: ValidateApplicationNameController = $scope['$ctrl']; $ctrl.$scope = $scope; $ctrl.$attrs = $attrs; $ctrl.model = ctrl; $ctrl.initialize(); }
Click2Cloud-neutron/deck
app/scripts/modules/core/src/application/modal/validation/validateApplicationName.directive.ts
TypeScript