type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
() => {
expect(component).toBeTruthy();
} | DMahanth/cQube_Workflow | development/ui/dashboard_ui/education_usecase/client-side/src/app/reports/student-performance/sem-view/sem-view.component.spec.ts | TypeScript |
ArrowFunction |
({ children, title = '' }) => {
return (
<>
<Seo title={title} />
<Container>
<HeaderStyled>
<Header />
</HeaderStyled>
<Main>{children}</Main>
</Container>
<Footer />
</> | AlbaRoza/Stooa | frontend/layouts/Home/index.tsx | TypeScript |
InterfaceDeclaration |
interface Props {
title?: string;
} | AlbaRoza/Stooa | frontend/layouts/Home/index.tsx | TypeScript |
ArrowFunction |
({
width = 24,
height = 24,
viewBox = '0 0 24 24',
fill = 'none',
...rest
}: SVG) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
return <Box as="svg" width={width} height={height} viewBox={viewBox} fill={fill} {...rest} />;
} | COVID-19-electronic-health-system/ux | packages/ui/src/svg/index.tsx | TypeScript |
InterfaceDeclaration |
interface SVGProps {
viewBox?: string;
fill?: string;
} | COVID-19-electronic-health-system/ux | packages/ui/src/svg/index.tsx | TypeScript |
TypeAliasDeclaration |
type SVG = SVGProps & BoxProps; | COVID-19-electronic-health-system/ux | packages/ui/src/svg/index.tsx | TypeScript |
ArrowFunction |
async (
region: string,
options?: RegionInfoProviderOptions
) =>
getRegionInfo(region, {
...options,
signingService: "chime",
regionHash,
partitionHash,
}) | AllanFly120/aws-sdk-js-v3 | clients/client-chime-sdk-messaging/src/endpoints.ts | TypeScript |
ArrowFunction |
() => {
performance.startTimer("controller_update")
const dt = this.eventContext.deltaTime;
controller.__update(dt);
performance.stopTimer("controller_update")
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
ArrowFunction |
() => {
if (this.tileMap) {
performance.startTimer("tilemap_update")
this.tileMap.update(this.camera);
performance.stopTimer("tilemap_update")
}
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
ArrowFunction |
() => {
performance.startTimer("physics")
const dt = this.eventContext.deltaTime;
this.physicsEngine.move(dt);
performance.stopTimer("physics")
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
ArrowFunction |
() => {
performance.startTimer("collisions")
const dt = this.eventContext.deltaTime;
this.physicsEngine.collisions();
this.camera.update();
for (const s of this.allSprites)
s.__update(this.camera, dt);
performance.stopTimer("collisions")
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
ArrowFunction |
() => {
this.background.render();
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
ArrowFunction |
() => {
if (this.flags & Flag.NeedsSorting)
this.allSprites.sort(function (a, b) { return a.z - b.z || a.id - b.id; })
performance.startTimer("sprite_draw")
for (const s of this.allSprites)
s.__draw(this.camera);
performance.stopTimer("sprite_draw")
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
ArrowFunction |
() => {
if (game.debug)
this.physicsEngine.draw();
// clear flags
this.flags = 0;
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
ClassDeclaration |
export class Scene {
eventContext: control.EventContext;
background: Background;
tileMap: tiles.TileMap;
allSprites: SpriteLike[];
private spriteNextId: number;
spritesByKind: Sprite[][];
physicsEngine: PhysicsEngine;
camera: scene.Camera;
flags: number;
destroyedHandlers: SpriteHandler[];
createdHandlers: SpriteHandler[];
overlapHandlers: OverlapHandler[];
collisionHandlers: CollisionHandler[];
constructor(eventContext: control.EventContext) {
this.eventContext = eventContext;
this.flags = 0;
this.physicsEngine = new ArcadePhysicsEngine();
this.camera = new scene.Camera();
this.background = new Background(this.camera);
this.destroyedHandlers = [];
this.createdHandlers = [];
this.overlapHandlers = [];
this.collisionHandlers = [];
this.spritesByKind = [];
}
init() {
if (this.allSprites) return;
this.allSprites = [];
this.spriteNextId = 0;
scene.setBackgroundColor(0)
// update controller state
this.eventContext.registerFrameHandler(8, () => {
performance.startTimer("controller_update")
const dt = this.eventContext.deltaTime;
controller.__update(dt);
performance.stopTimer("controller_update")
})
// update sprites in tilemap
this.eventContext.registerFrameHandler(9, () => {
if (this.tileMap) {
performance.startTimer("tilemap_update")
this.tileMap.update(this.camera);
performance.stopTimer("tilemap_update")
}
})
// apply physics 10
this.eventContext.registerFrameHandler(10, () => {
performance.startTimer("physics")
const dt = this.eventContext.deltaTime;
this.physicsEngine.move(dt);
performance.stopTimer("physics")
})
// user update 20
// apply collisions 30
this.eventContext.registerFrameHandler(30, () => {
performance.startTimer("collisions")
const dt = this.eventContext.deltaTime;
this.physicsEngine.collisions();
this.camera.update();
for (const s of this.allSprites)
s.__update(this.camera, dt);
performance.stopTimer("collisions")
})
// render background 60
this.eventContext.registerFrameHandler(60, () => {
this.background.render();
})
// paint 75
// render sprites 90
this.eventContext.registerFrameHandler(90, () => {
if (this.flags & Flag.NeedsSorting)
this.allSprites.sort(function (a, b) { return a.z - b.z || a.id - b.id; })
performance.startTimer("sprite_draw")
for (const s of this.allSprites)
s.__draw(this.camera);
performance.stopTimer("sprite_draw")
})
// render diagnostics
this.eventContext.registerFrameHandler(150, () => {
if (game.debug)
this.physicsEngine.draw();
// clear flags
this.flags = 0;
});
// update screen
this.eventContext.registerFrameHandler(200, control.__screen.update);
}
addSprite(sprite: SpriteLike) {
this.allSprites.push(sprite);
sprite.id = this.spriteNextId++;
}
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
InterfaceDeclaration |
export interface SpriteHandler {
type: number;
handler: (sprite: Sprite) => void;
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
InterfaceDeclaration |
export interface OverlapHandler {
type: number;
otherType: number;
handler: (sprite: Sprite, otherSprite: Sprite) => void;
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
InterfaceDeclaration |
export interface CollisionHandler {
type: number;
tile: number;
handler: (sprite: Sprite) => void
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
EnumDeclaration |
export enum Flag {
NeedsSorting = 1 << 1,
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
MethodDeclaration |
init() {
if (this.allSprites) return;
this.allSprites = [];
this.spriteNextId = 0;
scene.setBackgroundColor(0)
// update controller state
this.eventContext.registerFrameHandler(8, () => {
performance.startTimer("controller_update")
const dt = this.eventContext.deltaTime;
controller.__update(dt);
performance.stopTimer("controller_update")
})
// update sprites in tilemap
this.eventContext.registerFrameHandler(9, () => {
if (this.tileMap) {
performance.startTimer("tilemap_update")
this.tileMap.update(this.camera);
performance.stopTimer("tilemap_update")
}
})
// apply physics 10
this.eventContext.registerFrameHandler(10, () => {
performance.startTimer("physics")
const dt = this.eventContext.deltaTime;
this.physicsEngine.move(dt);
performance.stopTimer("physics")
})
// user update 20
// apply collisions 30
this.eventContext.registerFrameHandler(30, () => {
performance.startTimer("collisions")
const dt = this.eventContext.deltaTime;
this.physicsEngine.collisions();
this.camera.update();
for (const s of this.allSprites)
s.__update(this.camera, dt);
performance.stopTimer("collisions")
})
// render background 60
this.eventContext.registerFrameHandler(60, () => {
this.background.render();
})
// paint 75
// render sprites 90
this.eventContext.registerFrameHandler(90, () => {
if (this.flags & Flag.NeedsSorting)
this.allSprites.sort(function (a, b) { return a.z - b.z || a.id - b.id; })
performance.startTimer("sprite_draw")
for (const s of this.allSprites)
s.__draw(this.camera);
performance.stopTimer("sprite_draw")
})
// render diagnostics
this.eventContext.registerFrameHandler(150, () => {
if (game.debug)
this.physicsEngine.draw();
// clear flags
this.flags = 0;
});
// update screen
this.eventContext.registerFrameHandler(200, control.__screen.update);
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
MethodDeclaration |
addSprite(sprite: SpriteLike) {
this.allSprites.push(sprite);
sprite.id = this.spriteNextId++;
} | flecleach/pxt-move-mini | node_modules/pxt-common-packages/libs/game/scene.ts | TypeScript |
ArrowFunction |
() => {
it('renders', async () => {
const page = await newE2EPage();
await page.setContent('<s-ds-color></s-ds-color>');
const element = await page.find('s-ds-color');
expect(element).toHaveClass('hydrated');
});
it('renders changes to the name data', async () => {
const page = await newE2EPage();
await page.setContent('<s-ds-color></s-ds-color>');
const component = await page.find('s-ds-color');
const element = await page.find('s-ds-color >>> div');
expect(element.textContent).toEqual(`Hello, World! I'm `);
component.setProperty('first', 'James');
await page.waitForChanges();
expect(element.textContent).toEqual(`Hello, World! I'm James`);
component.setProperty('last', 'Quincy');
await page.waitForChanges();
expect(element.textContent).toEqual(`Hello, World! I'm James Quincy`);
component.setProperty('middle', 'Earl');
await page.waitForChanges();
expect(element.textContent).toEqual(`Hello, World! I'm James Earl Quincy`);
});
} | mmexvr/s-design-system | components/s-ds-color/src/components/s-ds-color/s-ds-color.e2e.ts | TypeScript |
ArrowFunction |
async () => {
const page = await newE2EPage();
await page.setContent('<s-ds-color></s-ds-color>');
const element = await page.find('s-ds-color');
expect(element).toHaveClass('hydrated');
} | mmexvr/s-design-system | components/s-ds-color/src/components/s-ds-color/s-ds-color.e2e.ts | TypeScript |
ArrowFunction |
async () => {
const page = await newE2EPage();
await page.setContent('<s-ds-color></s-ds-color>');
const component = await page.find('s-ds-color');
const element = await page.find('s-ds-color >>> div');
expect(element.textContent).toEqual(`Hello, World! I'm `);
component.setProperty('first', 'James');
await page.waitForChanges();
expect(element.textContent).toEqual(`Hello, World! I'm James`);
component.setProperty('last', 'Quincy');
await page.waitForChanges();
expect(element.textContent).toEqual(`Hello, World! I'm James Quincy`);
component.setProperty('middle', 'Earl');
await page.waitForChanges();
expect(element.textContent).toEqual(`Hello, World! I'm James Earl Quincy`);
} | mmexvr/s-design-system | components/s-ds-color/src/components/s-ds-color/s-ds-color.e2e.ts | TypeScript |
ArrowFunction |
(_browserWindow: BrowserWindow) => {
} | marshallbrain/image-gallery | src/electron/system.ts | TypeScript |
ArrowFunction |
(browserWindow: BrowserWindow) => {
loggingWindow = browserWindow
} | marshallbrain/image-gallery | src/electron/system.ts | TypeScript |
ArrowFunction |
(...data: any[]) => {
loggingWindow.webContents.send(logFeedChannel, ...data)
} | marshallbrain/image-gallery | src/electron/system.ts | TypeScript |
ClassDeclaration |
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class NpFrameworkCssDemoRoutingModule { } | np-ui-lib/np-ui-lib | src/app/np-framework-css-demo/np-framework-css-demo-routing.module.ts | TypeScript |
ClassDeclaration | /** Configuration for the request such as headers, query parameters, and middleware options. */
export class DeviceCompliancePolicyStatesRequestBuilderPostRequestConfiguration {
/** Request headers */
public headers?: Record<string, string> | undefined;
/** Request options */
public options?: RequestOption[] | undefined;
} | microsoftgraph/msgraph-sdk-typescript | src/deviceManagement/managedDevices/item/deviceCompliancePolicyStates/deviceCompliancePolicyStatesRequestBuilderPostRequestConfiguration.ts | TypeScript |
ArrowFunction |
() => {
return (
<Container sx={{ py: { xs: 4, md: 8 } }} | 94YOUNG/material-ui | docs/src/components/home/Sponsors.tsx | TypeScript |
FunctionDeclaration |
export declare function run(): Promise<number | undefined>; | KPGY/frontend16 | node_modules/@aws-amplify/cli/lib/index.d.ts | TypeScript |
FunctionDeclaration |
export declare function execute(input: Input): Promise<number>; | KPGY/frontend16 | node_modules/@aws-amplify/cli/lib/index.d.ts | TypeScript |
FunctionDeclaration |
export declare function executeAmplifyCommand(context: Context): Promise<void>; | KPGY/frontend16 | node_modules/@aws-amplify/cli/lib/index.d.ts | TypeScript |
FunctionDeclaration |
function testCommonmark(idx: number) {
test(`it passes the commonmark spec #${idx}`, () => {
const parser = unified()
.use(makeParser, { parserScribbles })
.use(remarkHTML);
const spec = commonmarkTests[idx];
const out = parser.processSync(`${spec.markdown}\n\n`);
// console.log(JSON.stringify(parser.parse(spec.markdown + '\n\n'), null, 2));
expect(out.contents).toEqual(spec.html);
});
} | e1senh0rn/metanotes | src/frontend/metamarkdown/parser/parser.test.ts | TypeScript |
ArrowFunction |
() => {
const parser = unified()
.use(makeParser, { parserScribbles })
.use(remarkHTML);
const spec = commonmarkTests[idx];
const out = parser.processSync(`${spec.markdown}\n\n`);
// console.log(JSON.stringify(parser.parse(spec.markdown + '\n\n'), null, 2));
expect(out.contents).toEqual(spec.html);
} | e1senh0rn/metanotes | src/frontend/metamarkdown/parser/parser.test.ts | TypeScript |
ArrowFunction |
() => {
expectParse('hello world\n\n',
[
{
type: 'paragraph',
children: [
{ type: 'text', value: 'hello world' },
],
},
]);
} | e1senh0rn/metanotes | src/frontend/metamarkdown/parser/parser.test.ts | TypeScript |
ArrowFunction |
() => {
expectParse('hello **world**\n\n',
[
{
type: 'paragraph',
children: [
{ type: 'text', value: 'hello ' },
{ type: 'strong', children: [{ type: 'text', value: 'world' }] },
],
},
]);
} | e1senh0rn/metanotes | src/frontend/metamarkdown/parser/parser.test.ts | TypeScript |
ArrowFunction |
() => {
expectParse('hello **world\n\n',
[
{
type: 'paragraph',
children: [
{ type: 'text', value: 'hello **world' },
],
},
]);
} | e1senh0rn/metanotes | src/frontend/metamarkdown/parser/parser.test.ts | TypeScript |
ArrowFunction |
() => {
expectParse('hello ** world **\n\n',
[
{
type: 'paragraph',
children: [
{ type: 'text', value: 'hello ** world **' },
],
},
]);
} | e1senh0rn/metanotes | src/frontend/metamarkdown/parser/parser.test.ts | TypeScript |
ArrowFunction |
() => {
expectParse('### hello **there** ###\nworld\n\n',
[
{
type: 'heading',
depth: 3,
children: [
{ type: 'text', value: 'hello ' },
{ type: 'strong', children: [{ type: 'text', value: 'there' }] },
],
},
{
type: 'paragraph',
children: [
{ type: 'text', value: 'world' },
],
},
]);
} | e1senh0rn/metanotes | src/frontend/metamarkdown/parser/parser.test.ts | TypeScript |
ArrowFunction |
() => ({
...(global as any).eventkit_test_props
}) | venicegeo/eventkit-cloud | eventkit_cloud/ui/static/ui/app/tests/DataPackPage/DataPackLinkButton.spec.tsx | TypeScript |
ArrowFunction |
() => {
props = { ...getProps() };
wrapper = shallow(<DataPackLinkButton {...props} />);
} | venicegeo/eventkit-cloud | eventkit_cloud/ui/static/ui/app/tests/DataPackPage/DataPackLinkButton.spec.tsx | TypeScript |
ArrowFunction |
() => {
it('should render a linked button', () => {
expect(wrapper.find(Link)).toHaveLength(1);
expect(wrapper.find(Link).props().to).toEqual(`/create`);
expect(wrapper.find(Button).html()).toContain('Create DataPack');
expect(wrapper.find(Button)).toHaveLength(1);
});
} | venicegeo/eventkit-cloud | eventkit_cloud/ui/static/ui/app/tests/DataPackPage/DataPackLinkButton.spec.tsx | TypeScript |
ArrowFunction |
() => {
expect(wrapper.find(Link)).toHaveLength(1);
expect(wrapper.find(Link).props().to).toEqual(`/create`);
expect(wrapper.find(Button).html()).toContain('Create DataPack');
expect(wrapper.find(Button)).toHaveLength(1);
} | venicegeo/eventkit-cloud | eventkit_cloud/ui/static/ui/app/tests/DataPackPage/DataPackLinkButton.spec.tsx | TypeScript |
ClassDeclaration |
declare class MdImportContacts extends React.Component<IconBaseProps> { } | 0916dhkim/DefinitelyTyped | types/react-icons/lib/md/import-contacts.d.ts | TypeScript |
InterfaceDeclaration | /** ------------------------------------------------------
* THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
* -------------------------------------------------------
*/
/* tslint:disable */
export interface Electricity {
id?: number;
totalLoad?: number;
timestamp?: Date;
solar?: ElectricityType;
windOffshore?: ElectricityType;
windOnshore?: ElectricityType;
} | aignerjo/entsoe-graphql | src/graphql.ts | TypeScript |
InterfaceDeclaration |
export interface ElectricityType {
amount?: number;
percentage?: number;
} | aignerjo/entsoe-graphql | src/graphql.ts | TypeScript |
InterfaceDeclaration |
export interface IQuery {
forecast(day?: Date, country?: string): Electricity[] | Promise<Electricity[]>;
} | aignerjo/entsoe-graphql | src/graphql.ts | TypeScript |
ArrowFunction |
() => {
jest.useFakeTimers();
jest.setSystemTime(new Date('2022-01-01T00:00:00'));
} | unicorn-84/rel-time-format | src/tests/getDiffInCalendarDays.test.ts | TypeScript |
ArrowFunction |
() => {
jest.useRealTimers();
} | unicorn-84/rel-time-format | src/tests/getDiffInCalendarDays.test.ts | TypeScript |
ArrowFunction |
() => {
it('should return the number of calendar days', () => {
expect(getDiffInCalendarDays(new Date(), new Date())).toBe(0);
expect(
getDiffInCalendarDays(new Date(), new Date('2021-12-31T23:59:59'))
).toBe(1);
expect(
getDiffInCalendarDays(new Date('2022-01-01T23:59:59'), new Date())
).toBe(0);
expect(
getDiffInCalendarDays(
new Date('2021-12-31T23:59:59'),
new Date('2022-01-01T00:00:00')
)
).toBe(-1);
expect(
getDiffInCalendarDays(
new Date('2021-01-01T00:00:00'),
new Date('2022-01-01T23:59:59'),
true
)
).toBe(365);
});
} | unicorn-84/rel-time-format | src/tests/getDiffInCalendarDays.test.ts | TypeScript |
ArrowFunction |
() => {
expect(getDiffInCalendarDays(new Date(), new Date())).toBe(0);
expect(
getDiffInCalendarDays(new Date(), new Date('2021-12-31T23:59:59'))
).toBe(1);
expect(
getDiffInCalendarDays(new Date('2022-01-01T23:59:59'), new Date())
).toBe(0);
expect(
getDiffInCalendarDays(
new Date('2021-12-31T23:59:59'),
new Date('2022-01-01T00:00:00')
)
).toBe(-1);
expect(
getDiffInCalendarDays(
new Date('2021-01-01T00:00:00'),
new Date('2022-01-01T23:59:59'),
true
)
).toBe(365);
} | unicorn-84/rel-time-format | src/tests/getDiffInCalendarDays.test.ts | TypeScript |
ArrowFunction |
({
versions = [],
version,
docsType,
topic,
formatMessage,
}) => {
const changeDocsVersion = (e: ChangeEvent<HTMLSelectElement>) => {
const newVersion = e.target.value;
const { hash } = window.location;
const path = getDocsPath(newVersion, {
id: topic,
type: docsType,
hash: hash.substring(1),
});
navigate(path);
};
return (
<Wrapper>
<Label>{formatMessage({ id: "version" })}:</Label>
<SelectWrapper>
<VersionSelect onChange={changeDocsVersion} defaultValue={version}>
{Object.keys(versions).map((key: string, id: number) => (
<optgroup key={key} label={formatMessage({ id: key })}>
{(versions as any)[key].map((element: string, index: number) => {
const isLatestVersion = id === 0 && index === 0;
return (
<option key={element} value={element}>
{element}{" "}
{isLatestVersion && `(${formatMessage({ id: "latest" })})`}
</option>
);
})} | alexandra-simeonova/website | src/views/docs/components/versionSwitcher/index.tsx | TypeScript |
ArrowFunction |
(e: ChangeEvent<HTMLSelectElement>) => {
const newVersion = e.target.value;
const { hash } = window.location;
const path = getDocsPath(newVersion, {
id: topic,
type: docsType,
hash: hash.substring(1),
});
navigate(path);
} | alexandra-simeonova/website | src/views/docs/components/versionSwitcher/index.tsx | TypeScript |
ArrowFunction |
(key: string, id: number) => (
<optgroup key={key} | alexandra-simeonova/website | src/views/docs/components/versionSwitcher/index.tsx | TypeScript |
ArrowFunction |
(element: string, index: number) => {
const isLatestVersion = id === 0 && index === 0;
return (
<option key={element} value={element}>
{element}{" "}
{isLatestVersion && `(${formatMessage({ id: "latest" })})`}
</option> | alexandra-simeonova/website | src/views/docs/components/versionSwitcher/index.tsx | TypeScript |
InterfaceDeclaration |
interface VersionSwitcherProps {
versions: DocsVersions;
version: string;
docsType: string;
topic: string;
} | alexandra-simeonova/website | src/views/docs/components/versionSwitcher/index.tsx | TypeScript |
MethodDeclaration |
formatMessage({ id: "version" }) | alexandra-simeonova/website | src/views/docs/components/versionSwitcher/index.tsx | TypeScript |
MethodDeclaration |
formatMessage({ id: key }) | alexandra-simeonova/website | src/views/docs/components/versionSwitcher/index.tsx | TypeScript |
ArrowFunction |
() => ExampleTuiCheckboxLabeledComponent | ikurilov/taiga-ui | projects/demo/src/modules/components/checkbox-labeled/checkbox-labeled.component.ts | TypeScript |
ArrowFunction |
value => {
if (value) {
this.control.get('testValue1')!.setValue(false);
}
} | ikurilov/taiga-ui | projects/demo/src/modules/components/checkbox-labeled/checkbox-labeled.component.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'example-tui-checkbox-labeled',
templateUrl: './checkbox-labeled.template.html',
changeDetection,
providers: [
{
provide: ABSTRACT_PROPS_ACCESSOR,
useExisting: forwardRef(() => ExampleTuiCheckboxLabeledComponent),
},
],
})
export class ExampleTuiCheckboxLabeledComponent extends AbstractExampleTuiInteractive {
readonly exampleDeclareForm = exampleDeclareForm;
readonly exampleImportModule = exampleImportModule;
readonly exampleInsertTemplate = exampleInsertTemplate;
readonly example1: FrontEndExample = {
TypeScript: example1Ts,
HTML: example1Html,
LESS: example1Less,
};
readonly example2: FrontEndExample = {
TypeScript: example2Ts,
HTML: example2Html,
};
readonly sizeVariants: ReadonlyArray<TuiSizeL> = ['m', 'l'];
size: TuiSizeL = this.sizeVariants[0];
control = new FormGroup({
testValue1: new FormControl(false),
testValue2: new FormControl(),
testValue3: new FormControl(true),
});
constructor(
@Inject(HOW_TO_PATH_RESOLVER) readonly howToResolver: (path: string) => string,
) {
super();
this.control.get('testValue1')!.valueChanges.subscribe(value => {
if (value) {
this.control.get('testValue1')!.setValue(false);
}
});
}
} | ikurilov/taiga-ui | projects/demo/src/modules/components/checkbox-labeled/checkbox-labeled.component.ts | TypeScript |
ArrowFunction |
(
header: string,
what: string,
map: Record<string | number, unknown>,
key: string,
) => console.error(`${header} ${what}: ${JSON.stringify(map[key])}`) | ChalkPE/cactbot | util/gen_effect_id.ts | TypeScript |
ArrowFunction |
(table: Table<'#', 'Name'>) => {
const foundNames = new Set();
const map = new Map<string, string>();
for (const [id, effect] of Object.entries(table)) {
const rawName = effect['Name'];
if (!rawName)
continue;
const name = cleanName(rawName);
// Skip empty strings.
if (!name)
continue;
if (rawName in knownMapping) {
if (id !== knownMapping[rawName as keyof typeof knownMapping]) {
printError('skipping', rawName, table, id);
continue;
}
}
if (map.has(name)) {
printError('collision', name, table, id);
printError('collision', name, table, map.get(name) ?? '');
map.delete(name);
continue;
}
if (foundNames.has(name)) {
printError('collision', name, table, id);
continue;
}
foundNames.add(name);
map.set(name, id);
}
// Make sure everything specified in known_mapping was found in the above loop.
for (const rawName of Object.keys(knownMapping)) {
const name = cleanName(rawName);
if (name && !foundNames.has(name))
printError('missing', name, knownMapping, rawName);
}
// Add custom effect name for necessary duplicates.
for (const [name, id] of Object.entries(customMapping))
map.set(name, id);
// Store ids as hex.
map.forEach((id, name) => map.set(name, parseInt(id).toString(16).toUpperCase()));
return Object.fromEntries(map);
} | ChalkPE/cactbot | util/gen_effect_id.ts | TypeScript |
ArrowFunction |
(id, name) => map.set(name, parseInt(id).toString(16).toUpperCase()) | ChalkPE/cactbot | util/gen_effect_id.ts | TypeScript |
ArrowFunction |
async (): Promise<void> => {
const table = await getIntlTable('Status', ['#', 'Name', 'Icon', 'PartyListPriority']);
const writer = new CoinachWriter(null, true);
void writer.writeTypeScript(
path.join('resources', effectsOutputFile),
'gen_effect_id.ts',
null,
null,
true,
makeEffectMap(table),
);
} | ChalkPE/cactbot | util/gen_effect_id.ts | TypeScript |
ClassDeclaration | /**
* This project is a continuation of Inrupt's awesome solid-auth-fetcher project,
* see https://www.npmjs.com/package/@inrupt/solid-auth-fetcher.
* Copyright 2020 The Solid Project.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Error to be triggered when a poor configuration is received
*/
// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages
// https://github.com/gotwarlost/istanbul/issues/690
// The workaround is to put istanbul ignore on the constructor
export default class ConfigurationError extends Error {
/* istanbul ignore next */
constructor(message: string) {
super(message);
}
} | NoelDeMartin/solid-auth-fetcher | src/errors/ConfigurationError.ts | TypeScript |
ArrowFunction |
(theme, collector) => {
const background = theme.getColor(editorBackground);
if (background) {
collector.addRule(`.monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input { background-color: ${background}; }`);
}
const foreground = theme.getColor(editorForeground);
if (foreground) {
collector.addRule(`.monaco-editor, .monaco-editor .inputarea.ime-input { color: ${foreground}; }`);
}
const gutter = theme.getColor(editorGutter);
if (gutter) {
collector.addRule(`.monaco-editor .margin { background-color: ${gutter}; }`);
}
const rangeHighlight = theme.getColor(editorRangeHighlight);
if (rangeHighlight) {
collector.addRule(`.monaco-editor .rangeHighlight { background-color: ${rangeHighlight}; }`);
}
const rangeHighlightBorder = theme.getColor(editorRangeHighlightBorder);
if (rangeHighlightBorder) {
collector.addRule(`.monaco-editor .rangeHighlight { border: 1px ${theme.type === 'hc' ? 'dotted' : 'solid'} ${rangeHighlightBorder}; }`);
}
const symbolHighlight = theme.getColor(editorSymbolHighlight);
if (symbolHighlight) {
collector.addRule(`.monaco-editor .symbolHighlight { background-color: ${symbolHighlight}; }`);
}
const symbolHighlightBorder = theme.getColor(editorSymbolHighlightBorder);
if (symbolHighlightBorder) {
collector.addRule(`.monaco-editor .symbolHighlight { border: 1px ${theme.type === 'hc' ? 'dotted' : 'solid'} ${symbolHighlightBorder}; }`);
}
const invisibles = theme.getColor(editorWhitespaces);
if (invisibles) {
collector.addRule(`.monaco-editor .mtkw { color: ${invisibles} !important; }`);
collector.addRule(`.monaco-editor .mtkz { color: ${invisibles} !important; }`);
}
} | Ahmed-ShawkyEgy/vscode | src/vs/editor/common/core/editorColorRegistry.ts | TypeScript |
ClassDeclaration |
export declare abstract class AutocompleteBase extends Command {
readonly cliBin: string;
readonly cliBinEnvVar: string;
errorIfWindows(): void;
errorIfNotSupportedShell(shell: string): void;
readonly autocompleteCacheDir: string;
readonly acLogfilePath: string;
writeLogFile(msg: string): void;
} | RezanTuran/SpaceX-Travel | final/server/node_modules/@oclif/plugin-autocomplete/lib/base.d.ts | TypeScript |
MethodDeclaration |
errorIfWindows(): void; | RezanTuran/SpaceX-Travel | final/server/node_modules/@oclif/plugin-autocomplete/lib/base.d.ts | TypeScript |
MethodDeclaration |
errorIfNotSupportedShell(shell: string): void; | RezanTuran/SpaceX-Travel | final/server/node_modules/@oclif/plugin-autocomplete/lib/base.d.ts | TypeScript |
MethodDeclaration |
writeLogFile(msg: string): void; | RezanTuran/SpaceX-Travel | final/server/node_modules/@oclif/plugin-autocomplete/lib/base.d.ts | TypeScript |
ClassDeclaration |
@NgModule({
imports: [
CommonModule
],
declarations: []
})
export class ChatModule { } | YuriVaillant/exampleNg | example/src/app/shared/components/communication/chat/chat.module.ts | TypeScript |
ArrowFunction |
({ allInfos, setGroupedOptionHandler, itemSelectHandler }: Props) => {
return (
<Layer>
{allInfos.map((info) => (
<RectItem
position={info.position}
width={info.width}
height={info.height}
color={info.color}
option={info.text}
setGroupedOption={setGroupedOptionHandler}
type={info.elementInfo?.type}
/>
))}
{allInfos.map((info) => (
<TextItem
position={info.position}
text={info.text}
option={info.text}
setGroupedOption={setGroupedOptionHandler}
type={info.elementInfo?.type}
/>
))}
{allInfos.map((info) => (
<MetricImage
position={info.position}
itemWidth={info.width}
item={info}
itemSelectHandler={itemSelectHandler}
/>
))}
</Layer> | fylip97/Thesis | src/CanvasObjects/Item/Item.tsx | TypeScript |
ArrowFunction |
(info) => (
<RectItem
position={info.position} | fylip97/Thesis | src/CanvasObjects/Item/Item.tsx | TypeScript |
ArrowFunction |
(info) => (
<TextItem
position={info.position} | fylip97/Thesis | src/CanvasObjects/Item/Item.tsx | TypeScript |
ArrowFunction |
(info) => (
<MetricImage
position={info.position} | fylip97/Thesis | src/CanvasObjects/Item/Item.tsx | TypeScript |
TypeAliasDeclaration |
type Props = {
allInfos: Element[],
setGroupedOptionHandler: (value: SelectableValue) => void;
itemSelectHandler: (item: Element) => void;
} | fylip97/Thesis | src/CanvasObjects/Item/Item.tsx | TypeScript |
FunctionDeclaration |
export function transformVoidExpression(state: TransformState, node: ts.VoidExpression) {
state.prereqList(transformExpressionStatementInner(state, skipDownwards(node.expression)));
return luau.create(luau.SyntaxKind.NilLiteral, {});
} | Fireboltofdeath/roblox-ts | src/TSTransformer/nodes/expressions/transformVoidExpression.ts | TypeScript |
FunctionDeclaration |
async function asyncForEach(array: any[], callback: Function) {
while (array.length > 0) {
await callback(array.pop());
}
} | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
ArrowFunction |
(componentName: string, srcFolder: string) => `${srcFolder}/${componentName}/README.md` | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
ArrowFunction |
(components: IComponentModule): IMarkdownOpts => {
const componentsReducer = (overrides: IComponentOverrides, component: string) => ({ ...overrides, [component]: components[component] });
const overrides = Object.keys(components).reduce(componentsReducer, {});
return { overrides };
} | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
ArrowFunction |
(overrides: IComponentOverrides, component: string) => ({ ...overrides, [component]: components[component] }) | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
ArrowFunction |
async (components: IComponentModule, srcFolder: string): Promise<string[]> => {
const documented: string[] = [];
await asyncForEach(Object.keys(components), async (component: string) => {
const { ok } = await fetch(mdPathForComponent(component, srcFolder));
if (ok) {
documented.push(component);
}
});
return documented.sort();
} | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
ArrowFunction |
async (component: string) => {
const { ok } = await fetch(mdPathForComponent(component, srcFolder));
if (ok) {
documented.push(component);
}
} | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
ArrowFunction |
async (path: string, errorString = 'error') => {
let text = '';
try {
const result = await fetch(path);
text = await result.text();
} catch (e) {
text = errorString;
}
return text;
} | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
ArrowFunction |
async (path: string, error: string = undefined) => await(fetchText(path, error)) | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
InterfaceDeclaration |
export interface IComponentModule {
[moduleName: string]: Function;
} | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
InterfaceDeclaration |
export interface IComponentOverrides {
[component: string]: Function;
} | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
InterfaceDeclaration |
export interface IMarkdownOpts {
overrides: {
[component: string]: Function;
};
} | dannywieser/js-demo | packages/demopage/src/utilities/markdown.ts | TypeScript |
ArrowFunction |
props => {
const { user } = useContext(UserData);
const commentActions = (
<small>
[
<a href="#delete" onClick={props.handleDeleteClick}>
delete
</a>
] [
<a href="#edit" onClick={props.handleEditClick}>
edit
</a> | rmetzger/flink-ecosystem | src/client/components/comments/CommentHeader.tsx | TypeScript |
TypeAliasDeclaration |
type Props = {
login: string;
added: string;
user_id: number;
updated: string;
handleDeleteClick: (e: SyntheticEvent) => void;
handleEditClick: (e: SyntheticEvent) => void;
}; | rmetzger/flink-ecosystem | src/client/components/comments/CommentHeader.tsx | TypeScript |
ArrowFunction |
(response): void => {
this.rowData = response;
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
ArrowFunction |
(response): void => {
this.db.addmessageandremove('deleted');
//this.LoadData();
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
ArrowFunction |
(response): void => {
this.LoadData();
this.db.showMessage('Updated Successfully');
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
ArrowFunction |
(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 |
ClassDeclaration |
@Component({
selector: 'app-emailparsing',
templateUrl: './emailparsing.component.html',
styleUrls: ['./emailparsing.component.scss']
})
export class EmailparsingComponent implements OnInit {
private smsselected = {};
private emailselected = {};
private gridApi;
private gridColumnApi;
private autoGroupColumnDef;
private defaultColDef;
private rowSelection;
private rowGroupPanelShow;
private pivotPanelShow;
smtp: any;
smtptype: any;
smtpname: any;
incoming_port: any;
user_name: any;
password: any;
// columnDefs = [
// {
// headerName: 'Action', field: 'id', suppressMenu: true,
// suppressSorting: true, width: 300,
// template:
// `<button type='button' data-action-type='edit' class='btn btn-success btn-sm'>
// Edit
// </button>
// <button type='button' data-action-type='delete' class='btn btn-danger btn-sm'>
// Delete
// </button>`},
// {
// headerName: 'smtp Type', field: 'smtptype', sortable: true,
// filter: true, headerCheckboxSelection: true, checkboxSelection: true, width: 250,
// },
// { headerName: 'Incoming server', field: 'smtpname', sortable: true, filter: true, width: 250 },
// { headerName: 'User Name', field: 'user_name', sortable: true, filter: true, width: 250 },
// { headerName: 'Port', field: 'port', sortable: true, filter: true },
// ];
rowData = [
];
constructor(private db: DBService) {
this.defaultColDef = {
editable: true,
enableRowGroup: true,
enablePivot: true,
enableValue: true,
sortable: true,
resizable: true,
filter: true
};
this.rowSelection = 'singal';
this.rowGroupPanelShow = 'always';
this.pivotPanelShow = 'always';
}
ngOnInit() {
this.LoadData();
}
LoadData(): void {
this.db.list('smtpdetail/', {}, ((response): void => {
this.rowData = response;
}));
}
onGridReady(params) {
this.gridApi = params.api;
this.gridColumnApi = params.columnApi;
}
exportdat() {
this.gridApi.exportDataAsCsv();
}
onSelectionChanged(event) {
console.log(event.api.getSelectedNodes());
const rowCount = event.api.getSelectedNodes().length;
window.alert('selection changed, ' + rowCount + ' rows selected');
}
// 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);
}
// 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');
}));
}
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 };
}));
}
// this.isvisible=false;
// visible(): void {
// if (this.isvisible == false) {
// this.isvisible = true;
// }
// else {
// this.isvisible = false;
// }
// }
// visibleonedit(): void {
// if (this.isvisible == false) {
// this.isvisible = true;
// }
// }
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
MethodDeclaration |
ngOnInit() {
this.LoadData();
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
MethodDeclaration |
LoadData(): void {
this.db.list('smtpdetail/', {}, ((response): void => {
this.rowData = response;
}));
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |
MethodDeclaration |
onGridReady(params) {
this.gridApi = params.api;
this.gridColumnApi = params.columnApi;
} | manoj755/Manoj-Singh-Bisht | src/app/emailparsing/emailparsing.component.ts | TypeScript |