type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
player => { scores.push({ id: player.id.current, level: player.level.current, score: player.score.current, kills: player.kills.current, deaths: player.deaths.current, damage: player.damage.current, ping: player.ping.current, } as ServerPackets.ScoreDe...
BlackCrawler/ab-server
src/server/modes/ffa/responses/score-detailed.ts
TypeScript
ArrowFunction
(p1, p2) => p1.score - p2.score
BlackCrawler/ab-server
src/server/modes/ffa/responses/score-detailed.ts
TypeScript
ClassDeclaration
export default class ScoreDetailed extends System { constructor({ app }) { super({ app }); this.listeners = { [RESPONSE_SCORE_DETAILED]: this.onScoreDetailed, }; } /** * FFA scores. * Sent in response to a client request. * * @param connectionId player connection id */ onScor...
BlackCrawler/ab-server
src/server/modes/ffa/responses/score-detailed.ts
TypeScript
MethodDeclaration
/** * FFA scores. * Sent in response to a client request. * * @param connectionId player connection id */ onScoreDetailed(connectionId: MainConnectionId): void { const scores = []; this.storage.playerList.forEach(player => { scores.push({ id: player.id.current, level: playe...
BlackCrawler/ab-server
src/server/modes/ffa/responses/score-detailed.ts
TypeScript
ArrowFunction
() => { it("should throw an exception if config is missing", () => { const init = () => IO.create(fakeConfigPath, fakeFS); expect(init).toThrow(); }); it("should return assets generation input", () => { const io = IO.create(realConfigPath, fakeFS); const input = io.getAssetsGenerationInput(); ...
re-ce/rececss
packages/rececss-core/src/4_infrastructures/io/ConfigFileSystemIO.test.ts
TypeScript
ArrowFunction
() => { const init = () => IO.create(fakeConfigPath, fakeFS); expect(init).toThrow(); }
re-ce/rececss
packages/rececss-core/src/4_infrastructures/io/ConfigFileSystemIO.test.ts
TypeScript
ArrowFunction
() => IO.create(fakeConfigPath, fakeFS)
re-ce/rececss
packages/rececss-core/src/4_infrastructures/io/ConfigFileSystemIO.test.ts
TypeScript
ArrowFunction
() => { const io = IO.create(realConfigPath, fakeFS); const input = io.getAssetsGenerationInput(); expect.assertions(3); expect(input.rulesets.length).not.toBe(0); expect(input.splitByMedia).toBe(false); expect(input.media).toEqual({ md: "only screen and (min-width: 768px)", lg: "on...
re-ce/rececss
packages/rececss-core/src/4_infrastructures/io/ConfigFileSystemIO.test.ts
TypeScript
ArrowFunction
() => { const io = IO.create(realConfigPath, fakeFS); const input = io.getAssetsGenerationProps(); expect(input).toEqual({ stylesheetProps: { filename: "rececss", extension: "css" }, rulesetProps: { prefixSep: ":", suffixSep: ":" }, }); }
re-ce/rececss
packages/rececss-core/src/4_infrastructures/io/ConfigFileSystemIO.test.ts
TypeScript
ArrowFunction
() => { const io = IO.create(realConfigPath, fakeFS); const input = io.getCSSProccesorInput(); expect(input).toEqual({ content: ["./website/pages/**/*.js"] }); }
re-ce/rececss
packages/rececss-core/src/4_infrastructures/io/ConfigFileSystemIO.test.ts
TypeScript
ArrowFunction
() => { const io = IO.create(realConfigPath, fakeFS); io.outputAssets([{ name: "some", contents: "contents" }]); expect(fakeFS.writeFiles).toHaveBeenCalledWith([ { path: path.join("./website/styles", "some"), contents: "contents" }, ]); }
re-ce/rececss
packages/rececss-core/src/4_infrastructures/io/ConfigFileSystemIO.test.ts
TypeScript
ArrowFunction
(state = initialState, action: FluxStandardAction) => { switch (action.type) { case LOGIN_REQUEST: return { ...state, email: action.payload.credentials.email, isFetching: true, error: null, }; case LOGIN_SUCCESS: return { ...state, isFetching...
feather-alex/website-gatsby
src/oldPages/auth/login/store/login.reducer.ts
TypeScript
FunctionDeclaration
export async function getDiaryEmotions({ year, month }: GetDiaryEmotionsProps) { const tmpDiaryEmotionList: Array<DiaryEmotion | undefined> = [ ...Array(31), ].map((value, index) => index < new Date().getDate() + 1 ? { id: index, emotionColor: EMOTION_COLOR.BLUE, created...
gdsc-ssu/greener-client
src/logics/server/diary.ts
TypeScript
FunctionDeclaration
export async function getDiary(diaryId: number) { const tmpDiary: Diary = { emotionColor: EMOTION_COLOR.GREEN, emotionJournal: '', createdAt: new Date(), }; return tmpDiary; }
gdsc-ssu/greener-client
src/logics/server/diary.ts
TypeScript
FunctionDeclaration
export async function postDiary(diary: string) { const tmpDiary: Diary = { emotionColor: EMOTION_COLOR.GREEN, emotionJournal: diary, createdAt: new Date(), }; return tmpDiary; }
gdsc-ssu/greener-client
src/logics/server/diary.ts
TypeScript
ArrowFunction
(value, index) => index < new Date().getDate() + 1 ? { id: index, emotionColor: EMOTION_COLOR.BLUE, createdAt: new Date(year, month, index + 1), } : undefined
gdsc-ssu/greener-client
src/logics/server/diary.ts
TypeScript
InterfaceDeclaration
interface GetDiaryEmotionsProps { year: number; month: number; }
gdsc-ssu/greener-client
src/logics/server/diary.ts
TypeScript
FunctionDeclaration
// ----------------------- local functions ------------------------- // function __getLookups(fieldsInQueryMap: Map<string, SFieldDescribe>): Map<string, string[]> { const m: Map<string, string[]> = new Map<string, string[]>(); fieldsInQueryMap.forEach(field => { if (field.referencedObjectType) { ...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
FunctionDeclaration
// ----------------- Helpers ---------------------------- // function __addScriptObject(script: ISfdmuRunScript, object: ISfdmuRunScriptObject): { object: ISfdmuRunScriptObject, parsedQuery: Query } { let newObject = script.addScriptObject({ objectName: object.objectName, operation...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
field => { let task = job.tasks.find(task => task.sObjectName == field.sourceObject); if (!task) { this.runtime.logFormattedInfo(this, SFDMU_RUN_ADDON_MESSAGES.RecordsTransform_SourceTaskNotFound, field.sourceField, field.sourceObject); } else { ...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
task => task.sObjectName == field.sourceObject
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
transformation => { let task = job.tasks.find(task => task.sObjectName == transformation.targetObject); if (!task) { this.runtime.logFormattedInfo(this, SFDMU_RUN_ADDON_MESSAGES.RecordsTransform_TargetFieldNotFound, transformation.targetField, transformatio...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
task => task.sObjectName == transformation.targetObject
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
(transformation: ITransformation) => { let targetRecords = transformation.targetTask.sourceTaskData.records; targetRecords.forEach(targetRecord => { let formula = {}; // Generate formula properties for further eval() on the targetRecord fieldsMap.forEach((field: IField...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
targetRecord => { let formula = {}; // Generate formula properties for further eval() on the targetRecord fieldsMap.forEach((field: IField) => { if (transformation.targetObject == field.sourceObject) { // The same object => direct transformation: ...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
(field: IField) => { if (transformation.targetObject == field.sourceObject) { // The same object => direct transformation: // source field => target field on the same targetRecord formula[field.alias] = targetRecord[field.sourceField]; } else { ...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
sourceIdField => { let sourceId = targetRecord[sourceIdField]; let sourceRecord = field.sourceTask.sourceTaskData.idRecordsMap.get(sourceId); if (sourceRecord) { formula[field.alias] = sourceRecord[field.sourceField]; } ...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
fieldName => { return sourceRecord[fieldName] == targetId; }
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
expression => eval(expression)
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
(transformation: ITransformation) => { let targetRecords = transformation.targetTask.sourceTaskData.records; transformation.targetTask.mapRecords(targetRecords); }
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
field => { if (field.referencedObjectType) { m.set(field.referencedObjectType, (m.get(field.referencedObjectType) || []).concat(field.name)); } }
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
object => { return { object, parsedQuery: parseQuery(object.query) }; }
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
field => { let object = objects.find(ob => ob.parsedQuery.sObject == field.sourceObject); if (!object) { object = __addScriptObject(script, { objectName: field.sourceObject, operation: OPERATION.Readonly }); objects.push(object); } Common.addOrRemov...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
ob => ob.parsedQuery.sObject == field.sourceObject
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
field => { if (field) { let parts = field.split('.'); if (parts.length == 1) { Common.addOrRemoveQueryFields(object.parsedQuery, [field]); } else { let obj = objects.find(ob => ob.parsedQuery.sObject == parts[0]); if (!obj) { ...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
ob => ob.parsedQuery.sObject == parts[0]
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
transformation => { let object = objects.find(ob => ob.parsedQuery.sObject == transformation.targetObject); if (!object) { object = __addScriptObject(script, { objectName: transformation.targetObject, operation: OPERATION.Readonly }); objects.push(object); ...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
ob => ob.parsedQuery.sObject == transformation.targetObject
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
object => object.name == transformation.targetObject
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
ArrowFunction
object => { object.object.query = composeQuery(object.parsedQuery); }
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
InterfaceDeclaration
interface ITransformation { // Original ----- targetObject: string targetField: string, formula: string, includeLookupFields: Array<string>, expressions: Array<string>, // Runtime ------ targetTask: SfdmuRunAddonTask, targetSFieldDescribe: SFieldDescribe, lookupFieldMap: Map<string, string[]> // ...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
InterfaceDeclaration
interface IField { // Original ----- alias: string, sourceObject: string, sourceField: string, includeLookupFields: Array<string>, // Runtime ------ sourceTask: SfdmuRunAddonTask, sourceSFieldDescribe: SFieldDescribe, lookupFieldMap: Map<string, string[]> // referenced object => child id fields }
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
InterfaceDeclaration
interface IOnExecuteArguments { fields: Array<IField>; transformations: Array<ITransformation>; }
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
MethodDeclaration
async onExecute(context: IAddonContext, args: IOnExecuteArguments): Promise<AddonResult> { this.runtime.logAddonExecutionStarted(this); // Verify current event if (!this.runtime.validateSupportedEvents(this, CONST.SUPPORTED_EVENTS)) { this.runtime.logFormattedWarning(this, SFDMU_RUN_ADDON_M...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
MethodDeclaration
async onInit(context: IAddonContext, args: IOnExecuteArguments): Promise<AddonResult> { let script = this.runtime.getScript(); // Add all extra fields used in the all transformation to the original query string let objects = script.objects.map(object => { return { object, parsedQuer...
dxatscale/SFDX-Data-Move-Utility
src/addons/modules/sfdmu-run/RecordsTransform/index.ts
TypeScript
InterfaceDeclaration
/** * @class IBaseModelOptions * @interface */ export interface IBaseModelOptions { /** * @property expand * @type {boolean} */ expand?: boolean; }
ccheney/sjs-base-model
src/IBaseModelOptions.ts
TypeScript
FunctionDeclaration
export function BulletItem(props: BulletItemProps) { return ( <View style={BULLET_ITEM}> <Icon icon="bullet" containerStyle={BULLET_CONTAINER} style={BULLET} /> <Text style={BULLET_TEXT} text={props.text} /> </View> ) }
ankurdaharwal/aayworks
packages/app/app/components/bullet-item/bullet-item.tsx
TypeScript
InterfaceDeclaration
export interface BulletItemProps { text: string }
ankurdaharwal/aayworks
packages/app/app/components/bullet-item/bullet-item.tsx
TypeScript
ClassDeclaration
export class AccountPom { constructor(private page: Page) {} async navigateTo() { await this.page.goto(`${process.env.WEBSITE_PATH}/dashboard/account`); } async verifyEmailShown(value: string) { await expect(this.page.locator("[test='email']")).toContainText(value); } async verifyCreationDate(va...
loanMaster/inheritwebapp
tests/poms/account.pom.ts
TypeScript
MethodDeclaration
async navigateTo() { await this.page.goto(`${process.env.WEBSITE_PATH}/dashboard/account`); }
loanMaster/inheritwebapp
tests/poms/account.pom.ts
TypeScript
MethodDeclaration
async verifyEmailShown(value: string) { await expect(this.page.locator("[test='email']")).toContainText(value); }
loanMaster/inheritwebapp
tests/poms/account.pom.ts
TypeScript
MethodDeclaration
async verifyCreationDate(value: string) { await expect(this.page.locator("[test='member-since']")).toContainText( value ); }
loanMaster/inheritwebapp
tests/poms/account.pom.ts
TypeScript
MethodDeclaration
async resetPassword() { await this.page.click("[test='reset-password']"); }
loanMaster/inheritwebapp
tests/poms/account.pom.ts
TypeScript
MethodDeclaration
async verifySuccessMsgShown() { await expect( this.page.locator("[test='reset-pw-success-msg']") ).toBeVisible(); }
loanMaster/inheritwebapp
tests/poms/account.pom.ts
TypeScript
ArrowFunction
(_to, _from, next) => { if (this.changed) { if ( !window.confirm( this.$gettext(`Are you sure you want to discard your unsaved changes?`) ) ) { return next(false); } } next(); }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
ArrowFunction
i => i === error
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
ArrowFunction
() => { this.state.isShowingSuccess = false; this.successClearTimeout = undefined; }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
ClassDeclaration
@Component({ components: { ...CommonFormComponents, }, }) export class BaseForm<T> extends Vue { @Prop(Object) model?: Readonly<T>; formModel: Readonly<T> = {} as T; modelClass?: { new (data?: T): T } = undefined; resetOnSubmit = false; warnOnDiscard = true; saveMethod?: keyof T; method: 'add'...
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
InterfaceDeclaration
export interface FormOnInit { onInit(): void; }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
InterfaceDeclaration
export interface FormOnBeforeSubmit { onBeforeSubmit(): void; }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
InterfaceDeclaration
export interface FormOnSubmit { onSubmit(): Promise<any>; }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
InterfaceDeclaration
export interface FormOnLoad { readonly loadUrl: string; readonly loadData?: any; onLoad(response: any): void; }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
InterfaceDeclaration
export interface FormOnSubmitSuccess { onSubmitSuccess(response: any): void; }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
InterfaceDeclaration
export interface FormOnSubmitError { onSubmitError(response: any): void; }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
created() { this.privateInit(); }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
mounted() { if (!this.warnOnDiscard) { return; } this.changeDeregister = this.$router.beforeEach((_to, _from, next) => { if (this.changed) { if ( !window.confirm( this.$gettext(`Are you sure you want to discard your unsaved changes?`) ) ) { return next(false); ...
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
destroyed() { if (this.changeDeregister) { this.changeDeregister(); this.changeDeregister = undefined; } }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
private privateInit() { // Is a base model defined? If so, then we're editing. if (this.model) { this.method = 'edit'; // If a model class was assigned to this form, then create a copy of // it on the instance. Otherwise just copy the object. if (this.modelClass) { this.formModel = new thi...
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
private async _load() { if (this.isLoaded && !this.reloadOnSubmit) { return; } this.isLoaded = null; if (!this.loadUrl) { return; } this.isLoaded = false; const payload = await Api.sendRequest(this.loadUrl, this.loadData || undefined, { detach: true, }); this.isLoaded = t...
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
/** * When setting form model field values we need to make sure Vue knows that * the field has changed. This ensures that we always let Vue know any time * we change a field. */ setField<K extends keyof T>(key: K, value: T[K]) { Vue.set(this.formModel as any, key as any, value); }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
setCustomError(error: string) { this.customErrors.push(error); this.customErrors = arrayUnique(this.customErrors); }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
clearCustomError(error: string) { arrayRemove(this.customErrors, i => i === error); }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
hasCustomError(error: string) { return this.customErrors.indexOf(error) !== -1; }
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
async _onSubmit() { if (this.state.isProcessing) { return false; } this.state.isProcessing = true; let response: any; try { if ((this as any).onBeforeSubmit) { (this as any).onBeforeSubmit(); } if ((this as any).onSubmit) { const _response = await (this as any).onSubmit...
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
MethodDeclaration
private _showSuccess() { // Reset the timeout if it's already showing. if (this.successClearTimeout) { clearTimeout(this.successClearTimeout); } this.state.isShowingSuccess = true; this.successClearTimeout = setTimeout(() => { this.state.isShowingSuccess = false; this.successClearTimeout...
MagmaRat-Studios/cindergames
src/_common/form-vue/form.service.ts
TypeScript
ArrowFunction
() => { this.isLoading = true; storage .ref("menus") .child(this.filename) .getDownloadURL() .then( action((url: string) => { this.imageURL = url; this.isLoading = false; }) ) .catch( action((error: Error) => { this.isExi...
ohing504/echo-menu
src/stores/menuStore.ts
TypeScript
ArrowFunction
(url: string) => { this.imageURL = url; this.isLoading = false; }
ohing504/echo-menu
src/stores/menuStore.ts
TypeScript
ArrowFunction
(error: Error) => { this.isExist = false; this.isLoading = false; }
ohing504/echo-menu
src/stores/menuStore.ts
TypeScript
ClassDeclaration
class MenuStore implements IMenuStore { public rootStore; @observable public isLoading; @observable public isExist; @observable public imageURL; private filename = utils.getWeekNumber().join("-"); constructor(rootStore) { this.rootStore = rootStore; this.isLoading = false; this.isExi...
ohing504/echo-menu
src/stores/menuStore.ts
TypeScript
InterfaceDeclaration
export interface SwitchProps extends StandardProps<SwitchBaseProps, SwitchClassKey, 'checkedIcon' | 'color' | 'icon'> { checkedIcon?: React.ReactNode; color?: 'primary' | 'secondary' | 'default'; icon?: React.ReactNode; }
agentdavidjoseph/material-ui
src/Switch/Switch.d.ts
TypeScript
TypeAliasDeclaration
export type SwitchClassKey = | SwitchBaseClassKey | 'bar' | 'icon' | 'iconChecked' | 'checkedPrimary' | 'checkedSecondary';
agentdavidjoseph/material-ui
src/Switch/Switch.d.ts
TypeScript
ClassDeclaration
/** @soyCompatible */ @customElement('mwc-checkbox') export class Checkbox extends CheckboxBase { static override styles = [styles]; }
hello-smile6/material-web
packages/checkbox/mwc-checkbox.ts
TypeScript
InterfaceDeclaration
interface HTMLElementTagNameMap { 'mwc-checkbox': Checkbox; }
hello-smile6/material-web
packages/checkbox/mwc-checkbox.ts
TypeScript
ClassDeclaration
export default class MockBridgePlugin extends BridgePlugin { private host?: string; public async init(getPlugin: GetPlugin) { const configPlugin = getPlugin(ConfigPlugin) as ConfigPlugin<IConfig>; this.host = configPlugin.get('bridgeMockServerHost'); } public destroy() {} // my.xxx public async ...
TNGD-YQ/goldfish
packages/plugins/src/MockBridgePlugin.ts
TypeScript
MethodDeclaration
public async init(getPlugin: GetPlugin) { const configPlugin = getPlugin(ConfigPlugin) as ConfigPlugin<IConfig>; this.host = configPlugin.get('bridgeMockServerHost'); }
TNGD-YQ/goldfish
packages/plugins/src/MockBridgePlugin.ts
TypeScript
MethodDeclaration
public destroy() {}
TNGD-YQ/goldfish
packages/plugins/src/MockBridgePlugin.ts
TypeScript
MethodDeclaration
// my.xxx public async call< T extends keyof R, R extends Record<string, any> = BridgeMethods & SpecialMethods, >( api: T, params?: Parameters<R[T]>[0], ) { return this.host ? bridge.call(this.host, api, params) : super.call(api, params); }
TNGD-YQ/goldfish
packages/plugins/src/MockBridgePlugin.ts
TypeScript
MethodDeclaration
// my.call('xxx') public async mycall<R, P = Record<string, any>>( api: string, params?: P extends Record<string, any> ? P : Record<string, any> | ((...args: any[]) => void), ) { return this.host ? bridge.mycall(this.host, api, params) : super.mycall(api, params); }
TNGD-YQ/goldfish
packages/plugins/src/MockBridgePlugin.ts
TypeScript
MethodDeclaration
// my.ap.xxx public async ap< T extends keyof R, R extends Record<string, Fn> = APBridgeMethods >( api: T, params?: Parameters<R[T]>[0], ) { return this.host ? bridge.ap(this.host, api, params) : super.ap(api, params); }
TNGD-YQ/goldfish
packages/plugins/src/MockBridgePlugin.ts
TypeScript
ArrowFunction
() => { test.each(testCases)( `given %o as query object, the result should be %o`, async (query: string, expectedResult: Record<string, number>) => { expect(makeSortQuery(query)).toEqual(expectedResult); } ); }
JoseMarshall/job-rest-api
job-service/src/main/external/repositories/mongodb/helpers/__tests__/make-sort-query.test.ts
TypeScript
ArrowFunction
async (query: string, expectedResult: Record<string, number>) => { expect(makeSortQuery(query)).toEqual(expectedResult); }
JoseMarshall/job-rest-api
job-service/src/main/external/repositories/mongodb/helpers/__tests__/make-sort-query.test.ts
TypeScript
ArrowFunction
() => { let service: EventsHubService; beforeEach(() => { TestBed.configureTestingModule({}); service = TestBed.inject(EventsHubService); }); it('should be created', () => { expect(service).toBeTruthy(); }); }
Oxagarh/angularized
src/app/core/services/events-hub/events-hub.service.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({}); service = TestBed.inject(EventsHubService); }
Oxagarh/angularized
src/app/core/services/events-hub/events-hub.service.spec.ts
TypeScript
FunctionDeclaration
export function plugin(initializerContext: PluginInitializerContext) { return new Plugin(initializerContext); }
AMoo-Miki/OpenSearch-Dashboards
src/plugins/vis_type_vislib/public/index.ts
TypeScript
ArrowFunction
({ key, value }) => { if (this.ready) { this.storedData[key] = value; this.syncData(key, value); } }
ringcentral/ringcentral-js-widgets
packages/ringcentral-integration/modules/GlobalStorageV2/GlobalStorage.ts
TypeScript
ClassDeclaration
@Module({ name: 'GlobalStorage', deps: [{ dep: 'GlobalStorageOptions', optional: true }], }) export class GlobalStorage extends StorageBase<Deps> { protected _storage: IStorage; protected _storageHandler: ({ key, value, }: { key: string; value: unknown; }) => void = null; constructor(dep...
ringcentral/ringcentral-js-widgets
packages/ringcentral-integration/modules/GlobalStorageV2/GlobalStorage.ts
TypeScript
MethodDeclaration
onStateChange() { if (this.ready) { const currentData = this.data; // save new data to storage when changed for (const key in currentData) { if (this.storedData[key] !== currentData[key]) { this._storage.setItem(key, currentData[key]); this.storedData[key] = currentDat...
ringcentral/ringcentral-js-widgets
packages/ringcentral-integration/modules/GlobalStorageV2/GlobalStorage.ts
TypeScript
MethodDeclaration
async onInit() { const storageKey = `${this.prefix ? `${this.prefix}-` : ''}GlobalStorage`; this._storage = new this._StorageProvider({ storageKey, }); this.storedData = await this._storage.getData(); for (const key in this.storedData) { if (!this._storageReducers[key]) { delete...
ringcentral/ringcentral-js-widgets
packages/ringcentral-integration/modules/GlobalStorageV2/GlobalStorage.ts
TypeScript
MethodDeclaration
onInitSuccess() { this._storageHandler = ({ key, value }) => { if (this.ready) { this.storedData[key] = value; this.syncData(key, value); } }; this._storage.on('storage', this._storageHandler); }
ringcentral/ringcentral-js-widgets
packages/ringcentral-integration/modules/GlobalStorageV2/GlobalStorage.ts
TypeScript
ArrowFunction
async () => { console.log('Publisher successfully connected to NATS'); const publisher = new TicketCreatedPublisher(client); try { await publisher.publish({ id: '123', title: 'Aditya Test Concert Ticket', price: 20, }); } catch (err) { conso...
aditya43/microservices-applications
12-Connecting-NATS-In-NodeJS/nats-test-project/src/publisher.ts
TypeScript