type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction |
km =>
km.key_code === event.keyCode &&
(km.key_modifiers?.alt != undefined ? km.key_modifiers.alt === event.altKey : true) &&
(km.key_modifiers?.ctrl != undefined ? km.key_modifiers.ctrl === event.ctrlKey : true) &&
(km.key... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
ArrowFunction |
game_button => this._on_down(game_button, event) | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
ArrowFunction |
(event: KeyboardEvent) => {
this.is_last_input_gamepad = true;
const game_buttons = Gamepad.transcode_keyboard_key(event.keyCode);
game_buttons.forEach(game_button => this._on_up(game_button, event));
} | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
ArrowFunction |
game_button => this._on_up(game_button, event) | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
ClassDeclaration |
export class GamepadButton {
/** Emulated gamepad controller */
gamepad: Gamepad;
/** Game button that will trigger */
button: AnyButton;
/** Debug purpose */
name: string = undefined;
/** Whether the gamepad button is held down */
is_down: boolean = false;
/** Signal to trigger whe... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
EnumDeclaration | /** GBA buttons */
export enum AdvanceButton {
A,
B,
L,
R,
START,
SELECT,
LEFT,
RIGHT,
UP,
DOWN,
} | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
EnumDeclaration | /** Other hardware controller buttons */
export enum ControllerButton {
LB = AdvanceButton.L,
RB = AdvanceButton.R,
X = AdvanceButton.DOWN + 1,
Y,
LS,
RS,
L2,
R2,
LT = ControllerButton.L2,
RT = ControllerButton.R2,
// LX, LY, RX, RY,
LLEFT,
LRIGHT,
LUP,
LDOWN,... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
EnumDeclaration | /** Custom engine buttons */
export enum EngineButton {
STICK_DASHING = ControllerButton.RDOWN + 1,
PSY1,
PSY2,
PSY3,
PSY4,
ZOOM1,
ZOOM2,
ZOOM3,
MUTE,
VOL_UP,
VOL_DOWN,
DEBUG_PHYSICS,
DEBUG_GRID,
DEBUG_KEYS,
DEBUG_STATS,
DEBUG_FPS,
DEBUG_SLIDERS,
D... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
TypeAliasDeclaration | /** Any buttons recognized by the engine */
export type Button = AdvanceButton | EngineButton; | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
TypeAliasDeclaration | /** A real controller or an engine button */
export type AnyButton = Button | ControllerButton; | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
TypeAliasDeclaration | /** Used to map a real button/key to an emulated controller */
type KeyMap = {
/** Game button */
game_button: AnyButton;
/** Game button group that triggers the game button */
game_buttons?: AnyButton[];
/** For multi-button name chaining (reflect) */
name?: string;
/** For multi-buttons, r... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Loads the gamepad and keyboard configuration.
* @param {GoldenSun} data - Master game data object
* @param {string} [input_type=default_inputs] - Keyboard key mapping configuration name
*/
static initialize(data: GoldenSun, input_type: string = "default_inputs") {
// Load default gamep... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Gets the GBA button(s) attached to the controller button.
* @param {number} button_code - Controller button code.
* @return {AnyButton[]} - GBA (custom) button(s)
*/
static transcode_gamepad_button(button_code: number): AnyButton[] {
// return Gamepad.keyboard_mapping.find(km => km.but... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Gets the GBA button(s) attached to the Phaser keyboard key.
* @param {number} key_code - Phaser keyboard key code.
* @return {AnyButton[]} - GBA (custom) button(s)
*/
static transcode_keyboard_key(key_code: number): AnyButton[] {
// Use a single array Gamepad.keyboard_fast_mapping[key_... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Gets the oppposite button.
* @param {Button} game_button - GBA button
* @return {?Button} - Opposite GBA button
*/
static get_opposite_button(game_button: Button): Button {
switch (game_button) {
// Advance buttons
case Button.LEFT:
return Button... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Press the game button if it is up then triggers the listeners.
* @param {AnyButton} game_button - The game button to press
* @param {?KeyboardEvent} event - The keyboard event if any
*/
private _on_down(game_button: AnyButton, event?: KeyboardEvent): GamepadButton {
const btn = this.bu... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Releases the game button if it is held down then triggers the listeners.
* @param {AnyButton} game_button - The game button to release
* @param {?KeyboardEvent} event - The keyboard event if any
*/
private _on_up(game_button: AnyButton, event?: KeyboardEvent): GamepadButton {
const btn... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Press any multi-buttons involved if none the button itself.
* @param {AnyButton} game_button - The game button getting pressed
*/
on_gamepad_down(game_button: AnyButton) {
const group_game_buttons = Gamepad.gamepad_mapping.filter(
km =>
km.game_button &&
... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Releases any multi-buttons involved and the button itself.
* @param {AnyButton} game_button - The game button getting released
*/
on_gamepad_up(game_button: AnyButton) {
const group_game_buttons = Gamepad.gamepad_mapping.filter(
km => km.game_button && km.game_buttons?.includes(... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Registers internal listeners on the gamepad and the keyboard to trigger emulated game button.
* @param {Phaser.Game} game - Phaser game
*/
register_handle_events(game: Phaser.Game) {
game.input.gamepad.start();
game.input.gamepad.onDownCallback = (button_code: number) => {
... | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Returns a gamepad button state with its signal attached.
* @param {AnyButton} button - GBA (custom) button
* @return {GamepadButton} - GBA button state
*/
get_button(button: AnyButton): GamepadButton {
return this.buttons[button];
} | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Checks if a gamepad button is currently down.
* @param {AnyButton} button - GBA (custom) button
* @return {boolean} - Whether the gamepad button is held down
*/
is_down(button: AnyButton): boolean {
return this.buttons[button].is_down;
} | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
MethodDeclaration | /**
* Checks if a gamepad button is currently up.
* @param {AnyButton} button - GBA (custom) button
* @return {boolean} - Whether the gamepad button is up
*/
is_up(button: AnyButton): boolean {
return this.buttons[button].is_up;
} | MrBushidoBrownn/goldensun_html5 | base/XGamepad.ts | TypeScript |
ArrowFunction |
() => {
appTree = createTreeWithEmptyWorkspace();
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should update workspace.json', async () => {
await applicationGenerator(appTree, schema);
const workspaceJson = readWorkspaceConfiguration(appTree);
const projects = getProjects(appTree);
expect(projects.get('my-app').root).toEqual('apps/my-app');
expect(projects.get('my... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, schema);
const workspaceJson = readWorkspaceConfiguration(appTree);
const projects = getProjects(appTree);
expect(projects.get('my-app').root).toEqual('apps/my-app');
expect(projects.get('my-app-e2e').root).toEqual('apps/my-app-e2e');
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, tags: 'one,two' });
const nxJson = readJson(appTree, './nx.json');
expect(nxJson.projects).toEqual({
'my-app': {
tags: ['one', 'two'],
},
'my-app-e2e': {
tags: [],
implicitDependencie... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, schema);
expect(appTree.exists('apps/my-app/.babelrc')).toBeTruthy();
expect(appTree.exists('apps/my-app/.browserslistrc')).toBeTruthy();
expect(appTree.exists('apps/my-app/src/main.tsx')).toBeTruthy();
expect(appTree.exists('apps/my-app/... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should update workspace.json', async () => {
await applicationGenerator(appTree, { ...schema, directory: 'myDir' });
const workspaceJson = getProjects(appTree);
expect(workspaceJson.get('my-dir-my-app').root).toEqual(
'apps/my-dir/my-app'
);
expect(workspaceJson.... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, directory: 'myDir' });
const workspaceJson = getProjects(appTree);
expect(workspaceJson.get('my-dir-my-app').root).toEqual(
'apps/my-dir/my-app'
);
expect(workspaceJson.get('my-dir-my-app-e2e').root).toEqual(
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
directory: 'myDir',
tags: 'one,two',
});
const nxJson = readJson(appTree, '/nx.json');
expect(nxJson.projects).toEqual({
'my-dir-my-app': {
tags: ['one', 'two'],
},
'my-dir-... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
const hasJsonValue = ({ path, expectedValue, lookupFn }) => {
const config = readJson(appTree, path);
expect(lookupFn(config)).toEqual(expectedValue);
};
await applicationGenerator(appTree, { ...schema, directory: 'myDir' });
// Make sure these exist
[
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
({ path, expectedValue, lookupFn }) => {
const config = readJson(appTree, path);
expect(lookupFn(config)).toEqual(expectedValue);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
(path) => {
expect(appTree.exists(path)).toBeTruthy();
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
(json) => json.compilerOptions.outDir | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
(json) => json.extends | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, directory: 'myDir' });
expect(
appTree.read('apps/my-dir/my-app/src/app/app.tsx').toString()
).toContain('Welcome to my-app');
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async ({ style }) => {
await applicationGenerator(appTree, {
...schema,
style,
});
expect(() => {
readJson(appTree, `apps/my-app/.babelrc`);
}).not.toThrow();
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
readJson(appTree, `apps/my-app/.babelrc`);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should generate scss styles', async () => {
await applicationGenerator(appTree, { ...schema, style: 'scss' });
expect(appTree.exists('apps/my-app/src/app/app.module.scss')).toEqual(
true
);
});
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, style: 'scss' });
expect(appTree.exists('apps/my-app/src/app/app.module.scss')).toEqual(
true
);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, name: 'my-app' });
expect(appTree.read('apps/my-app/jest.config.js').toString()).toContain(
`moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],`
);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, name: 'my-app' });
expect(appTree.read('apps/my-app/jest.config.js').toString()).not.toContain(
`'jest-preset-angular/build/AngularSnapshotSerializer.js',`
);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, name: 'my-app' });
const workspaceJson = getProjects(appTree);
const targetConfig = workspaceJson.get('my-app').targets;
expect(targetConfig.build.executor).toEqual('@nrwl/web:build');
expect(targetConfig.build.outputs).toEqual(['{opti... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, name: 'my-app' });
const workspaceJson = getProjects(appTree);
const targetConfig = workspaceJson.get('my-app').targets;
expect(targetConfig.serve.executor).toEqual('@nrwl/web:dev-server');
expect(targetConfig.serve.options).toEqual({
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, name: 'my-app' });
const workspaceJson = getProjects(appTree);
expect(workspaceJson.get('my-app').targets.lint).toEqual({
executor: '@nrwl/linter:eslint',
options: {
lintFilePatterns: ['apps/my-app/**/*.{ts,tsx,js,jsx}'],
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should not generate test configuration', async () => {
await applicationGenerator(appTree, {
...schema,
unitTestRunner: 'none',
});
expect(appTree.exists('jest.config.js')).toBeFalsy();
expect(appTree.exists('apps/my-app/src/app/app.spec.tsx')).toBeFalsy();
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
unitTestRunner: 'none',
});
expect(appTree.exists('jest.config.js')).toBeFalsy();
expect(appTree.exists('apps/my-app/src/app/app.spec.tsx')).toBeFalsy();
expect(appTree.exists('apps/my-app/tsconfig.spec.json')... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should not generate test configuration', async () => {
await applicationGenerator(appTree, { ...schema, e2eTestRunner: 'none' });
expect(appTree.exists('apps/my-app-e2e')).toBeFalsy();
const workspaceJson = getProjects(appTree);
expect(workspaceJson.get('my-app-e2e')).toBeUndef... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, e2eTestRunner: 'none' });
expect(appTree.exists('apps/my-app-e2e')).toBeFalsy();
const workspaceJson = getProjects(appTree);
expect(workspaceJson.get('my-app-e2e')).toBeUndefined();
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should use upper case app file', async () => {
await applicationGenerator(appTree, { ...schema, pascalCaseFiles: true });
expect(appTree.exists('apps/my-app/src/app/App.tsx')).toBeTruthy();
expect(appTree.exists('apps/my-app/src/app/App.spec.tsx')).toBeTruthy();
expect(appTree.... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, pascalCaseFiles: true });
expect(appTree.exists('apps/my-app/src/app/App.tsx')).toBeTruthy();
expect(appTree.exists('apps/my-app/src/app/App.spec.tsx')).toBeTruthy();
expect(appTree.exists('apps/my-app/src/app/App.module.css')).toB... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, schema);
const appContent = appTree.read('apps/my-app/src/app/app.tsx').toString();
expect(appContent).not.toMatch(/extends Component/);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, linter: Linter.EsLint });
const packageJson = readJson(appTree, '/package.json');
expect(packageJson.devDependencies.eslint).toBeDefined();
expect(packageJson.devDependencies['@nrwl/linter']).toBeDefined();
expect(packageJson.devDepen... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should generate class components', async () => {
await applicationGenerator(appTree, { ...schema, classComponent: true });
const appContent = appTree.read('apps/my-app/src/app/app.tsx').toString();
expect(appContent).toMatch(/extends Component/);
});
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, classComponent: true });
const appContent = appTree.read('apps/my-app/src/app/app.tsx').toString();
expect(appContent).toMatch(/extends Component/);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should not generate any styles', async () => {
await applicationGenerator(appTree, { ...schema, style: 'none' });
expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy();
expect(appTree.exists('apps/my-app/src/app/app.spec.tsx')).toBeTruthy();
expect(appTree.exists('... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, style: 'none' });
expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy();
expect(appTree.exists('apps/my-app/src/app/app.spec.tsx')).toBeTruthy();
expect(appTree.exists('apps/my-app/src/app/app.css')).toBeFalsy();
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, style: 'none' });
const workspaceJson = readWorkspaceConfiguration(appTree);
expect(workspaceJson.generators['@nrwl/react']).toMatchObject({
application: {
style: 'none',
},
component: {
style:... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, { ...schema, style: 'none' });
const workspaceJson = getProjects(appTree);
expect(workspaceJson.get('my-app').targets.build.options.styles).toEqual(
[]
);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should use styled-components as the styled API library', async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-components',
});
expect(
appTree.exists('apps/my-app/src/app/app.styled-components')
).toBeFalsy();
expect(appTre... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-components',
});
expect(
appTree.exists('apps/my-app/src/app/app.styled-components')
).toBeFalsy();
expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy();
expect(
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-components',
});
const packageJSON = readJson(appTree, 'package.json');
expect(packageJSON.dependencies['styled-components']).toBeDefined();
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should use @emotion/styled as the styled API library', async () => {
await applicationGenerator(appTree, {
...schema,
style: '@emotion/styled',
});
expect(
appTree.exists('apps/my-app/src/app/app.@emotion/styled')
).toBeFalsy();
expect(appTree.exis... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: '@emotion/styled',
});
expect(
appTree.exists('apps/my-app/src/app/app.@emotion/styled')
).toBeFalsy();
expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy();
const content =... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: '@emotion/styled',
});
const workspaceJson = getProjects(appTree);
expect(workspaceJson.get('my-app').targets.build.options.styles).toEqual(
[]
);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: '@emotion/styled',
});
const packageJSON = readJson(appTree, 'package.json');
expect(packageJSON.dependencies['@emotion/react']).toBeDefined();
expect(packageJSON.dependencies['@emotion/styled']).toBeDe... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should use styled-jsx as the styled API library', async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-jsx',
});
expect(appTree.exists('apps/my-app/src/app/app.styled-jsx')).toBeFalsy();
expect(appTree.exists('apps/my-app/src/app/app.tsx... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-jsx',
});
expect(appTree.exists('apps/my-app/src/app/app.styled-jsx')).toBeFalsy();
expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy();
const content = appTree.read('apps/my-app... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-jsx',
});
const packageJSON = readJson(appTree, 'package.json');
expect(packageJSON.dependencies['styled-jsx']).toBeDefined();
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-jsx',
});
const babelrc = readJson(appTree, 'apps/my-app/.babelrc');
expect(babelrc.plugins).toContain('styled-jsx/babel');
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should add routes to the App component', async () => {
await applicationGenerator(appTree, {
...schema,
routing: true,
});
const mainSource = appTree.read('apps/my-app/src/main.tsx').toString();
const componentSource = appTree
.read('apps/my-app/src/app... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
routing: true,
});
const mainSource = appTree.read('apps/my-app/src/main.tsx').toString();
const componentSource = appTree
.read('apps/my-app/src/app/app.tsx')
.toString();
expect(mainSource)... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
});
const workspaceJson = getProjects(appTree);
expect(
workspaceJson.get('my-app').targets.build.options.webpackConfig
).toEqual('@nrwl/react/plugins/webpack');
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
});
const polyfillsSource = appTree
.read('apps/my-app/src/polyfills.ts')
.toString();
expect(polyfillsSource).toContain('regenerator');
expect(polyfillsSource).toContain('core-js');
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should update workspace with defaults when --skipWorkspaceJson=false', async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-components',
skipWorkspaceJson: false,
});
const workspaceJson = readWorkspaceConfiguration(appTree);
exp... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
style: 'styled-components',
skipWorkspaceJson: false,
});
const workspaceJson = readWorkspaceConfiguration(appTree);
expect(workspaceJson.generators['@nrwl/react']).toMatchObject({
application: {
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('generates JS files', async () => {
await applicationGenerator(appTree, {
...schema,
js: true,
});
expect(appTree.exists('/apps/my-app/src/app/app.js')).toBe(true);
expect(appTree.exists('/apps/my-app/src/main.js')).toBe(true);
});
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
js: true,
});
expect(appTree.exists('/apps/my-app/src/app/app.js')).toBe(true);
expect(appTree.exists('/apps/my-app/src/main.js')).toBe(true);
} | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should update tsconfig.json', async () => {
await applicationGenerator(appTree, {
...schema,
strict: true,
});
const tsconfigJson = readJson(appTree, '/apps/my-app/tsconfig.json');
expect(tsconfigJson.compilerOptions.strict).toBeTruthy();
expect(
t... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
strict: true,
});
const tsconfigJson = readJson(appTree, '/apps/my-app/tsconfig.json');
expect(tsconfigJson.compilerOptions.strict).toBeTruthy();
expect(
tsconfigJson.compilerOptions.forceConsistentCas... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ArrowFunction |
async () => {
await applicationGenerator(appTree, {
...schema,
strict: true,
});
const workspaceJson = getProjects(appTree);
const targetConfig = workspaceJson.get('my-app').targets;
expect(targetConfig.build.configurations.production.budgets).toEqual([
{
... | AlmarAubel/nx | packages/react/src/generators/application/application.spec.ts | TypeScript |
ClassDeclaration | //import { FutureDateValidator } from './directives/futureDate.directive';
/**
* This class represents the main application component. Within the @Routes annotation is the configuration of the
* applications routes, configuring the paths for the lazy loaded components (HomeComponent, AboutComponent).
*/
@Component({... | lucidcoding/ActsInTown-web | src/client/app/app.component.ts | TypeScript |
TypeAliasDeclaration |
export type ToMimetype = (input: string, defaultType?: string) => string; | uiharness/platform | code/util.mimetype/src/types.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class AuthService {
constructor(
private readonly userService: UserService,
private readonly jwtService: JwtService,
) {}
async validateUser(email: string, password: string) {
const user = await this.userService.getUserByEmail(email);
if (!user) {
return null;
}
... | filipefer1/nest-api | src/modules/auth/auth.service.ts | TypeScript |
MethodDeclaration |
async validateUser(email: string, password: string) {
const user = await this.userService.getUserByEmail(email);
if (!user) {
return null;
}
const isMatch = await bcrypt.compare(password, user.password);
if (isMatch) {
return { id: user.id, name: user.name, email: user.email };
}... | filipefer1/nest-api | src/modules/auth/auth.service.ts | TypeScript |
MethodDeclaration |
async login(user: any) {
const payload = { email: user.email, sub: user.id };
return {
acess_token: this.jwtService.sign(payload),
};
} | filipefer1/nest-api | src/modules/auth/auth.service.ts | TypeScript |
MethodDeclaration |
async decode(token: string) {
const decoded = await this.jwtService.decode(token);
return decoded;
} | filipefer1/nest-api | src/modules/auth/auth.service.ts | TypeScript |
ArrowFunction |
({
song,
index,
millis,
outputs,
}: Args): { millis: number; index: number; scheduled: MIDIEvent[] } => {
const ts = performance.now();
const { events } = song;
const scheduled = [];
// let lastNoteNumber: number = -1;
// let lastNoteType: number = -1;
while (index < events.length) {
const even... | abudaan/WebDAW | src/scheduler.ts | TypeScript |
ArrowFunction |
id => {
if (event.descr === NOTE_ON || event.descr === NOTE_OFF) {
const e = event as NoteOnEvent;
if (event.millis) {
// console.log(event.type, event.channel, event.noteNumber);
let time = ts + song.latency + track.latency + (event.millis - millis);
// ... | abudaan/WebDAW | src/scheduler.ts | TypeScript |
TypeAliasDeclaration |
type Args = {
song: Song;
millis: number;
index: number;
outputs?: WebMidi.MIDIOutputMap;
}; | abudaan/WebDAW | src/scheduler.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-editar-tarefa',
templateUrl: './editar-tarefa.component.html',
styleUrls: ['./editar-tarefa.component.css']
})
export class EditarTarefaComponent implements OnInit {
@ViewChild('formTarefa') formTarefa: NgForm
tarefa: Tarefa;
constructor(
private tarefaService: TarefaServi... | rinaldo-santana/projetos-angular | gerenciador-de-tarefas/src/app/tarefas/editar/editar-tarefa.component.ts | TypeScript |
MethodDeclaration |
ngOnInit() {
let id = +this.route.snapshot.params['id'];
this.tarefa = this.tarefaService.buscarPorId(id);
} | rinaldo-santana/projetos-angular | gerenciador-de-tarefas/src/app/tarefas/editar/editar-tarefa.component.ts | TypeScript |
MethodDeclaration |
atualizar(): void {
if (this.formTarefa.form.valid) {
this.tarefaService.atualizar(this.tarefa);
this.router.navigate(["/tarefas"]);
}
} | rinaldo-santana/projetos-angular | gerenciador-de-tarefas/src/app/tarefas/editar/editar-tarefa.component.ts | TypeScript |
ArrowFunction |
(a: number): number => 12 | DrRataplan/tsickle | test_files/arrow_fn/arrow_fn.ts | TypeScript |
ArrowFunction |
(a) => a + 12 | DrRataplan/tsickle | test_files/arrow_fn/arrow_fn.ts | TypeScript |
ArrowFunction |
(a = 10) => a | DrRataplan/tsickle | test_files/arrow_fn/arrow_fn.ts | TypeScript |
ArrowFunction |
(_spoAdminUrl: string): Promise<ContextInfo> => {
spoAdminUrl = _spoAdminUrl;
if (this.verbose) {
cmd.log(`Retrieving request digest...`);
}
return this.getRequestDigest(spoAdminUrl);
} | RedMokeys/cli-microsoft365 | src/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-deny.ts | TypeScript |
ArrowFunction |
(res: ContextInfo): Promise<string> => {
const requestOptions: any = {
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
headers: {
'X-RequestDigest': res.FormDigestValue
},
body: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" Libra... | RedMokeys/cli-microsoft365 | src/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-deny.ts | TypeScript |
ArrowFunction |
(res: string): void => {
const json: ClientSvcResponse = JSON.parse(res);
const response: ClientSvcResponseContents = json[0];
if (response.ErrorInfo) {
cb(new CommandError(response.ErrorInfo.ErrorMessage));
return;
}
else {
if (this.verbose) {
... | RedMokeys/cli-microsoft365 | src/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-deny.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.