type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
() => {
let component: ReportInventoryPage;
let fixture: ComponentFixture<ReportInventoryPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReportInventoryPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReportInventoryPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
} | Subdy/Viethas-sales | src/app/pages/report/report-inventory/report-inventory.page.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({
declarations: [ ReportInventoryPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
} | Subdy/Viethas-sales | src/app/pages/report/report-inventory/report-inventory.page.spec.ts | TypeScript |
ArrowFunction |
() => {
fixture = TestBed.createComponent(ReportInventoryPage);
component = fixture.componentInstance;
fixture.detectChanges();
} | Subdy/Viethas-sales | src/app/pages/report/report-inventory/report-inventory.page.spec.ts | TypeScript |
InterfaceDeclaration |
interface IntrinsicAttributes {
isToggled?: boolean;
onClick?: (any?) => void;
} | juliusrajala/jouluristeily.com | types.d.ts | TypeScript |
FunctionDeclaration |
export function expectArraysClose(
actual: Tensor|TypedArray|number[],
expected: Tensor|TypedArray|number[]|boolean[], epsilon = TEST_EPSILON) {
if (!(actual instanceof Tensor) && !(expected instanceof Tensor)) {
const aType = actual.constructor.name;
const bType = expected.constructor.name;
if (aType !== bType) {
throw new Error(
`Arrays are of different type actual: ${aType} ` +
`vs expected: ${bType}`);
}
} else if (actual instanceof Tensor && expected instanceof Tensor) {
if (actual.dtype !== expected.dtype) {
throw new Error(
`Arrays are of different type actual: ${actual.dtype} ` +
`vs expected: ${expected.dtype}.`);
}
if (!util.arraysEqual(actual.shape, expected.shape)) {
throw new Error(
`Arrays are of different shape actual: ${actual.shape} ` +
`vs expected: ${expected.shape}.`);
}
}
let actualValues: TypedArray|number[];
let expectedValues: TypedArray|number[]|boolean[];
if (actual instanceof Tensor) {
actualValues = actual.dataSync();
} else {
actualValues = actual;
}
if (expected instanceof Tensor) {
expectedValues = expected.dataSync();
} else {
expectedValues = expected;
}
if (actualValues.length !== expectedValues.length) {
throw new Error(
`Arrays have different lengths actual: ${actualValues.length} vs ` +
`expected: ${expectedValues.length}.\n` +
`Actual: ${actualValues}.\n` +
`Expected: ${expectedValues}.`);
}
for (let i = 0; i < expectedValues.length; ++i) {
const a = actualValues[i];
const e = expectedValues[i];
if (!areClose(a, Number(e), epsilon)) {
throw new Error(
`Arrays differ: actual[${i}] = ${a}, expected[${i}] = ${e}.\n` +
`Actual: ${actualValues}.\n` +
`Expected: ${expectedValues}.`);
}
}
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
FunctionDeclaration |
export function expectArraysEqual(
actual: Tensor|TypedArray|number[],
expected: Tensor|TypedArray|number[]|boolean[]) {
return expectArraysClose(actual, expected, 0);
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
FunctionDeclaration |
export function expectNumbersClose(
a: number, e: number, epsilon = TEST_EPSILON) {
if (!areClose(a, e, epsilon)) {
throw new Error(`Numbers differ: actual === ${a}, expected === ${e}`);
}
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
FunctionDeclaration |
function areClose(a: number, e: number, epsilon: number): boolean {
if (isNaN(a) && isNaN(e)) {
return true;
}
if (isNaN(a) || isNaN(e) || Math.abs(a - e) > epsilon) {
return false;
}
return true;
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
FunctionDeclaration |
export function expectValuesInRange(
actual: Tensor|TypedArray|number[], low: number, high: number) {
let actualVals: TypedArray|number[];
if (actual instanceof Tensor) {
actualVals = actual.dataSync();
} else {
actualVals = actual;
}
for (let i = 0; i < actualVals.length; i++) {
if (actualVals[i] < low || actualVals[i] > high) {
throw new Error(
`Value out of range:${actualVals[i]} low: ${low}, high: ${high}`);
}
}
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
FunctionDeclaration |
export function describeWithFlags(
name: string, featuresList: Features[], tests: () => void) {
featuresList.forEach(features => {
const testName = name + ' ' + JSON.stringify(features);
executeTests(testName, tests, features);
});
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
FunctionDeclaration |
function executeTests(
testName: string, tests: () => void, features?: Features) {
describe(testName, () => {
beforeEach(() => {
ENV.setFeatures(features || {});
ENV.addCustomBackend('webgl', () => new MathBackendWebGL());
ENV.addCustomBackend('cpu', () => new MathBackendCPU());
if (features && features.BACKEND != null) {
Environment.setBackend(features.BACKEND);
}
ENV.engine.startScope();
});
afterEach(() => {
ENV.engine.endScope(null);
ENV.reset();
});
tests();
});
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
FunctionDeclaration |
export function assertIsNan(val: number, dtype: DataType) {
if (!util.isValNaN(val, dtype)) {
throw new Error(`Value ${val} does not represent NaN for dtype ${dtype}`);
}
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
ArrowFunction |
features => {
const testName = name + ' ' + JSON.stringify(features);
executeTests(testName, tests, features);
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
ArrowFunction |
() => {
beforeEach(() => {
ENV.setFeatures(features || {});
ENV.addCustomBackend('webgl', () => new MathBackendWebGL());
ENV.addCustomBackend('cpu', () => new MathBackendCPU());
if (features && features.BACKEND != null) {
Environment.setBackend(features.BACKEND);
}
ENV.engine.startScope();
});
afterEach(() => {
ENV.engine.endScope(null);
ENV.reset();
});
tests();
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
ArrowFunction |
() => {
ENV.setFeatures(features || {});
ENV.addCustomBackend('webgl', () => new MathBackendWebGL());
ENV.addCustomBackend('cpu', () => new MathBackendCPU());
if (features && features.BACKEND != null) {
Environment.setBackend(features.BACKEND);
}
ENV.engine.startScope();
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
ArrowFunction |
() => new MathBackendWebGL() | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
ArrowFunction |
() => new MathBackendCPU() | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
ArrowFunction |
() => {
ENV.engine.endScope(null);
ENV.reset();
} | Acidburn0zzz/deeplearnjs | src/test_util.ts | TypeScript |
ArrowFunction |
() => {
return (
<div className="text-center">
<Button type="primary">Button</Button>
</div> | joey2217/react-paint-app | src/App.tsx | TypeScript |
InterfaceDeclaration |
export interface INumberFormatOptions extends NumberFormatOptions {
compactDisplay?: INumberFormatCompactDisplay;
currency?: INumberFormatCurrency;
currencyDisplay?: INumberFormatCurrencyDisplay;
currencySign?: INumberFormatCurrencySign;
localeMatcher?: INumberFormatLocaleMatcher;
notation?: INumberFormatNotation;
numberingSystem?: INumberFormatNumberingSystem;
signDisplay?: INumberFormatSignDisplay;
style?: INumberFormatStyle;
unit?: INumberFormatUnit;
unitDisplay?: INumberFormatUnitDisplay;
useGrouping?: boolean;
minimumIntegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
} | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
export type INumberFormatCompactDisplay = 'short' | 'long'; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatCurrency = string; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatCurrencyDisplay = 'symbol' | 'narrowSymbol' | 'code' | 'name'; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatCurrencySign = 'accounting' | 'standard'; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatLocaleMatcher = ILocaleMatcher; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatNotation = 'standard' | 'scientific' | 'engineering' | 'compact'; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatNumberingSystem = INumberingSystem; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatSignDisplay = 'auto' | 'never' | 'always' | 'exceptZero'; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatStyle = 'decimal' | 'currency' | 'percent' | 'unit'; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatUnit = string; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatUnitDisplay = 'long' | 'short' | 'narrow'; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
TypeAliasDeclaration |
export type INumberFormatValue = number | bigint; | lifaon74/common-classes | src/debug/observables-v5/i18n/number-format/number-format.type.ts | TypeScript |
ArrowFunction |
() => {
const { theme, setTheme } = useTheme()
const {
color: { bg, fg, primary, secondary },
} = theme
const setGrey = (
group: "bg" | "fg",
shade: keyof GreyScale,
color: string
) => {
if (theme.color[group][shade] !== color) {
const cpy = { ...theme }
cpy.color.name = "custom"
cpy.color[group][shade] = color
setTheme(cpy)
}
}
const setAccent = (
group: "primary" | "secondary",
shade: keyof ColorGradient,
color: string
) => {
if (theme.color[group][shade] !== color) {
const cpy = { ...theme }
cpy.color.name = "custom"
cpy.color[group][shade] = color
setTheme(cpy)
}
}
const setBgShade = (value: string) => setGrey("bg", "shade", value)
const setBgBase = (value: string) => setGrey("bg", "base", value)
const setBgSurface = (value: string) => setGrey("bg", "surface", value)
const setBgHighlight = (value: string) => setGrey("bg", "highlight", value)
const setFgShade = (value: string) => setGrey("fg", "shade", value)
const setFgBase = (value: string) => setGrey("fg", "base", value)
const setFgSurface = (value: string) => setGrey("fg", "surface", value)
const setFgHighlight = (value: string) => setGrey("fg", "highlight", value)
const setPrimaryBg = (value: string) => setAccent("primary", "bg", value)
const setPrimaryBase = (value: string) => setAccent("primary", "base", value)
const setPrimaryFg = (value: string) => setAccent("primary", "fg", value)
const setSecondaryBg = (value: string) => setAccent("secondary", "bg", value)
const setSecondaryBase = (value: string) =>
setAccent("secondary", "base", value)
const setSecondaryFg = (value: string) => setAccent("secondary", "fg", value)
return (
<Wrapper>
{/** Background */}
<CenterLayout>
<h4>Background</h4>
</CenterLayout>
<CenterLayout>
<ColorInput label="Unused" value={bg.shade} onChange={setBgShade} />
<ColorInput label="Background" value={bg.base} onChange={setBgBase} />
<ColorInput
label="Surface background"
value={bg.surface}
onChange={setBgSurface}
/>
<ColorInput
label="Icon:focus"
value={bg.highlight}
onChange={setBgHighlight}
/>
</CenterLayout>
{/** Forground */}
<CenterLayout>
<h4>Forground</h4>
</CenterLayout>
<CenterLayout>
<ColorInput label="Unused" value={fg.shade} onChange={setFgShade} />
<ColorInput label="Input border" value={fg.base} onChange={setFgBase} />
<ColorInput
label="Bookmark label | Input text"
value={fg.surface}
onChange={setFgSurface}
/>
<ColorInput
label="Unused"
value={fg.highlight}
onChange={setFgHighlight}
/>
</CenterLayout>
{/** Primary */}
<CenterLayout>
<h4>Primary</h4>
</CenterLayout>
<CenterLayout>
<ColorInput
label="Shadow start"
value={primary.bg}
onChange={setPrimaryBg}
/>
<ColorInput
label="Surface border | Icon:hover | Input:focus"
value={primary.base}
onChange={setPrimaryBase}
/>
<ColorInput
label="Headline | Icon"
value={primary.fg}
onChange={setPrimaryFg}
/>
</CenterLayout>
{/** Secondary */}
<CenterLayout>
<h4>Secondary</h4>
</CenterLayout>
<CenterLayout>
<ColorInput
label="Shadow end"
value={secondary.bg}
onChange={setSecondaryBg}
/>
<ColorInput
label="Unused"
value={secondary.base}
onChange={setSecondaryBase}
/>
<ColorInput
label="Group label"
value={secondary.fg}
onChange={setSecondaryFg}
/>
</CenterLayout>
</Wrapper> | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(
group: "bg" | "fg",
shade: keyof GreyScale,
color: string
) => {
if (theme.color[group][shade] !== color) {
const cpy = { ...theme }
cpy.color.name = "custom"
cpy.color[group][shade] = color
setTheme(cpy)
}
} | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(
group: "primary" | "secondary",
shade: keyof ColorGradient,
color: string
) => {
if (theme.color[group][shade] !== color) {
const cpy = { ...theme }
cpy.color.name = "custom"
cpy.color[group][shade] = color
setTheme(cpy)
}
} | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setGrey("bg", "shade", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setGrey("bg", "base", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setGrey("bg", "surface", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setGrey("bg", "highlight", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setGrey("fg", "shade", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setGrey("fg", "base", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setGrey("fg", "surface", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setGrey("fg", "highlight", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setAccent("primary", "bg", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setAccent("primary", "base", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setAccent("primary", "fg", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setAccent("secondary", "bg", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) =>
setAccent("secondary", "base", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
ArrowFunction |
(value: string) => setAccent("secondary", "fg", value) | Heysaksham/yet-another-generic-startpage | src/Settings/Theme/fragments/PostColoring.tsx | TypeScript |
FunctionDeclaration |
export function useUserAddress(
fundingPotId: string | undefined,
colonyClient: ColonyClient | null
) {
const [userAddress, setUserAddress] = React.useState<string>();
useEffect(() => {
(async () => {
if (fundingPotId && colonyClient) {
const humanReadableFundingPotId = new utils.BigNumber(
fundingPotId
).toString();
const { associatedTypeId } = await colonyClient.getFundingPot(
humanReadableFundingPotId
);
const {
recipient: _userAddress,
} = await colonyClient.getPayment(associatedTypeId);
setUserAddress(_userAddress);
}
})();
}, [colonyClient, fundingPotId]);
return userAddress;
} | knoll3/betacolony-events-list | src/hooks/useUserAddress.ts | TypeScript |
ArrowFunction |
() => {
(async () => {
if (fundingPotId && colonyClient) {
const humanReadableFundingPotId = new utils.BigNumber(
fundingPotId
).toString();
const { associatedTypeId } = await colonyClient.getFundingPot(
humanReadableFundingPotId
);
const {
recipient: _userAddress,
} = await colonyClient.getPayment(associatedTypeId);
setUserAddress(_userAddress);
}
})();
} | knoll3/betacolony-events-list | src/hooks/useUserAddress.ts | TypeScript |
ArrowFunction |
async () => {
if (fundingPotId && colonyClient) {
const humanReadableFundingPotId = new utils.BigNumber(
fundingPotId
).toString();
const { associatedTypeId } = await colonyClient.getFundingPot(
humanReadableFundingPotId
);
const {
recipient: _userAddress,
} = await colonyClient.getPayment(associatedTypeId);
setUserAddress(_userAddress);
}
} | knoll3/betacolony-events-list | src/hooks/useUserAddress.ts | TypeScript |
FunctionDeclaration |
function createBaseGenesisState(): GenesisState {
return {
params: undefined,
gauges: [],
lockableDurations: [],
lastGaugeId: Long.UZERO,
};
} | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
ArrowFunction |
(e: any) => Gauge.fromJSON(e) | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
ArrowFunction |
(e: any) => Duration.fromJSON(e) | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
ArrowFunction |
(e) => (e ? Gauge.toJSON(e) : undefined) | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
ArrowFunction |
(e) =>
e ? Duration.toJSON(e) : undefined | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
ArrowFunction |
(e) => Gauge.fromPartial(e) | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
ArrowFunction |
(e) => Duration.fromPartial(e) | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
InterfaceDeclaration | /** GenesisState defines the incentives module's genesis state. */
export interface GenesisState {
/** params defines all the parameters of the module */
params?: Params;
gauges: Gauge[];
lockableDurations: Duration[];
lastGaugeId: Long;
} | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
MethodDeclaration |
encode(
message: GenesisState,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.params !== undefined) {
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
}
for (const v of message.gauges) {
Gauge.encode(v!, writer.uint32(18).fork()).ldelim();
}
for (const v of message.lockableDurations) {
Duration.encode(v!, writer.uint32(26).fork()).ldelim();
}
if (!message.lastGaugeId.isZero()) {
writer.uint32(32).uint64(message.lastGaugeId);
}
return writer;
} | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
MethodDeclaration |
decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenesisState();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.params = Params.decode(reader, reader.uint32());
break;
case 2:
message.gauges.push(Gauge.decode(reader, reader.uint32()));
break;
case 3:
message.lockableDurations.push(
Duration.decode(reader, reader.uint32())
);
break;
case 4:
message.lastGaugeId = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
} | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
MethodDeclaration |
fromJSON(object: any): GenesisState {
return {
params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
gauges: Array.isArray(object?.gauges)
? object.gauges.map((e: any) => Gauge.fromJSON(e))
: [],
lockableDurations: Array.isArray(object?.lockableDurations)
? object.lockableDurations.map((e: any) => Duration.fromJSON(e))
: [],
lastGaugeId: isSet(object.lastGaugeId)
? Long.fromString(object.lastGaugeId)
: Long.UZERO,
};
} | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
MethodDeclaration |
toJSON(message: GenesisState): unknown {
const obj: any = {};
message.params !== undefined &&
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
if (message.gauges) {
obj.gauges = message.gauges.map((e) => (e ? Gauge.toJSON(e) : undefined));
} else {
obj.gauges = [];
}
if (message.lockableDurations) {
obj.lockableDurations = message.lockableDurations.map((e) =>
e ? Duration.toJSON(e) : undefined
);
} else {
obj.lockableDurations = [];
}
message.lastGaugeId !== undefined &&
(obj.lastGaugeId = (message.lastGaugeId || Long.UZERO).toString());
return obj;
} | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
MethodDeclaration |
fromPartial<I extends Exact<DeepPartial<GenesisState>, I>>(
object: I
): GenesisState {
const message = createBaseGenesisState();
message.params =
object.params !== undefined && object.params !== null
? Params.fromPartial(object.params)
: undefined;
message.gauges = object.gauges?.map((e) => Gauge.fromPartial(e)) || [];
message.lockableDurations =
object.lockableDurations?.map((e) => Duration.fromPartial(e)) || [];
message.lastGaugeId =
object.lastGaugeId !== undefined && object.lastGaugeId !== null
? Long.fromValue(object.lastGaugeId)
: Long.UZERO;
return message;
} | pyramation/osmosis-protobufs | src/proto/osmosis/incentives/genesis.ts | TypeScript |
InterfaceDeclaration | /**
* Interfaces for JSON returned from the ESPN API
*/
export interface IESPNLinkJSON {
text: string;
href: string;
rel: string[];
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNCompetitorsJSON {
score: any;
winner: boolean;
id: string;
team: {
abbreviation: string;
links: Array<IESPNLinkJSON>;
};
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNPastCompetitorsJSON extends IESPNCompetitorsJSON {
score: {
value: number;
displayValue: string;
};
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNCurrentCompetitorsJSON extends IESPNCompetitorsJSON {
score: string;
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNCompetitionJSON {
attendance: number;
boxscoreAvailable: boolean;
competitors: Array<any>;
date: string;
id: string;
neutralSite: boolean;
notes: Array<any>;
status: {
clock: number;
displayClock: string;
period: string;
type: {
completed: boolean;
description: string;
detail: string;
id: string;
name: string;
shortDetail: string;
state: string;
};
};
ticketsAvailable: boolean;
timeValid: boolean;
type: {
id: string;
text: string;
abbreviation: string;
};
venue: {
address: {
city: string;
state: string;
zipCode: string;
};
fullName: string;
};
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNScoreboardCompetitionJSON extends IESPNCompetitionJSON {
competitors: Array<IESPNPastCompetitorsJSON>;
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNCurrentCompetitionJSON extends IESPNCompetitionJSON {
competitors: Array<IESPNCurrentCompetitorsJSON>;
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNEvent {
competitions: Array<any>;
date: string;
id: number;
links: IESPNLinkJSON[];
name: string;
season: {
year: number;
displayName: string;
};
seasonType: {
id: string;
type: number;
name: string;
abbreviation: string;
};
shortName: string;
timeValid: boolean;
week: {
number: number;
text: string;
};
status: {
clock: number;
displayClock: string;
period: number;
type: {
completed: boolean;
description: string;
detail: string;
id: string;
name: string;
shortDetail: string;
state: string;
};
};
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNPastEvent extends IESPNEvent {
competitions: Array<IESPNScoreboardCompetitionJSON>;
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNCurrentEvent extends IESPNEvent {
competitions: Array<IESPNCurrentCompetitionJSON>;
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface IESPNSchedule {
events: Array<IESPNPastEvent>;
requestedSeason: {
year: number;
type: number;
name: string;
displayName: string;
};
season: {
year: number;
type: number;
name: string;
displayName: string;
};
status: string;
team: {
abbreviation: string;
clubhouse: string;
color: string;
displayName: string;
groups: {
id: string;
parent: {
id: string;
};
isConference: boolean;
};
id: string;
location: string;
logo: string;
name: string;
recordSummary: string;
seasonSummary: string;
standingSummary: string;
venueLink: string;
};
timestamp: string;
} | jdk2pq/diduvawin | src/interfaces.ts | TypeScript |
ClassDeclaration | /**
* Injectable
*/
@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
/**
* Creates an instance of jwt strategy.
*/
constructor() {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: true,
secretOrKey: 'super-secret-cat',
});
}
/**
* Validates jwt strategy
* @param payload
* @returns
*/
async validate(payload: any) {
console.log('validate()', payload);
return payload;
}
} | asyncfinkd/career | server/src/auth/strategy/jwt.strategy.ts | TypeScript |
MethodDeclaration | /**
* Validates jwt strategy
* @param payload
* @returns
*/
async validate(payload: any) {
console.log('validate()', payload);
return payload;
} | asyncfinkd/career | server/src/auth/strategy/jwt.strategy.ts | TypeScript |
ArrowFunction |
({
schedules,
getSchedulesError,
isLoading,
getSchedules,
}) => {
const nextScheduleIndex = useMemo(() => {
let index = -1;
if (
!schedules.some((schedule, i) => {
if (isNotStartedSchedule(schedule)) {
index = i;
return true;
}
})
) {
index = 4;
}
return index;
}, [schedules]);
useEffect(() => {
getSchedules();
}, []);
useEffect(() => {
alert('์คํ ๊ธฐ๊ฐ์ด ์๋๋๋ค.');
window.history.back();
window.location.href = 'https://www.google.com/';
if (getSchedulesError.status) {
// alert(`Error code: ${getSchedulesError.status} ์ผ์ ๋ถ๋ฌ์ค๊ธฐ ์คํจ!`);
}
}, [getSchedulesError]);
return (
<S.MainWrapper>
<div>
<S.LeftBackgroundImage />
<S.MainContainer>
<S.ContentBlock>
<ContentHeader
padding='160px 0 220px'
subTitle='๋๋์ํํธ์จ์ด๋ง์ด์คํฐ๊ณ ๋ฑํ๊ต'
title='2021 ์ ์
์ ๋ชจ์ง'
underLineLength={315}
titleFontSize={46}
/>
{!!schedules.length ? (
isNotStartedSchedule(schedules[0]) ? (
<Explain schedule={schedules[0]} isProgressing={false} /> | EntryDSM/poodle | poodle/src/components/Main/Main.tsx | TypeScript |
ArrowFunction |
() => {
let index = -1;
if (
!schedules.some((schedule, i) => {
if (isNotStartedSchedule(schedule)) {
index = i;
return true;
}
})
) {
index = 4;
}
return index;
} | EntryDSM/poodle | poodle/src/components/Main/Main.tsx | TypeScript |
ArrowFunction |
(schedule, i) => {
if (isNotStartedSchedule(schedule)) {
index = i;
return true;
}
} | EntryDSM/poodle | poodle/src/components/Main/Main.tsx | TypeScript |
ArrowFunction |
() => {
getSchedules();
} | EntryDSM/poodle | poodle/src/components/Main/Main.tsx | TypeScript |
ArrowFunction |
() => {
alert('์คํ ๊ธฐ๊ฐ์ด ์๋๋๋ค.');
window.history.back();
window.location.href = 'https://www.google.com/';
if (getSchedulesError.status) {
// alert(`Error code: ${getSchedulesError.status} ์ผ์ ๋ถ๋ฌ์ค๊ธฐ ์คํจ!`);
}
} | EntryDSM/poodle | poodle/src/components/Main/Main.tsx | TypeScript |
InterfaceDeclaration |
interface Props {
schedules: Schedule[];
getSchedulesError: ErrorType;
isLoading: boolean;
getSchedules: () => void;
} | EntryDSM/poodle | poodle/src/components/Main/Main.tsx | TypeScript |
ArrowFunction |
({timestamp, ...data}) => {
return {
id: recipientId,
time: timestamp,
messaging: [
{
timestamp,
sender: {id: senderId},
recipient: {id: recipientId},
...data,
},
],
} as EventEntry
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
ClassDeclaration |
export class EventBuilder extends Builder<WebhookEvent, EventBuilderData> {
from(senderId: string) {
return this.clone({senderId})
}
to(recipientId: string) {
return this.clone({recipientId})
}
at(timestamp: number) {
return this.clone({timestamp})
}
postback(title: string, payload?: string) {
const mid = `m-${nextFakeMessageId++}`
const item = {timestamp: this.data.timestamp, postback: {mid, title, payload: payload || title}}
return this.clone({items: [...this.data.items, item]})
}
accountLinked(authorizationCode: string) {
const item: AccountLinkingItem = {
timestamp: this.data.timestamp,
account_linking: {status: 'linked', authorization_code: authorizationCode},
}
return this.clone({items: [...this.data.items, item]})
}
text(content: string) {
return this.message({text: content})
}
quickReply(text: string, payload?: string) {
return this.message({text, quick_reply: {payload: payload || text}})
}
replyTo(id: string, text: string) {
return this.message({text, reply_to: {mid: id}})
}
image(url: string) {
return this.attachment({type: 'image', payload: {url}})
}
audio(url: string) {
return this.attachment({type: 'audio', payload: {url}})
}
video(url: string) {
return this.attachment({type: 'video', payload: {url}})
}
file(url: string) {
return this.attachment({type: 'file', payload: {url}})
}
location(lat: number, long: number, url: string) {
return this.attachment({type: 'location', payload: {url, coordinates: {lat, long}}})
}
protected validate() {
const {recipientId, senderId, items} = this.data
if (recipientId === undefined)
throw `The recipient is missing, use .to(recipientId) to set the recipient`
if (senderId === undefined) throw `The sender is missing, use .from(senderId) to set the sender`
if (items.length === 0) throw `The message to send with the event is missing`
}
protected build() {
const {recipientId, senderId, items} = this.data
const entry = items.map(({timestamp, ...data}) => {
return {
id: recipientId,
time: timestamp,
messaging: [
{
timestamp,
sender: {id: senderId},
recipient: {id: recipientId},
...data,
},
],
} as EventEntry
})
return {object: 'page', entry} as WebhookEvent
}
private message(data: Omit<MessageEvent, 'mid'>) {
const mid = `m-${nextFakeMessageId++}`
const item = {timestamp: this.data.timestamp, message: {mid, ...data}}
return this.clone({items: [...this.data.items, item]})
}
private attachment(data: EventAttachment) {
return this.message({attachments: [data]})
}
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
TypeAliasDeclaration |
export type EventBuilderData = {
senderId?: string
recipientId?: string
timestamp: number
items: Array<MessageItem | PostbackItem | AccountLinkingItem>
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
TypeAliasDeclaration |
type MessageItem = {timestamp: number; message: MessageEvent} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
TypeAliasDeclaration |
type PostbackItem = {timestamp: number; postback: PostbackEvent} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
TypeAliasDeclaration |
type AccountLinkingItem = {timestamp: number; account_linking: AccountLinkingEvent} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
from(senderId: string) {
return this.clone({senderId})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
to(recipientId: string) {
return this.clone({recipientId})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
at(timestamp: number) {
return this.clone({timestamp})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
postback(title: string, payload?: string) {
const mid = `m-${nextFakeMessageId++}`
const item = {timestamp: this.data.timestamp, postback: {mid, title, payload: payload || title}}
return this.clone({items: [...this.data.items, item]})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
accountLinked(authorizationCode: string) {
const item: AccountLinkingItem = {
timestamp: this.data.timestamp,
account_linking: {status: 'linked', authorization_code: authorizationCode},
}
return this.clone({items: [...this.data.items, item]})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
text(content: string) {
return this.message({text: content})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
quickReply(text: string, payload?: string) {
return this.message({text, quick_reply: {payload: payload || text}})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
replyTo(id: string, text: string) {
return this.message({text, reply_to: {mid: id}})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
image(url: string) {
return this.attachment({type: 'image', payload: {url}})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
MethodDeclaration |
audio(url: string) {
return this.attachment({type: 'audio', payload: {url}})
} | webNeat/messenger-chat | src/events/EventBuilder.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.