type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
MethodDeclaration |
exportdat() {
this.gridApi.exportDataAsCsv();
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
MethodDeclaration |
onSelectionChanged(event) {
console.log(event.api.getSelectedNodes());
const rowCount = event.api.getSelectedNodes().length;
window.alert('selection changed, ' + rowCount + ' rows selected');
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
MethodDeclaration | // public onRowClicked(e) {
// if (e.event.target !== undefined) {
// let data = e.data;
// let actionType = e.event.target.getAttribute('data-action-type');
// switch (actionType) {
// case 'delete':
// return this.onActionDeleteClick(data);
// case 'edit':
// return this.onActionEditClick(data), this.visibleonedit();
// }
// }
// }
public onActionDeleteClick(data: any) {
debugger;
if (confirm('Are you sure?')) {
this.db.destroy('smtpdetail/', data.id, ((response): void => {
this.db.addmessageandremove('deleted');
//this.LoadData();
})
);
}
console.log('View action clicked', data);
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
MethodDeclaration | // back(): void {
// this.isEdit = false;
// this.smtp = { id: 0 };
// }
// onActionEditClick(row): void {
// this.isEdit = false;
// this.db.show('smtpdetail/', row.id, ((response): void => {
// this.isEdit = true;
// this.smtp = response;
// if (this.firstLoad === false) {
// window.scrollTo(0, 100);
// //this.firstLoad = true;
// }
// // for (var i in response.data) {
// // for (var j in response.data[i]) {
// // this.gridOptions.columnDefs.push({field:j});
// // }
// // break;
// // }
// // this.gridTotalJobs.data = response.data;
// }));
// };
smtpupdate(): void {
// if (!$('body').validate('#smtpid')) {
// // $.fn.showMessage('Please fill values');
// return;
// }
this.db.update('smtpdetail/', {}, ((response): void => {
this.LoadData();
this.db.showMessage('Updated Successfully');
}));
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
MethodDeclaration |
smtpsave(): void {
// if (!$('.validate').validate('#smtpid')) {
// // $.fn.showMessage('Please fill values');
// return;
// }
//this.user.profilepic=this.user.profilepic[0];
debugger;
const savesmtp = {
'smtptype': this.smtptype,
'smtpname': this.smtpname,
'incoming_port': this.incoming_port,
'user_name': this.user_name,
'password': this.password
}
this.db.store('emaildetail/', savesmtp, ((response): void => {
alert('Thank you for updating Details, Velidating these details may take upto 72 Hours');
this.db.showMessage('Added Successfully');
// this.LoadData();
//this.smtp = { id: 0 };
}));
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
InterfaceDeclaration |
export interface Label {
label?: string
} | nulab/hydralibs | packages/styled/src/props/label.ts | TypeScript |
InterfaceDeclaration |
export interface PlaylistTrack extends PlaylistTrackDTO, Document {} | lItc0de/jukebox | backend/src/playlists/interfaces/playlistTrack.interface.ts | TypeScript |
FunctionDeclaration |
export function isCoreAspect(id: string) {
const _reserved = [BitAspect.id, ConfigAspect.id];
if (_reserved.includes(id)) return true;
return !!manifestsMap[id];
} | jsoref/b | scopes/harmony/bit/manifests.ts | TypeScript |
FunctionDeclaration |
export function getAllCoreAspectsIds(): string[] {
const _reserved = [BitAspect.id, ConfigAspect.id];
return [...Object.keys(manifestsMap), ..._reserved];
} | jsoref/b | scopes/harmony/bit/manifests.ts | TypeScript |
ArrowFunction |
() => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'directives'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('directives');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('directives app is running!');
});
} | Wantonius/TampereOuluFullstack2021 | angular/b-directives/src/app/app.component.spec.ts | TypeScript |
ArrowFunction |
async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
} | Wantonius/TampereOuluFullstack2021 | angular/b-directives/src/app/app.component.spec.ts | TypeScript |
ArrowFunction |
() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('directives');
} | Wantonius/TampereOuluFullstack2021 | angular/b-directives/src/app/app.component.spec.ts | TypeScript |
ArrowFunction |
() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('directives app is running!');
} | Wantonius/TampereOuluFullstack2021 | angular/b-directives/src/app/app.component.spec.ts | TypeScript |
ArrowFunction |
() => {
const formikFormProps = {
dirty: false,
errors: {},
handleBlur: () => null,
handleChange: () => null,
handleReset: () => null,
handleSubmit: () => null,
initialValues: {},
isSubmitting: false,
isValid: false,
isValidating: false,
registerField: () => null,
resetForm: () => null,
setError: () => null,
setErrors: () => null,
setFieldError: () => null,
setFieldTouched: () => null,
setFieldValue: () => null,
setFormikState: () => null,
setStatus: () => null,
setSubmitting: () => null,
setTouched: () => null,
setValues: () => null,
submitCount: 0,
submitForm: () => null,
touched: {},
unregisterField: () => null,
validateField: () => null,
validateForm: () => null,
validateOnBlur: true,
validateOnChange: true,
values: {},
};
describe('render', () => {
it('should match snapshot when Fieldset is tab', () => {
const wrapper = shallow(
<Fieldset
isTab={true}
form={formikFormProps}
field={{
value: '',
onChange: () => null,
onBlur: () => null,
name: 'foo',
}}
schema={{
type: ['object'],
properties: {
baz: {
title: 'Baz',
type: ['string'],
},
bar: {
title: 'Bar',
type: ['number'],
},
},
required: ['baz'],
propertiesOrder: ['bar', 'baz'],
}}
isRequired={false}
>
test
</Fieldset>,
);
wrapper.should.to.matchSnapshot();
} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => null | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
it('should match snapshot when Fieldset is tab', () => {
const wrapper = shallow(
<Fieldset
isTab={true}
form={formikFormProps}
field={{
value: '',
onChange: () => null,
onBlur: () => null,
name: 'foo',
}}
schema={{
type: ['object'],
properties: {
baz: {
title: 'Baz',
type: ['string'],
},
bar: {
title: 'Bar',
type: ['number'],
},
},
required: ['baz'],
propertiesOrder: ['bar', 'baz'],
}} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = shallow(
<Fieldset
isTab={true}
form={formikFormProps}
field={{
value: '',
onChange: () => null,
onBlur: () => null,
name: 'foo',
}} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
const wrapper = shallow(
<Fieldset
isTab={false}
form={formikFormProps}
field={{
value: '',
onChange: () => null,
onBlur: () => null,
name: 'foo',
}} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
it('should return empty array when there are no properties', () => {
const result = orderProperties();
const expected = [];
result.should.deep.equal(expected);
});
it('should return sorted properties', () => {
const result = orderProperties(['foo', 'bar', 'baz'], ['bar', 'baz']);
const expected = ['bar', 'baz', 'foo'];
result.should.deep.equal(expected);
});
it("should return return unsorted properties when order isn't defined", () => {
const result = orderProperties(['foz', 'foo', 'bar']);
const expected = ['foz', 'foo', 'bar'];
result.should.deep.equal(expected);
});
it('should throw an error when order contains property which is not included in properties passed to function', () => {
(() => orderProperties(['foz'], ['foo', 'foz'])).should.throw(
Error,
"uiSchema order list contains extraneous property 'foo'",
);
});
it('should throw an error when order contains properties which are not included in properties passed to function', () => {
(() => orderProperties([], ['foo', 'foz'])).should.throw(
Error,
"uiSchema order list contains extraneous properties 'foo, foz'",
);
});
} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
const result = orderProperties();
const expected = [];
result.should.deep.equal(expected);
} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
const result = orderProperties(['foo', 'bar', 'baz'], ['bar', 'baz']);
const expected = ['bar', 'baz', 'foo'];
result.should.deep.equal(expected);
} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
const result = orderProperties(['foz', 'foo', 'bar']);
const expected = ['foz', 'foo', 'bar'];
result.should.deep.equal(expected);
} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
(() => orderProperties(['foz'], ['foo', 'foz'])).should.throw(
Error,
"uiSchema order list contains extraneous property 'foo'",
);
} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => orderProperties(['foz'], ['foo', 'foz']) | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => {
(() => orderProperties([], ['foo', 'foz'])).should.throw(
Error,
"uiSchema order list contains extraneous properties 'foo, foz'",
);
} | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
() => orderProperties([], ['foo', 'foz']) | cloudwan/gohan-jsonschema-form | src/Form/fields/ObjectField/components/Fieldset.test.tsx | TypeScript |
ArrowFunction |
(k) => k.type === 'Secp256k1' | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
ArrowFunction |
(data: string | Uint8Array) => {
let dataString, encoding: 'base16' | undefined
if (typeof data === 'string') {
dataString = data
encoding = undefined
} else {
;(dataString = Buffer.from(data).toString('hex')), (encoding = 'base16')
}
return context.agent.keyManagerSign({ keyRef: key.kid, data: dataString, encoding })
} | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
ArrowFunction |
(i) => i.did | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
ArrowFunction |
(credential) => {
if (
credentialRequest.claimType &&
credentialRequest.claimValue &&
credential.credentialSubject[credentialRequest.claimType] !== credentialRequest.claimValue
) {
return false
}
if (
credentialRequest.claimType &&
!credentialRequest.claimValue &&
credential.credentialSubject[credentialRequest.claimType] === undefined
) {
return false
}
if (
credentialRequest.issuers &&
!credentialRequest.issuers.map((i) => i.did).includes(credential.issuer.id)
) {
return false
}
if (
credentialRequest.credentialContext &&
!credential['@context'].includes(credentialRequest.credentialContext)
) {
return false
}
if (credentialRequest.credentialType && !credential.type.includes(credentialRequest.credentialType)) {
return false
}
return true
} | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
ArrowFunction |
(vc) => ({
hash: blake2bHex(JSON.stringify(vc)),
verifiableCredential: vc,
}) | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
MethodDeclaration | /**
* Creates a Selective disclosure request, encoded as a JWT.
*
* @remarks See {@link https://github.com/uport-project/specs/blob/develop/flows/selectivedisclosure.md | Selective Disclosure}
*
* @param args - The param object with the properties necessary to create the request. See {@link ISelectiveDisclosureRequest}
* @param context - *RESERVED* This is filled by the framework when the method is called.
*
* @beta
*/
async createSelectiveDisclosureRequest(
args: ICreateSelectiveDisclosureRequestArgs,
context: IAgentContext<IDIDManager & IKeyManager>,
): Promise<string> {
try {
const identifier = await context.agent.didManagerGet({ did: args.data.issuer })
const data: Partial<ISelectiveDisclosureRequest> = args.data
delete data.issuer
Debug('veramo:selective-disclosure:create-sdr')('Signing SDR with', identifier.did)
const key = identifier.keys.find((k) => k.type === 'Secp256k1')
if (!key) throw Error('Signing key not found')
const signer = (data: string | Uint8Array) => {
let dataString, encoding: 'base16' | undefined
if (typeof data === 'string') {
dataString = data
encoding = undefined
} else {
;(dataString = Buffer.from(data).toString('hex')), (encoding = 'base16')
}
return context.agent.keyManagerSign({ keyRef: key.kid, data: dataString, encoding })
}
const jwt = await createJWT(
{
type: 'sdr',
...data,
},
{
signer,
alg: 'ES256K',
issuer: identifier.did,
},
)
return jwt
} catch (error) {
return Promise.reject(error)
}
} | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
MethodDeclaration | /**
* Gathers the required credentials necessary to fulfill a Selective Disclosure Request.
* It uses the {@link @veramo/data-store#IDataStoreORM} plugin to query the local database for
* the required credentials.
*
* @param args - Contains the Request to be fulfilled and the DID of the subject
* @param context - *RESERVED* This is filled by the framework when the method is called.
*
* @beta
*/
async getVerifiableCredentialsForSdr(
args: IGetVerifiableCredentialsForSdrArgs,
context: IAgentContext<IDataStoreORM>,
): Promise<ICredentialsForSdr[]> {
const result: ICredentialsForSdr[] = []
const findArgs: FindArgs<TClaimsColumns> = { where: [] }
for (const credentialRequest of args.sdr.claims) {
if (credentialRequest.claimType) {
findArgs.where?.push({ column: 'type', value: [credentialRequest.claimType] })
}
if (credentialRequest.claimValue) {
findArgs.where?.push({ column: 'value', value: [credentialRequest.claimValue] })
}
if (credentialRequest.issuers && credentialRequest.issuers.length > 0) {
findArgs.where?.push({ column: 'issuer', value: credentialRequest.issuers.map((i) => i.did) })
}
if (credentialRequest.credentialType) {
findArgs.where?.push({
column: 'credentialType',
value: ['%' + credentialRequest.credentialType + '%'],
op: 'Like',
})
}
if (credentialRequest.credentialContext) {
findArgs.where?.push({
column: 'context',
value: ['%' + credentialRequest.credentialContext + '%'],
op: 'Like',
})
}
if (args.did || args.sdr.subject) {
findArgs.where?.push({ column: 'subject', value: ['' + (args.did || args.sdr.subject)] })
}
const credentials = await context.agent.dataStoreORMGetVerifiableCredentialsByClaims(findArgs)
result.push({
...credentialRequest,
credentials,
})
}
return result
} | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
MethodDeclaration | /**
* Validates a
* {@link https://github.com/uport-project/specs/blob/develop/flows/selectivedisclosure.md | Selective Disclosure response}
* encoded as a `Presentation`
*
* @param args - Contains the request and the response `Presentation` that needs to be checked.
* @param context - *RESERVED* This is filled by the framework when the method is called.
*
* @beta
*/
async validatePresentationAgainstSdr(
args: IValidatePresentationAgainstSdrArgs,
context: IAgentContext<{}>,
): Promise<IPresentationValidationResult> {
let valid = true
let claims = []
for (const credentialRequest of args.sdr.claims) {
let credentials = (args.presentation?.verifiableCredential || []).filter((credential) => {
if (
credentialRequest.claimType &&
credentialRequest.claimValue &&
credential.credentialSubject[credentialRequest.claimType] !== credentialRequest.claimValue
) {
return false
}
if (
credentialRequest.claimType &&
!credentialRequest.claimValue &&
credential.credentialSubject[credentialRequest.claimType] === undefined
) {
return false
}
if (
credentialRequest.issuers &&
!credentialRequest.issuers.map((i) => i.did).includes(credential.issuer.id)
) {
return false
}
if (
credentialRequest.credentialContext &&
!credential['@context'].includes(credentialRequest.credentialContext)
) {
return false
}
if (credentialRequest.credentialType && !credential.type.includes(credentialRequest.credentialType)) {
return false
}
return true
})
if (credentialRequest.essential === true && credentials.length == 0) {
valid = false
}
claims.push({
...credentialRequest,
credentials: credentials.map((vc) => ({
hash: blake2bHex(JSON.stringify(vc)),
verifiableCredential: vc,
})),
})
}
return { valid, claims }
} | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
MethodDeclaration | /**
* Creates profile credentials
*
* @beta
*/
async createProfilePresentation(
args: ICreateProfileCredentialsArgs,
context: IAgentContext<ICredentialIssuer & IDIDManager>,
): Promise<VerifiablePresentation> {
const identifier = await context.agent.didManagerGet({ did: args.holder })
const credentials = []
if (args.name) {
const credential = await context.agent.createVerifiableCredential({
credential: {
issuer: { id: identifier.did },
'@context': ['https://www.w3.org/2018/credentials/v1'],
type: ['VerifiableCredential', 'Profile'],
issuanceDate: new Date().toISOString(),
credentialSubject: {
id: identifier.did,
name: args.name,
},
},
proofFormat: 'jwt',
})
credentials.push(credential)
}
if (args.picture) {
const credential = await context.agent.createVerifiableCredential({
credential: {
issuer: { id: identifier.did },
'@context': ['https://www.w3.org/2018/credentials/v1'],
type: ['VerifiableCredential', 'Profile'],
issuanceDate: new Date().toISOString(),
credentialSubject: {
id: identifier.did,
picture: args.picture,
},
},
proofFormat: 'jwt',
})
credentials.push(credential)
}
if (args.url) {
const credential = await context.agent.createVerifiableCredential({
credential: {
issuer: { id: identifier.did },
'@context': ['https://www.w3.org/2018/credentials/v1'],
type: ['VerifiableCredential', 'Profile'],
issuanceDate: new Date().toISOString(),
credentialSubject: {
id: identifier.did,
url: args.url,
},
},
proofFormat: 'jwt',
})
credentials.push(credential)
}
const profile = await context.agent.createVerifiablePresentation({
presentation: {
verifier: args.holder ? [args.holder] : [],
holder: identifier.did,
'@context': ['https://www.w3.org/2018/credentials/v1'],
type: ['VerifiablePresentation', 'Profile'],
issuanceDate: new Date().toISOString(),
verifiableCredential: credentials,
},
proofFormat: 'jwt',
save: args.save,
})
if (args.verifier && args.send) {
await context.agent.sendMessageDIDCommAlpha1({
save: args.save,
data: {
from: identifier.did,
to: args.verifier,
type: 'jwt',
body: profile.proof.jwt,
},
})
}
return profile
} | ebaizel/veramo | packages/selective-disclosure/src/action-handler.ts | TypeScript |
ArrowFunction |
() => (
<Tooltip>A | TheRakeshPurohit/Rocket.Chat.Fuselage | packages/fuselage/src/components/Tooltip/Tooltip.stories.tsx | TypeScript |
ArrowFunction |
() => (
<Margins inline='neg-x8'>
<Box>
<Margins all | TheRakeshPurohit/Rocket.Chat.Fuselage | packages/fuselage/src/components/Tooltip/Tooltip.stories.tsx | TypeScript |
FunctionDeclaration |
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(new ValidationPipe());
app.enableCors();
await app.listen(3001);
} | IgnacioMansillaGomez/to-do | src/main.ts | TypeScript |
ArrowFunction |
(o) => !!o | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
ArrowFunction |
(conf: SwaggerSettings) => {
const {path = "/"} = conf;
this.app.get(path, useCtxHandler(redirectMiddleware(path)));
this.app.use(path, this.createRouter(conf, urls));
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
ArrowFunction |
(conf: SwaggerSettings) => {
const {path = "/", fileName = "swagger.json", doc} = conf;
let url = "/";
if (host) {
url = typeof host.port === "number" ? `${host.protocol}://${host.address}:${host.port}` : "";
}
this.injector.logger.info(`[${doc || "default"}] Swagger JSON is available on ${url}${normalizePath(path, fileName)}`);
this.injector.logger.info(`[${doc || "default"}] Swagger UI is available on ${url}${path}/`);
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
ArrowFunction |
(conf) => {
displayLog(conf);
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
ArrowFunction |
(conf) => {
const {outFile} = conf;
if (this.env === Env.PROD || outFile) {
const spec = this.swaggerService.getOpenAPISpec(conf);
if (outFile) {
return Fs.writeFile(outFile, JSON.stringify(spec, null, 2), {encoding: "utf8"}, () => {});
}
}
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
ArrowFunction |
(acc: any[], conf) => {
const {path = "/", fileName = "swagger.json", doc, hidden} = conf;
if (!hidden) {
acc.push({url: normalizePath(path, fileName), name: doc || path});
}
return acc;
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
ArrowFunction |
(ctx: PlatformContext) => {
ctx.response.status(200).body(this.swaggerService.getOpenAPISpec(conf));
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
ClassDeclaration | /**
* @ignore
*/
@Module()
export class SwaggerModule implements BeforeRoutesInit, OnReady {
@Inject()
injector: InjectorService;
@Inject()
app: PlatformApplication;
@Configuration()
configuration: Configuration;
@Inject()
swaggerService: SwaggerService;
@Constant("env")
env: Env;
private loaded = false;
get settings() {
return ([] as SwaggerSettings[]).concat(this.configuration.get<SwaggerSettings[]>("swagger")).filter((o) => !!o);
}
/**
*
*/
$beforeRoutesInit() {
if (this.loaded) {
return;
}
const urls: any[] = this.getUrls();
this.settings.forEach((conf: SwaggerSettings) => {
const {path = "/"} = conf;
this.app.get(path, useCtxHandler(redirectMiddleware(path)));
this.app.use(path, this.createRouter(conf, urls));
});
this.loaded = true;
}
$onReady() {
// istanbul ignore next
if (this.configuration.getBestHost) {
const host = this.configuration.getBestHost();
if (!host) {
return;
}
const displayLog = (conf: SwaggerSettings) => {
const {path = "/", fileName = "swagger.json", doc} = conf;
let url = "/";
if (host) {
url = typeof host.port === "number" ? `${host.protocol}://${host.address}:${host.port}` : "";
}
this.injector.logger.info(`[${doc || "default"}] Swagger JSON is available on ${url}${normalizePath(path, fileName)}`);
this.injector.logger.info(`[${doc || "default"}] Swagger UI is available on ${url}${path}/`);
};
this.settings.forEach((conf) => {
displayLog(conf);
});
}
this.generateSpecFiles();
}
generateSpecFiles() {
return Promise.all(
this.settings.map((conf) => {
const {outFile} = conf;
if (this.env === Env.PROD || outFile) {
const spec = this.swaggerService.getOpenAPISpec(conf);
if (outFile) {
return Fs.writeFile(outFile, JSON.stringify(spec, null, 2), {encoding: "utf8"}, () => {});
}
}
})
);
}
private getUrls() {
return this.settings.reduce((acc: any[], conf) => {
const {path = "/", fileName = "swagger.json", doc, hidden} = conf;
if (!hidden) {
acc.push({url: normalizePath(path, fileName), name: doc || path});
}
return acc;
}, []);
}
/**
*
* @param conf
* @param urls
*/
private createRouter(conf: SwaggerSettings, urls: string[]) {
const {disableSpec = false, fileName = "swagger.json", cssPath, jsPath, viewPath = join(__dirname, "../views/index.ejs")} = conf;
const router = PlatformRouter.create(this.injector);
if (!disableSpec) {
router.get(normalizePath("/", fileName), useCtxHandler(this.middlewareSwaggerJson(conf)));
}
if (viewPath) {
if (cssPath) {
router.get("/main.css", useCtxHandler(cssMiddleware(cssPath)));
}
if (jsPath) {
router.get("/main.js", useCtxHandler(jsMiddleware(jsPath)));
}
router.get("/", useCtxHandler(indexMiddleware(viewPath, {urls, ...conf})));
router.statics("/", {root: swaggerUiPath});
}
return router;
}
private middlewareSwaggerJson(conf: SwaggerSettings) {
return (ctx: PlatformContext) => {
ctx.response.status(200).body(this.swaggerService.getOpenAPISpec(conf));
};
}
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
MethodDeclaration | /**
*
*/
$beforeRoutesInit() {
if (this.loaded) {
return;
}
const urls: any[] = this.getUrls();
this.settings.forEach((conf: SwaggerSettings) => {
const {path = "/"} = conf;
this.app.get(path, useCtxHandler(redirectMiddleware(path)));
this.app.use(path, this.createRouter(conf, urls));
});
this.loaded = true;
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
MethodDeclaration |
$onReady() {
// istanbul ignore next
if (this.configuration.getBestHost) {
const host = this.configuration.getBestHost();
if (!host) {
return;
}
const displayLog = (conf: SwaggerSettings) => {
const {path = "/", fileName = "swagger.json", doc} = conf;
let url = "/";
if (host) {
url = typeof host.port === "number" ? `${host.protocol}://${host.address}:${host.port}` : "";
}
this.injector.logger.info(`[${doc || "default"}] Swagger JSON is available on ${url}${normalizePath(path, fileName)}`);
this.injector.logger.info(`[${doc || "default"}] Swagger UI is available on ${url}${path}/`);
};
this.settings.forEach((conf) => {
displayLog(conf);
});
}
this.generateSpecFiles();
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
MethodDeclaration |
generateSpecFiles() {
return Promise.all(
this.settings.map((conf) => {
const {outFile} = conf;
if (this.env === Env.PROD || outFile) {
const spec = this.swaggerService.getOpenAPISpec(conf);
if (outFile) {
return Fs.writeFile(outFile, JSON.stringify(spec, null, 2), {encoding: "utf8"}, () => {});
}
}
})
);
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
MethodDeclaration |
private getUrls() {
return this.settings.reduce((acc: any[], conf) => {
const {path = "/", fileName = "swagger.json", doc, hidden} = conf;
if (!hidden) {
acc.push({url: normalizePath(path, fileName), name: doc || path});
}
return acc;
}, []);
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
MethodDeclaration | /**
*
* @param conf
* @param urls
*/
private createRouter(conf: SwaggerSettings, urls: string[]) {
const {disableSpec = false, fileName = "swagger.json", cssPath, jsPath, viewPath = join(__dirname, "../views/index.ejs")} = conf;
const router = PlatformRouter.create(this.injector);
if (!disableSpec) {
router.get(normalizePath("/", fileName), useCtxHandler(this.middlewareSwaggerJson(conf)));
}
if (viewPath) {
if (cssPath) {
router.get("/main.css", useCtxHandler(cssMiddleware(cssPath)));
}
if (jsPath) {
router.get("/main.js", useCtxHandler(jsMiddleware(jsPath)));
}
router.get("/", useCtxHandler(indexMiddleware(viewPath, {urls, ...conf})));
router.statics("/", {root: swaggerUiPath});
}
return router;
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
MethodDeclaration |
private middlewareSwaggerJson(conf: SwaggerSettings) {
return (ctx: PlatformContext) => {
ctx.response.status(200).body(this.swaggerService.getOpenAPISpec(conf));
};
} | ochrstn/tsed | packages/specs/swagger/src/SwaggerModule.ts | TypeScript |
FunctionDeclaration |
export function makeReleaseConfig(
input: {
templates: types.FilePath[],
prestartCommand: string,
startCommand: string,
stopCommand: string,
configSources?: {[key: string]: types.FilePath},
}
): ReleaseConfig {
return {
templates: input.templates,
prestartCommand: input.prestartCommand,
startCommand: input.startCommand,
stopCommand: input.stopCommand,
configSources: input.configSources === undefined ? {} : input.configSources,
};
} | gmhta/camus2 | test/adl-gen/release.ts | TypeScript |
FunctionDeclaration |
export function texprReleaseConfig(): ADL.ATypeExpr<ReleaseConfig> {
return {value : {typeRef : {kind: "reference", value : snReleaseConfig}, parameters : []}};
} | gmhta/camus2 | test/adl-gen/release.ts | TypeScript |
InterfaceDeclaration | /**
* Configuration for a package to be customized
* when unpacked
*/
export interface ReleaseConfig {
templates: types.FilePath[];
prestartCommand: string;
startCommand: string;
stopCommand: string;
configSources: {[key: string]: types.FilePath};
} | gmhta/camus2 | test/adl-gen/release.ts | TypeScript |
InterfaceDeclaration | // TODO: implement a singleton service adapter
interface ServiceAdapter {
// getServiceName
} | ngetahun/ruby-env | src/interpreter/serviceAdapter/index.ts | TypeScript |
ArrowFunction |
() => {
return null
} | littlekign/ant-design-mobile | src/components/side-bar/side-bar.tsx | TypeScript |
ArrowFunction |
props => {
let firstActiveKey: string | null = null
const items: ReactElement<ComponentProps<typeof SideBarItem>>[] = []
React.Children.forEach(props.children, (child, index) => {
if (!React.isValidElement(child)) return
const key = child.key
if (typeof key !== 'string') return
if (index === 0) {
firstActiveKey = key
}
items.push(child)
})
const [activeKey, setActiveKey] = usePropsValue({
value: props.activeKey,
defaultValue: props.defaultActiveKey ?? firstActiveKey,
onChange: v => {
if (v === null) return
props.onChange?.(v)
},
})
return withNativeProps(
props,
<div className={classPrefix}>
{items.map(item => {
const active = item.key === activeKey
return withNativeProps(
item.props,
<div
key={item.key}
onClick={() | littlekign/ant-design-mobile | src/components/side-bar/side-bar.tsx | TypeScript |
ArrowFunction |
(child, index) => {
if (!React.isValidElement(child)) return
const key = child.key
if (typeof key !== 'string') return
if (index === 0) {
firstActiveKey = key
}
items.push(child)
} | littlekign/ant-design-mobile | src/components/side-bar/side-bar.tsx | TypeScript |
ArrowFunction |
v => {
if (v === null) return
props.onChange?.(v)
} | littlekign/ant-design-mobile | src/components/side-bar/side-bar.tsx | TypeScript |
ArrowFunction |
item => {
const active = item.key === activeKey
return withNativeProps(
item.props,
<div
key={item.key}
onClick={() | littlekign/ant-design-mobile | src/components/side-bar/side-bar.tsx | TypeScript |
TypeAliasDeclaration |
export type SideBarItemProps = {
title?: ReactNode
disabled?: boolean
badge?: ReactNode
} & NativeProps | littlekign/ant-design-mobile | src/components/side-bar/side-bar.tsx | TypeScript |
TypeAliasDeclaration |
export type SideBarProps = {
activeKey?: string | null
defaultActiveKey?: string | null
onChange?: (key: string) => void
} & NativeProps<
'--width' | '--height' | '--item-border-radius' | '--background-color'
> | littlekign/ant-design-mobile | src/components/side-bar/side-bar.tsx | TypeScript |
MethodDeclaration |
classNames(`${classPrefix | littlekign/ant-design-mobile | src/components/side-bar/side-bar.tsx | TypeScript |
ArrowFunction |
() => {
return Joi.array().items(
Joi.object().keys({
fieldname: schemas.fieldname().required(),
filename: schemas.filename().required(),
path: schemas.path().required(),
mimetype: schemas.mimetype(UPLOAD_MIME_TYPE).required(),
size: Joi.number().required(),
owner: Joi.number().required()
})
)
} | Quantum-35/ts-express-typeorm-boilerplate | src/api/validations/document.validation.ts | TypeScript |
ArrowFunction |
() => ID | li-yechao/freeform | packages/server/src/form/schemas/application.schema.ts | TypeScript |
ClassDeclaration |
@ObjectType()
@Schema()
export class Application {
@Field(() => ID)
id!: string
@Prop({ type: mongoose.Schema.Types.ObjectId, required: true })
userId!: string
@Field()
@Prop({ required: true })
createdAt!: number
@Field({ nullable: true })
@Prop()
updatedAt?: number
@Prop()
deletedAt?: number
@Field({ nullable: true })
@Prop()
name?: string
@Field({ nullable: true })
@Prop()
script?: string
} | li-yechao/freeform | packages/server/src/form/schemas/application.schema.ts | TypeScript |
ClassDeclaration |
@ObjectType()
export class ApplicationDepartment {
applicationId!: string
@Field(() => ID)
id!: string
@Field({ nullable: true })
parentId?: string
@Field()
name!: string
} | li-yechao/freeform | packages/server/src/form/schemas/application.schema.ts | TypeScript |
ClassDeclaration |
@ObjectType()
export class ApplicationUser {
applicationId!: string
@Field(() => ID)
id!: string
@Field()
departmentId!: string
@Field()
name!: string
} | li-yechao/freeform | packages/server/src/form/schemas/application.schema.ts | TypeScript |
ClassDeclaration |
@ObjectType()
export class ApplicationDistrict {
applicationId!: string
@Field(() => ID)
id!: string
@Field({ nullable: true })
parentId?: string
@Field()
name!: string
} | li-yechao/freeform | packages/server/src/form/schemas/application.schema.ts | TypeScript |
ClassDeclaration |
@customElement('klinklang-footer')
export class KlinklangFooter extends LitElement {
static get styles (): CSSResultArray {
return [
typography,
css`
:host {
display: block;
max-width: 62.5rem;
margin: 1rem auto;
}
.link {
color: inherit;
text-decoration: none;
}
.link:hover {
text-decoration: underline;
}
`
]
}
render (): TemplateResult {
return html`
<footer class="mdc-typography--body2">
© <a class="link" href="https://wiki.52poke.com/">52Poké Wiki</a>
</footer>
`
}
} | mudkipme/klinklang | packages/klinklang-client/src/components/footer/index.ts | TypeScript |
InterfaceDeclaration |
interface HTMLElementTagNameMap {
'klinklang-footer': KlinklangFooter
} | mudkipme/klinklang | packages/klinklang-client/src/components/footer/index.ts | TypeScript |
MethodDeclaration |
render (): TemplateResult {
return html`
<footer class="mdc-typography--body2">
© <a class="link" href="https://wiki.52poke.com/">52Poké Wiki</a>
</footer>
`
} | mudkipme/klinklang | packages/klinklang-client/src/components/footer/index.ts | TypeScript |
FunctionDeclaration |
export function install(dir = '.husky'): void {
// Ensure that we're inside a git repository
// If git command is not found, status is null and we should return.
// That's why status value needs to be checked explicitly.
if (git(['rev-parse']).status !== 0) {
return
}
// Custom dir help
const url = 'https://git.io/Jc3F9'
// Ensure that we're not trying to install outside of cwd
if (!p.resolve(process.cwd(), dir).startsWith(process.cwd())) {
throw new Error(`.. not allowed (see ${url})`)
}
// Ensure that cwd is git top level
if (!fs.existsSync('.git')) {
throw new Error(`.git can't be found (see ${url})`)
}
try {
// Create .husky/_
fs.mkdirSync(p.join(dir, '_'), { recursive: true })
// Create .husky/_/.gitignore
fs.writeFileSync(p.join(dir, '_/.gitignore'), '*')
// Copy husky.sh to .husky/_/husky.sh
fs.copyFileSync(p.join(__dirname, '../husky.sh'), p.join(dir, '_/husky.sh'))
// Configure repo
const { error } = git(['config', 'core.hooksPath', dir])
if (error) {
throw error
}
} catch (e) {
l('Git hooks failed to install')
throw e
}
l('Git hooks installed')
} | ExternalRepositories/husky | src/index.ts | TypeScript |
FunctionDeclaration |
export function set(file: string, cmd: string): void {
const dir = p.dirname(file)
if (!fs.existsSync(dir)) {
throw new Error(
`can't create hook, ${dir} directory doesn't exist (try running husky install)`,
)
}
fs.writeFileSync(
file,
`#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
${cmd}
`,
{ mode: 0o0755 },
)
l(`created ${file}`)
} | ExternalRepositories/husky | src/index.ts | TypeScript |
FunctionDeclaration |
export function add(file: string, cmd: string): void {
if (fs.existsSync(file)) {
fs.appendFileSync(file, `${cmd}\n`)
l(`updated ${file}`)
} else {
set(file, cmd)
}
} | ExternalRepositories/husky | src/index.ts | TypeScript |
FunctionDeclaration |
export function uninstall(): void {
git(['config', '--unset', 'core.hooksPath'])
} | ExternalRepositories/husky | src/index.ts | TypeScript |
ArrowFunction |
(msg: string): void => console.log(`husky - ${msg}`) | ExternalRepositories/husky | src/index.ts | TypeScript |
ArrowFunction |
(args: string[]): cp.SpawnSyncReturns<Buffer> =>
cp.spawnSync('git', args, { stdio: 'inherit' }) | ExternalRepositories/husky | src/index.ts | TypeScript |
ArrowFunction |
() => {
test('Should accept an initial game grid', () => {
const grid = ['jefblpepre']
const wordSearch = new WordSearch(grid)
expect(wordSearch instanceof WordSearch).toEqual(true)
})
xtest('can accept a target search word', () => {
const grid = ['jefblpepre']
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['glasnost'])).toEqual({ glasnost: undefined })
})
xtest('should locate a word written left to right', () => {
const grid = ['clojurermt']
const expectedResults = {
clojure: {
start: [1, 1],
end: [1, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
})
xtest('can locate a left to right word in a different position', () => {
const grid = ['mtclojurer']
const expectedResults = {
clojure: {
start: [1, 3],
end: [1, 9],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
})
xtest('can locate a different left to right word', () => {
const grid = ['coffeelplx']
const expectedResults = {
coffee: {
start: [1, 1],
end: [1, 6],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['coffee'])).toEqual(expectedResults)
})
xtest('can locate that different left to right word in a different position', () => {
const grid = ['xcoffeezlp']
const expectedResults = {
coffee: {
start: [1, 2],
end: [1, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['coffee'])).toEqual(expectedResults)
})
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['jefblpepre']
const wordSearch = new WordSearch(grid)
expect(wordSearch instanceof WordSearch).toEqual(true)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['jefblpepre']
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['glasnost'])).toEqual({ glasnost: undefined })
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['clojurermt']
const expectedResults = {
clojure: {
start: [1, 1],
end: [1, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['mtclojurer']
const expectedResults = {
clojure: {
start: [1, 3],
end: [1, 9],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['coffeelplx']
const expectedResults = {
coffee: {
start: [1, 1],
end: [1, 6],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['coffee'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['xcoffeezlp']
const expectedResults = {
coffee: {
start: [1, 2],
end: [1, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['coffee'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
xtest('can locate a left to right word in a two line grid', () => {
const grid = ['jefblpepre', 'clojurermt']
const expectedResults = {
clojure: {
start: [2, 1],
end: [2, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
})
xtest('can locate a left to right word in a different position in a two line grid', () => {
const grid = ['jefblpepre', 'tclojurerm']
const expectedResults = {
clojure: {
start: [2, 2],
end: [2, 8],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
})
xtest('can locate a left to right word in a three line grid', () => {
const grid = ['camdcimgtc', 'jefblpepre', 'clojurermt']
const expectedResults = {
clojure: {
start: [3, 1],
end: [3, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
})
xtest('can locate a left to right word in a ten line grid', () => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'jalaycalmp',
'clojurermt',
]
const expectedResults = {
clojure: {
start: [10, 1],
end: [10, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
})
xtest('can locate a left to right word in a different position in a ten line grid', () => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'clojurermt',
'jalaycalmp',
]
const expectedResults = {
clojure: {
start: [9, 1],
end: [9, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
})
xtest('can locate a different left to right word in a ten line grid', () => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'clojurermt',
'jalaycalmp',
]
const expectedResults = {
scree: {
start: [7, 1],
end: [7, 5],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['scree'])).toEqual(expectedResults)
})
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['jefblpepre', 'clojurermt']
const expectedResults = {
clojure: {
start: [2, 1],
end: [2, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['jefblpepre', 'tclojurerm']
const expectedResults = {
clojure: {
start: [2, 2],
end: [2, 8],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['camdcimgtc', 'jefblpepre', 'clojurermt']
const expectedResults = {
clojure: {
start: [3, 1],
end: [3, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'jalaycalmp',
'clojurermt',
]
const expectedResults = {
clojure: {
start: [10, 1],
end: [10, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'clojurermt',
'jalaycalmp',
]
const expectedResults = {
clojure: {
start: [9, 1],
end: [9, 7],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'clojurermt',
'jalaycalmp',
]
const expectedResults = {
scree: {
start: [7, 1],
end: [7, 5],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['scree'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
xtest('can find two words written left to right', () => {
const grid = [
'aefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'jalaycalmp',
'clojurermt',
'xjavamtzlp',
]
const expectedResults = {
clojure: {
start: [10, 1],
end: [10, 7],
},
java: {
start: [11, 2],
end: [11, 5],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['java', 'clojure'])).toEqual(expectedResults)
})
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = [
'aefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'jalaycalmp',
'clojurermt',
'xjavamtzlp',
]
const expectedResults = {
clojure: {
start: [10, 1],
end: [10, 7],
},
java: {
start: [11, 2],
end: [11, 5],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['java', 'clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
xtest('should locate a single word written right to left', () => {
const grid = ['rixilelhrs']
const expectedResults = {
elixir: {
start: [1, 6],
end: [1, 1],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['elixir'])).toEqual(expectedResults)
})
xtest('should locate multiple words written in different horizontal directions', () => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'jalaycalmp',
'clojurermt',
]
const expectedResults = {
clojure: {
start: [10, 1],
end: [10, 7],
},
elixir: {
start: [5, 6],
end: [5, 1],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['elixir', 'clojure'])).toEqual(expectedResults)
})
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = ['rixilelhrs']
const expectedResults = {
elixir: {
start: [1, 6],
end: [1, 1],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['elixir'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'jalaycalmp',
'clojurermt',
]
const expectedResults = {
clojure: {
start: [10, 1],
end: [10, 7],
},
elixir: {
start: [5, 6],
end: [5, 1],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['elixir', 'clojure'])).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'jalaycalmp',
'clojurermt',
]
const expectedResults = {
clojure: {
start: [10, 1],
end: [10, 7],
},
elixir: {
start: [5, 6],
end: [5, 1],
},
ecmascript: {
start: [1, 10],
end: [10, 10],
},
}
const wordSearch = new WordSearch(grid)
expect(wordSearch.find(['elixir', 'clojure', 'ecmascript'])).toEqual(
expectedResults
)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |
ArrowFunction |
() => {
const grid = [
'jefblpepre',
'camdcimgtc',
'oivokprjsm',
'pbwasqroua',
'rixilelhrs',
'wolcqlirpc',
'screeaumgr',
'alxhpburyi',
'jalaycalmp',
'clojurermt',
]
const expectedResults = {
clojure: {
start: [10, 1],
end: [10, 7],
},
elixir: {
start: [5, 6],
end: [5, 1],
},
ecmascript: {
start: [1, 10],
end: [10, 10],
},
rust: {
start: [5, 9],
end: [2, 9],
},
}
const wordSearch = new WordSearch(grid)
expect(
wordSearch.find(['elixir', 'clojure', 'ecmascript', 'rust'])
).toEqual(expectedResults)
} | ErikSchierboom/exercism | typescript/word-search/word-search.test.ts | TypeScript |