type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
MethodDeclaration
getDefaultSortOrder(columns?: ColumnProps<T>[]): { sortColumn: any; sortOrder: any; };
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
getSortStateFromColumns(columns?: ColumnProps<T>[]): { sortColumn: any; sortOrder: any; };
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
getMaxCurrent(total: number): number | undefined;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
getSorterFn(state: TableState<T>): ((a: T, b: T) => number) | undefined;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
getCurrentPageData(): T[];
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
getFlatData(): any[];
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
getFlatCurrentPageData(): any[];
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
getLocalData(state?: TableState<T> | null, filter?: boolean): Array<T>;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
setSelectedRowKeys(selectedRowKeys: string[], selectionInfo: SelectionInfo<T>): void;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
toggleSortOrder(column: ColumnProps<T>): void;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
hasPagination(props?: any): boolean;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
isFiltersChanged(filters: TableStateFilters): boolean;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
isSortColumn(column: ColumnProps<T>): boolean;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
prepareParamsArguments(state: any): PrepareParamsArgumentsReturn<T>;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
findColumn(myKey: string | number): undefined;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
createComponents(components?: TableComponents, prevComponents?: TableComponents): void;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
recursiveSort(data: T[], sorterFn: (a: any, b: any) => number): T[];
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
renderPagination(prefixCls: string, paginationPosition: string): JSX.Element | null;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
renderRowSelection({ prefixCls, locale, getPopupContainer, }: { prefixCls: string; locale: TableLocale; getPopupContainer: TableProps<T>['getPopupContainer']; }): ColumnProps<T>[];
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
renderColumnsDropdown({ prefixCls, dropdownPrefixCls, columns, locale, getPopupContainer, }: { prefixCls: string; dropdownPrefixCls: string; columns: ColumnProps<T>[]; locale: TableLocale; getPopupContainer: TableProps<T>['getPopupContainer']; }): any[];
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
MethodDeclaration
renderColumnTitle(title: ColumnProps<T>['title']): React.ReactNode;
mperu92/OpenLab
OpenLab2019/OpenLab/node_modules/antd/es/table/Table.d.ts
TypeScript
FunctionDeclaration
//% block="move $leftrightupdown by $steps" //% group="Moving" /** * moves what blocks you see in the direction you pick */ export function move (leftrightupdown: LeftRightUpDown, steps: number) { for(let i = 0; i < steps; i++) { move_(leftrightupdown, 1) } if (not(disabled_portal == "")) { portals_two_way.push(disabled_portal) disabled_portal = "" } show() }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function move_ (leftrightupdown: LeftRightUpDown, steps: number) { if (leftrightupdown == LeftRightUpDown.Left) { if (not(xy_pos(XY.X) - steps < edge_o_world[0])) { leftright_difference += steps } } else if (leftrightupdown == LeftRightUpDown.Right) { if (not(xy_pos(XY.X) + steps > edge_o_world[1])) { leftright_difference += 0 - steps } } else if (leftrightupdown == LeftRightUpDown.Up) { if (not(xy_pos(XY.Y) - steps < edge_o_world[2])) { updown_difference += steps } } else if (leftrightupdown == LeftRightUpDown.Down) { if (not(xy_pos(XY.Y) + steps > edge_o_world[3])) { updown_difference += 0 - steps } } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function not (bool: boolean) { return (!(bool)) }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="move %leftright and %updown by $steps" //% group="Moving" /** * self-explanatory */ export function move_diagonally (leftright: LeftRight, updown: UpDown, steps: number) { for(let i = 0; i < steps; i++) { move__diagonally(leftright, updown, 1) } if (not(disabled_portal == "")) { portals_two_way.push(disabled_portal) disabled_portal = "" } show() }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function move__diagonally (leftright: LeftRight, updown: UpDown, steps: number) { if (leftright == LeftRight.Left) { if (not(xy_pos(XY.X) - steps < edge_o_world[0])) { leftright_difference += steps } } else if (leftright == LeftRight.Right) { if (not(xy_pos(XY.X) + steps > edge_o_world[1])) { leftright_difference += 0 - steps } } if (updown == UpDown.Up) { if (not(xy_pos(XY.Y) + steps > edge_o_world[3])) { updown_difference += steps } } else if (updown == UpDown.Down) { if (not(xy_pos(XY.Y) - steps < edge_o_world[2])) { updown_difference += 0 - steps } } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="draw the world" //% group="Diplaying" /** * updates the display of the world so that it moves appropriately */ export function show () { basic.clearScreen() for (let index = 0; index < world.length; index++) { led.plot(world_blocks(XY.X, index) + leftright_difference, world_blocks(XY.Y, index) + updown_difference) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="add a circle at x: $x y: $y with a radius of $radius $filled" //% group="Creating & Destroying" //% radius.fieldOptions.precision=1 //% inlineInputMode=inline /** * adds a circle */ export function add_circle (x: number, y: number, radius: number, filled: FilledUn) { if (filled == FilledUn.Filled) { diam = (radius * 2) + 1 for(let i = 0; i < diam; i++) { add_by(ColumnRow.Row, y + radius - i, 0 - radius + x, radius + x) } return } if (filled == FilledUn.Unfilled) { add_stuff(x, y, radius) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function add_stuff (x: number, y: number, radius: number) { let diam_stuff = (radius * 2) + 1 let simple = diam_stuff - 2 for(let i = 0; i < diam_stuff; i++) { add(radius + x - i, y + radius) } for(let i = 0; i < diam_stuff; i++) { add(radius + x - i, y - radius) } for(let i = 0; i < simple; i++) { add(x - radius, (y + i - simple) + radius) } for(let i = 0; i < simple; i++) { add(x + radius, (y + i - simple) + radius) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function destroy_stuff (x: number, y: number, radius: number) { let diam_stuff = (radius * 2) + 1 let simple = diam_stuff - 2 for(let i = 0; i < diam_stuff; i++) { destroy(radius + x - i, y + radius) } for(let i = 0; i < diam_stuff; i++) { destroy(radius + x - i, y - radius) } for(let i = 0; i < simple; i++) { destroy(x - radius, (y + i - simple) + radius) } for(let i = 0; i < simple; i++) { destroy(x + radius, (y + i - simple) + radius) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="add a portal at x: $x y: $y that goes to x: $tox y: $toy and is $_type" //% group="Creating & Destroying" //% inlineInputMode=inline /** * adds a portal */ export function add_portal (x: number, y: number, tox: number, toy: number, _type: OneTwo) { if (_type == OneTwo.OneWay) { portals_one_way.push("" + encode(x) + encode(y) + encode(tox) + encode(toy)) } else if (_type == OneTwo.TwoWay) { portals_two_way.push("" + encode(x) + encode(y) + encode(tox) + encode(toy)) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="set the world to $arr" //% group="Dangerous things that can mess up your world" //% inlineInputMode=inline /** * sets the world to this array */ export function set_world (arr: string[]) { world = arr }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="destroy the portal at x: $x y: $y that goes to x: $tox y: $toy and is $_type" //% group="Creating & Destroying" //% inlineInputMode=inline /** * adds a portal */ export function destroy_portal (x: number, y: number, tox: number, toy: number, _type: OneTwo) { if (_type == OneTwo.OneWay) { portals_one_way.removeAt(portals_one_way.indexOf("" + encode(x) + encode(y) + encode(tox) + encode(toy))) } else if (_type == OneTwo.TwoWay) { portals_two_way.removeAt(portals_two_way.indexOf("" + encode(x) + encode(y) + encode(tox) + encode(toy))) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="destroy a circle at x: $x y: $y with a radius of $radius $filled" //% group="Creating & Destroying" //% radius.fieldOptions.precision=1 //% inlineInputMode=inline /** * destroys a circle */ export function destroy_circle (x: number, y: number, radius: number, filled: FilledUn) { if (filled == FilledUn.Filled) { diam = (radius * 2) + 1 for(let i = 0; i < diam; i++) { destroy_by(ColumnRow.Row, y + radius - i, 0 - radius + x, radius + x) } return } if (filled == FilledUn.Unfilled) { destroy_stuff(x, y, radius) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="$xy position" //% group="Position" /** * gives you the x or y position you are at according to what you see */ export function xy_pos (xy: XY) { if (xy == XY.X) { return 2 - leftright_difference } else if (xy == XY.Y) { return 2 - updown_difference } return 0 }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="spawnpoint myself at the current position" //% group="Spawnpoint" /** * sets your spawn point to the position you are at */ export function spawnpoint () { spawn_x = xy_pos(XY.X) spawn_y = xy_pos(XY.Y) }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="set spawnpoint to x: $x y: $y" //% group="Spawnpoint" //% x.min=-9 x.max=99 //% y.min=-9 y.max=99 /** * sets your spawn point to x and y */ export function spawnpoint_at_pos (x: number, y: number) { spawn_x = x spawn_y = y }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="Destroy all blocks" //% group="Creating & Destroying" /** * removes all blocks from the world */ export function destroy_all() { for(let i = 0; i < world.length; i++) { world.pop() } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="add $details via $xy, at $at_xy" //% group="Creating & Destroying" //% details.defl="0000000000" //% inlineInputMode=inline /** * adds stuff led display style (post in issues on github if you do not understand) */ export function add_advanced (xy: XY, at_xy: number, details: string) { for(let i = 0; i < 109 - details.length; i++) { details = details + "0" } for(let i2 = 0; i2 < world.length; i2++) { if (world_blocks(xy, i2) == at_xy) { world.removeAt(i2) i2-- } } for(let i3 = -9; i3 < 100; i3++) { if (parseFloat(details.charAt(i3 + 9)) == 1) { if (xy == XY.X) { add(i3, at_xy) } else if (xy == XY.Y) { add(at_xy, i3) } } } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="destroy block at x: $x y: $y" //% group="Creating & Destroying" //% x.min=-9 x.max=99 //% y.min=-9 y.max=99 /** * destroys the blocks at x and y */ export function destroy (x: number, y: number) { if (block_detect(parseFloat(encode(x)), parseFloat(encode(y)))) { world.removeAt(find(x, y)) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="which block is at x: $x y: $y" //% group="Position" //% x.min=-9 x.max=99 //% y.min=-9 y.max=99 /** * finds where the block is in the array */ export function find (x: number, y: number) { return world.indexOf("" + encode(x) + encode(y)) }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="go to spawnpoint" //% group="Position" /** * goes to your spawn point */ export function spawn () { goto(spawn_x, spawn_y) if (not(disabled_portal == "")) { portals_two_way.push(disabled_portal) disabled_portal = "" } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="go to x: $x y: $y" //% group="Position" //% x.min=-9 x.max=99 //% y.min=-9 y.max=99 /** * goes to x and y */ export function goto (x: number, y: number) { updown_difference = 2 - y leftright_difference = 2 - x if (not(disabled_portal == "")) { portals_two_way.push(disabled_portal) disabled_portal = "" } show() }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="number of blocks in the world" //% group="Position" /** * gives you the length of the array */ export function world_blocks_detect () { return world.length }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="is there a block at x: $x_pos y: $y_pos" //% group="Detect" //% x_pos.min=-9 x_pos.max=99 //% y_pos.min=-9 y_pos.max=99 /** * checks whether or not there is a block at x and y */ export function block_detect (x_pos: number, y_pos: number) { return find(x_pos, y_pos) != -1 }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="world $xy coordinate at item $place" //% group="Position" //% place.min=1 place.max=11881 /** * gives you the x or y of an item in the array */ export function world_blocks (xy: XY, place: number) { if (xy == XY.X) { return parseFloat(world[place].substr(0, 2)) } else if (xy = XY.Y) { return parseFloat(world[place].substr(2, 2)) } return -13 }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="set edge of the world to minimum x: $min_x maximum x: $max_x minimum y: $min_y maximum y: $max_y" //% group="Position" //% inlineInputMode=inline /** * sets the edge of the world to points */ export function edge (min_x: number, max_x: number, min_y: number, max_y: number) { edge_o_world = [min_x, max_x, min_y, max_y] }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="world (array)" //% group="Position" /** * gives you do the array that you can do whatever you want with */ export function all_world_blocks () { return world }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="destroy by $columnrow at $xy from $from_xy to $to_xy " //% group="Creating & Destroying" //% xy.min=-9 xy.max=99 //% from_xy.min=-9 from_xy.max=99 //% to_xy.min=-9 to_xy.max=99 //% inlineInputMode=inline /** * self-explanatory */ export function destroy_by (columnrow: ColumnRow, xy: number, from_xy: number, to_xy: number) { if (columnrow == ColumnRow.Column) { for (let index2 = from_xy; index2 <= to_xy; index2++) { destroy(xy, index2) } } else if (columnrow == ColumnRow.Row) { for (let index3 = from_xy; index3 <= to_xy; index3++) { destroy(index3, xy) } } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="add by $columnrow at $xy from $from_xy to $to_xy " //% group="Creating & Destroying" //% xy.min=-9 xy.max=99 //% from_xy.min=-9 from_xy.max=99 //% to_xy.min=-9 to_xy.max=99 //% inlineInputMode=inline /** * self-explanatory */ export function add_by (columnrow: ColumnRow, xy: number, from_xy: number, to_xy: number) { if (columnrow == ColumnRow.Column) { for (let index2 = from_xy; index2 <= to_xy; index2++) { add(xy, index2) } } else if (columnrow == ColumnRow.Row) { for (let index3 = from_xy; index3 <= to_xy; index3++) { add(index3, xy) } } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
//% block="add x $x and y $y to the world" //% group="Creating & Destroying" //% x.min=-9 x.max=99 //% y.min=-9 y.max=99 /** * self-explanatory */ export function add (x: number, y: number) { if (not(block_detect(parseFloat(encode(x)), parseFloat(encode(y))))) { world.push("" + encode(x) + encode(y)) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function decode (txt: string) { return parseFloat(txt) }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function c1 (txt: string) { return decode(txt.substr(0, 2)) == xy_pos(XY.X) && decode(txt.substr(2, 2)) == xy_pos(XY.Y) }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function c21 (txt: string) { return decode(txt.substr(0, 2)) == xy_pos(XY.X) && decode(txt.substr(2, 2)) == xy_pos(XY.Y) }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function c22 (txt: string) { return decode(txt.substr(4, 2)) == xy_pos(XY.X) && decode(txt.substr(6, 2)) == xy_pos(XY.Y) }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function do_ur_magic1 (txt: string) { if (c1(txt)) { goto(decode(txt.substr(4, 2)), decode(txt.substr(6, 2))) } }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function do_ur_magic2 (txt: string) { if (c21(txt)) { goto(decode(txt.substr(4, 2)), decode(txt.substr(6, 2))) } else if (c22(txt)) { goto(decode(txt.substr(0, 2)), decode(txt.substr(2, 2))) } else { return } disabled_portal = txt portals_two_way.removeAt(portals_two_way.indexOf(txt)) }
joshkordek3/world-game-extension
main.ts
TypeScript
FunctionDeclaration
function encode (oof: number) { temp_txt = convertToText(oof) for (let index4 = 0; index4 < 2 - temp_txt.length; index4++) { temp_txt = "0" + temp_txt } return temp_txt }
joshkordek3/world-game-extension
main.ts
TypeScript
EnumDeclaration
enum LeftRightUpDown { //% block="Left" Left, //% block="Right" Right, //% block="Up" Up, //% block="Down" Down, }
joshkordek3/world-game-extension
main.ts
TypeScript
EnumDeclaration
enum UpDown { //% block="Up" Up, //% block="Down" Down, }
joshkordek3/world-game-extension
main.ts
TypeScript
EnumDeclaration
enum LeftRight { //% block="Left" Left, //% block="Right" Right, }
joshkordek3/world-game-extension
main.ts
TypeScript
EnumDeclaration
enum ColumnRow { //% block="Column" Column, //% block="Row" Row, }
joshkordek3/world-game-extension
main.ts
TypeScript
EnumDeclaration
enum XY { //% block="X" X, //% block="Y" Y, }
joshkordek3/world-game-extension
main.ts
TypeScript
EnumDeclaration
enum FilledUn { //% block="Filled" Filled, //% block="Unfilled" Unfilled, }
joshkordek3/world-game-extension
main.ts
TypeScript
EnumDeclaration
enum OneTwo { //% block="one way" OneWay, //% block="two way" TwoWay, }
joshkordek3/world-game-extension
main.ts
TypeScript
ArrowFunction
(router: Router): ((name: string) => string[]) => ( name: string, ): string[] => { const { routes } = router.getDependencies(); const segments = name.split('.'); const path = []; return segments.reduce((acc, segment): string[] => { path.push(segment); const route = getRoute(path.join('.'), routes); return [...acc, ...(route.chunks || [])]; }, []); }
mihanizm56/boilerplate-config-packager
config/packager/utils/source-file-parsers/ssr/sources/_utils/router/_utils/get-chunks.ts
TypeScript
ArrowFunction
( name: string, ): string[] => { const { routes } = router.getDependencies(); const segments = name.split('.'); const path = []; return segments.reduce((acc, segment): string[] => { path.push(segment); const route = getRoute(path.join('.'), routes); return [...acc, ...(route.chunks || [])]; }, []); }
mihanizm56/boilerplate-config-packager
config/packager/utils/source-file-parsers/ssr/sources/_utils/router/_utils/get-chunks.ts
TypeScript
ArrowFunction
(acc, segment): string[] => { path.push(segment); const route = getRoute(path.join('.'), routes); return [...acc, ...(route.chunks || [])]; }
mihanizm56/boilerplate-config-packager
config/packager/utils/source-file-parsers/ssr/sources/_utils/router/_utils/get-chunks.ts
TypeScript
ArrowFunction
(hre) => { if (!hre.deployments) { hre.deployments = new DeploymentsExtensionMock() } }
keep-network/hardhat-helpers
test/fixture-projects/hardhat-deploy-project/hardhat-deploy-mock/index.ts
TypeScript
InterfaceDeclaration
interface MainSectionProps { todos: Seq.Set<TodoItem>; areAllComplete: boolean; setState: StateSetter<TodoAppState>; }
antonycourtney/oneref-examples
jlongster-itemList-async-save/dist/components/MainSection.d.ts
TypeScript
FunctionDeclaration
export function withSDK<T extends Bridge = Bridge>(Base: IConstructor<T>) { const BaseClass = Base as typeof Bridge // 如果不是手机端, 就直接使用 `浏览器` API if (window.isPC) { return BaseClass } class HybridSDK extends BaseClass implements IBridge { hybridSDK: any = {} async initializeSDK(): Promise<void> { const { sdkName } = qs.parse(window.location.search.slice(1)) if (sdkName === 'kk') { const { sdk } = await import('./withKKSDK') this.hybridSDK = sdk this.showTitleBar() } } async close(): Promise<void> { this.hybridSDK.close() } scan(props: IScanProps = {}): Promise<string> { if (this.hybridSDK.scan) { return this.hybridSDK.scan(props) } return super.scan(props) } setTitle(title: string): Promise<void> { if (this.hybridSDK.setTilte) { return this.hybridSDK.setTilte(title) } return super.setTitle(title) } async openLink(link: string, props: ILinkProps = {}): Promise<void> { if (props.iframe) { return super.openURLInIframe(link, props) } if (this.hybridSDK.openLink) { return this.hybridSDK.openLink(link, props) } return super.openLink(link, props) } async share(props: IShareProps): Promise<void> { if (this.hybridSDK.share) { return this.hybridSDK.share(props) } return super.share(props) } async preview(url: string, fileName: string = ''): Promise<any> { if (this.hybridSDK.preview) { return this.hybridSDK.preview(url, fileName) } return super.preview(url, fileName) } async showTitleBar() { if (this.hybridSDK.showTitleBar) { this.hybridSDK.showTitleBar() } } } return (HybridSDK as unknown) as IConstructor<T> }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
ClassDeclaration
class HybridSDK extends BaseClass implements IBridge { hybridSDK: any = {} async initializeSDK(): Promise<void> { const { sdkName } = qs.parse(window.location.search.slice(1)) if (sdkName === 'kk') { const { sdk } = await import('./withKKSDK') this.hybridSDK = sdk this.showTitleBar() } } async close(): Promise<void> { this.hybridSDK.close() } scan(props: IScanProps = {}): Promise<string> { if (this.hybridSDK.scan) { return this.hybridSDK.scan(props) } return super.scan(props) } setTitle(title: string): Promise<void> { if (this.hybridSDK.setTilte) { return this.hybridSDK.setTilte(title) } return super.setTitle(title) } async openLink(link: string, props: ILinkProps = {}): Promise<void> { if (props.iframe) { return super.openURLInIframe(link, props) } if (this.hybridSDK.openLink) { return this.hybridSDK.openLink(link, props) } return super.openLink(link, props) } async share(props: IShareProps): Promise<void> { if (this.hybridSDK.share) { return this.hybridSDK.share(props) } return super.share(props) } async preview(url: string, fileName: string = ''): Promise<any> { if (this.hybridSDK.preview) { return this.hybridSDK.preview(url, fileName) } return super.preview(url, fileName) } async showTitleBar() { if (this.hybridSDK.showTitleBar) { this.hybridSDK.showTitleBar() } } }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
MethodDeclaration
async initializeSDK(): Promise<void> { const { sdkName } = qs.parse(window.location.search.slice(1)) if (sdkName === 'kk') { const { sdk } = await import('./withKKSDK') this.hybridSDK = sdk this.showTitleBar() } }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
MethodDeclaration
async close(): Promise<void> { this.hybridSDK.close() }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
MethodDeclaration
scan(props: IScanProps = {}): Promise<string> { if (this.hybridSDK.scan) { return this.hybridSDK.scan(props) } return super.scan(props) }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
MethodDeclaration
setTitle(title: string): Promise<void> { if (this.hybridSDK.setTilte) { return this.hybridSDK.setTilte(title) } return super.setTitle(title) }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
MethodDeclaration
async openLink(link: string, props: ILinkProps = {}): Promise<void> { if (props.iframe) { return super.openURLInIframe(link, props) } if (this.hybridSDK.openLink) { return this.hybridSDK.openLink(link, props) } return super.openLink(link, props) }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
MethodDeclaration
async share(props: IShareProps): Promise<void> { if (this.hybridSDK.share) { return this.hybridSDK.share(props) } return super.share(props) }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
MethodDeclaration
async preview(url: string, fileName: string = ''): Promise<any> { if (this.hybridSDK.preview) { return this.hybridSDK.preview(url, fileName) } return super.preview(url, fileName) }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
MethodDeclaration
async showTitleBar() { if (this.hybridSDK.showTitleBar) { this.hybridSDK.showTitleBar() } }
Leonckq/sdk_bridge
src/sdk/hybrid/withSDK.ts
TypeScript
ClassDeclaration
@NgModule({ declarations: [ HomepageComponent, SupportBotComponent, DynamicComponent, TextMessageComponent, LoadingMessageComponent, MainMenuComponent, ButtonMessageComponent, HealthCheckComponent, TalkToAgentMessageComponent, FeedbackComponent, SolutionsMessageComponent, GraphMessageComponent, ProblemStatementMessageComponent, CategoryMenuComponent, DetectorSummaryComponent, DocumentSearchComponent, DocumentSearchResultsComponent, HealthCheckV3Component ], imports: [ SharedModule, AvailabilityModule, SolutionsModule, SharedV2Module, DiagnosticDataModule ], exports: [ HomepageComponent, SupportBotComponent, CategoryMenuComponent, DetectorSummaryComponent ], providers: [ StartupMessages, MainMenuMessageFlow, HealthCheckMessageFlow, FeedbackMessageFlow, CpuAnalysisChatFlow, MessageProcessor, AvailabilityPerformanceFlow, LinuxAvailabilityPerformanceFlow, GenericCategoryFlow ] }) export class SupportBotModule { }
Sneezry/Azure-AppServices-Diagnostics-Portal
AngularApp/projects/app-service-diagnostics/src/app/supportbot/supportbot.module.ts
TypeScript
ArrowFunction
x => x === waypoint.name
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
ArrowFunction
(unboughtArticle) => { console.log(`${unboughtArticle} couldn't be accquired`) npc.scene.gameLoop.customerHappiness-- }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
ArrowFunction
(unpayedArticle) => { console.log(`${unpayedArticle} was returned`) npc.scene.gameLoop.money-- if (npc.scene.gameLoop.customerHappiness > 0) { npc.scene.gameLoop.customerHappiness-- } npc.scene.shelves[unpayedArticle].quantity++ }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
ArrowFunction
(pointer: Phaser.Input.Pointer) => { const pointerLocation = npc.scene.input.activePointer.positionToCamera(npc.scene.cameras.main) as Phaser.Math.Vector2; if (pointer.leftButtonDown()) { if (npc.scene.player.interactionRadius.circle.contains(pointerLocation.x, pointerLocation.y)) { switch (npc.scene.currentTool) { case Tools.STOP: npc.npc_state.stopped = !npc.npc_state.stopped break; case Tools.CASH: delete npc.npc_state.meta.waitForCashierUntil if (!npc.npc_state.hasPayed && npc.npc_state.waitingInLine) { npc.npc_state.shoppingBasket.forEach((boughtArticle) => { console.log(`${boughtArticle} has been sold`) npc.scene.gameLoop.money += 10 if (npc.scene.gameLoop.customerHappiness < 100) { npc.scene.gameLoop.customerHappiness++ } }) npc.npc_state.hasPayed = true npc.npc_state.waitingInLine = false } break; case Tools.FORCEOUT: if (npc.scene.store.rectangle.contains((npc.sprite.body as Phaser.Physics.Arcade.Body).x, (npc.sprite.body as Phaser.Physics.Arcade.Body).y)) { npc.npc_state.forcedOut = true npc.npc_state.waypoints = [ npc.scene.checkPoints.FarmUpstate, npc.scene.checkPoints.Entrance ] npc.npc_state.currentWaypoint = npc.scene.checkPoints.Hallway } else { console.log(`You can't force out customers that are not on the store`) } break; case Tools.MASK: npc.npc_state.wearingMask = true npc.sprite.play("idle_npc_mask") break; default: console.log(`This tool can't be used here!`) break; } } else { console.log("You left-clicked me, but I am out of your range!") } } if (pointer.rightButtonDown()) { if (npc.scene.player.interactionRadius.circle.contains(pointerLocation.x, pointerLocation.y)) { switch (npc.scene.currentTool) { default: console.log(`This tool can't be used here!`) break; } } else { console.log("You righ-clicked me, but I am out of your range!") } } }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
ArrowFunction
(boughtArticle) => { console.log(`${boughtArticle} has been sold`) npc.scene.gameLoop.money += 10 if (npc.scene.gameLoop.customerHappiness < 100) { npc.scene.gameLoop.customerHappiness++ } }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
ArrowFunction
item => { this.waypoints.push(scene.checkPoints[item]) if (['Bread', 'Dairy', 'Sweets', 'Cereal', 'Hygiene'].find(x => x === item)) { this.waypoints.push(scene.checkPoints.Hallway2) } else { this.waypoints.push(scene.checkPoints.Hallway) } }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
ArrowFunction
x => x === item
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
ClassDeclaration
class NPCState { declare wearingMask: boolean declare patienceScore: number declare understandingScore: number declare shoppingList: Articles[] declare shoppingBasket: Articles[] declare waypoints: Phaser.GameObjects.GameObject[] declare currentWaypoint: Phaser.GameObjects.GameObject declare waitingInLine: boolean declare hasPayed: boolean declare forcedOut: boolean declare stopped: boolean declare meta: { [key: string]: any } constructor(scene: CoronaShopSimScene) { this.wearingMask = Boolean(randomIntFromInterval(0, 1)) this.patienceScore = randomIntFromInterval(1, 10) / 10 this.understandingScore = randomIntFromInterval(1, 10) / 10 this.shoppingList = this.generateShoppingList() this.shoppingBasket = [] this.waypoints = [ scene.checkPoints.FarmUpstate, scene.checkPoints.Entrance, scene.checkPoints.Hallway, scene.checkPoints.Register, scene.checkPoints.Hallway ] this.currentWaypoint = scene.checkPoints.Entrance this.populateWaypointsFromShoppingList(scene) this.waitingInLine = false this.hasPayed = false this.forcedOut = false this.stopped = false this.meta = {} } private generateShoppingList(): Articles[] { let amountOfArticles = randomIntFromInterval(1, 10) let shoppingList: Articles[] = [] for (let article = 0; article < amountOfArticles; article++) { shoppingList.push(randomEnum(Articles)) } return shoppingList } private populateWaypointsFromShoppingList(scene: CoronaShopSimScene) { this.shoppingList.forEach(item => { this.waypoints.push(scene.checkPoints[item]) if (['Bread', 'Dairy', 'Sweets', 'Cereal', 'Hygiene'].find(x => x === item)) { this.waypoints.push(scene.checkPoints.Hallway2) } else { this.waypoints.push(scene.checkPoints.Hallway) } }) this.waypoints.push(scene.checkPoints.Hallway) } }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
MethodDeclaration
update() { const npc = this let body = npc.sprite.body as Phaser.Physics.Arcade.Body if ( npc.npc_state.stopped || (npc.npc_state.meta.waitUntil && npc.npc_state.meta.waitUntil > npc.scene.gameLoop.totalPlayTime) || (npc.npc_state.meta.waitForCashierUntil && npc.npc_state.meta.waitForCashierUntil > npc.scene.gameLoop.totalPlayTime) || (npc.npc_state.meta.waitForRefillUntil && npc.npc_state.meta.waitForRefillUntil > npc.scene.gameLoop.totalPlayTime) ) { body.setVelocity(0); return } const speed = 40; let waypoint = (npc.npc_state.currentWaypoint as any) as { x: number, y: number, name: string } // Stop any previous movement from the last frame body.setVelocity(0); if (waypoint && (npc.sprite.x !== waypoint.x || npc.sprite.y !== waypoint.y)) { if (waypoint.y <= npc.sprite.y) { body.setVelocityY(-speed) } else { body.setVelocityY(speed) } if (waypoint.x <= npc.sprite.x) { body.setVelocityX(-speed) } else { body.setVelocityX(speed) } } if (waypoint && Math.abs(npc.sprite.x - waypoint.x) < 8 && Math.abs(npc.sprite.y - waypoint.y) < 8) { if (Object.keys(Articles).some(x => x === waypoint.name)) { if (npc.scene.shelves[waypoint.name].quantity > 0) { npc.npc_state.shoppingList.splice(npc.npc_state.shoppingList.indexOf(Articles[waypoint.name])) npc.scene.shelves[waypoint.name].quantity-- if (npc.scene.shelves[waypoint.name].dirtyness <= 80) { npc.scene.shelves[waypoint.name].dirtyness = npc.scene.shelves[waypoint.name].dirtyness + 20 } npc.npc_state.shoppingBasket.push(Articles[waypoint.name]) npc.npc_state.currentWaypoint = npc.npc_state.waypoints.pop() if (npc.npc_state.meta.waitForRefillUntil) { delete npc.npc_state.meta.waitForRefillUntil } else { npc.npc_state.meta.waitUntil = npc.scene.gameLoop.totalPlayTime + 2_500 } } else if (!npc.npc_state.meta.waitForRefillUntil) { // TODO: Show needed article npc.npc_state.meta.waitForRefillUntil = npc.scene.gameLoop.totalPlayTime + 7_500 } else if (npc.npc_state.meta.waitForRefillUntil < npc.scene.gameLoop.totalPlayTime) { npc.npc_state.currentWaypoint = npc.npc_state.waypoints.pop() } } else if (waypoint.name === 'Register' && npc.npc_state.shoppingBasket.length > 0) { npc.npc_state.currentWaypoint = npc.npc_state.waypoints.pop() npc.npc_state.waitingInLine = true npc.npc_state.meta.waitForCashierUntil = npc.scene.gameLoop.totalPlayTime + 25_000 } else { npc.npc_state.currentWaypoint = npc.npc_state.waypoints.pop() } } if (npc.npc_state.currentWaypoint === undefined) { npc.npc_state.shoppingList.forEach((unboughtArticle) => { console.log(`${unboughtArticle} couldn't be accquired`) npc.scene.gameLoop.customerHappiness-- }) if (!npc.npc_state.hasPayed) { npc.npc_state.shoppingBasket.forEach((unpayedArticle) => { console.log(`${unpayedArticle} was returned`) npc.scene.gameLoop.money-- if (npc.scene.gameLoop.customerHappiness > 0) { npc.scene.gameLoop.customerHappiness-- } npc.scene.shelves[unpayedArticle].quantity++ }) if (npc.npc_state.forcedOut) { if (npc.scene.gameLoop.customerHappiness >= 10) { npc.scene.gameLoop.customerHappiness -= 10 } else { npc.scene.gameLoop.customerHappiness = 0 } } } npc.destroy() } body.velocity.normalize().scale(speed); }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
MethodDeclaration
destroy() { let npc = this npc.destroyed = true npc.sprite.destroy() }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
MethodDeclaration
private initializeSprite(x: number, y: number, npc: NPC): Phaser.GameObjects.Sprite { let sprite = npc.scene.physics.add.sprite(x, y, "npc_sprite") .setInteractive() .on(Phaser.Input.Events.POINTER_DOWN, (pointer: Phaser.Input.Pointer) => { const pointerLocation = npc.scene.input.activePointer.positionToCamera(npc.scene.cameras.main) as Phaser.Math.Vector2; if (pointer.leftButtonDown()) { if (npc.scene.player.interactionRadius.circle.contains(pointerLocation.x, pointerLocation.y)) { switch (npc.scene.currentTool) { case Tools.STOP: npc.npc_state.stopped = !npc.npc_state.stopped break; case Tools.CASH: delete npc.npc_state.meta.waitForCashierUntil if (!npc.npc_state.hasPayed && npc.npc_state.waitingInLine) { npc.npc_state.shoppingBasket.forEach((boughtArticle) => { console.log(`${boughtArticle} has been sold`) npc.scene.gameLoop.money += 10 if (npc.scene.gameLoop.customerHappiness < 100) { npc.scene.gameLoop.customerHappiness++ } }) npc.npc_state.hasPayed = true npc.npc_state.waitingInLine = false } break; case Tools.FORCEOUT: if (npc.scene.store.rectangle.contains((npc.sprite.body as Phaser.Physics.Arcade.Body).x, (npc.sprite.body as Phaser.Physics.Arcade.Body).y)) { npc.npc_state.forcedOut = true npc.npc_state.waypoints = [ npc.scene.checkPoints.FarmUpstate, npc.scene.checkPoints.Entrance ] npc.npc_state.currentWaypoint = npc.scene.checkPoints.Hallway } else { console.log(`You can't force out customers that are not on the store`) } break; case Tools.MASK: npc.npc_state.wearingMask = true npc.sprite.play("idle_npc_mask") break; default: console.log(`This tool can't be used here!`) break; } } else { console.log("You left-clicked me, but I am out of your range!") } } if (pointer.rightButtonDown()) { if (npc.scene.player.interactionRadius.circle.contains(pointerLocation.x, pointerLocation.y)) { switch (npc.scene.currentTool) { default: console.log(`This tool can't be used here!`) break; } } else { console.log("You righ-clicked me, but I am out of your range!") } } }) .on(Phaser.Input.Events.POINTER_OVER, () => { }) .on(Phaser.Input.Events.POINTER_OUT, () => { }) .setDepth(2) return sprite }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
MethodDeclaration
private generateShoppingList(): Articles[] { let amountOfArticles = randomIntFromInterval(1, 10) let shoppingList: Articles[] = [] for (let article = 0; article < amountOfArticles; article++) { shoppingList.push(randomEnum(Articles)) } return shoppingList }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
MethodDeclaration
private populateWaypointsFromShoppingList(scene: CoronaShopSimScene) { this.shoppingList.forEach(item => { this.waypoints.push(scene.checkPoints[item]) if (['Bread', 'Dairy', 'Sweets', 'Cereal', 'Hygiene'].find(x => x === item)) { this.waypoints.push(scene.checkPoints.Hallway2) } else { this.waypoints.push(scene.checkPoints.Hallway) } }) this.waypoints.push(scene.checkPoints.Hallway) }
bmo-at/corona-shop-sim
src/entities/npc.ts
TypeScript
ArrowFunction
async () => connections = await createTestingConnections({ entities: [__dirname + "/entity/*{.js,.ts}"], schemaCreate: true, dropSchemaOnConnection: true, })
hisamu/typeorm
test/functional/relations/multiple-primary-keys/multiple-primary-keys-many-to-one/multiple-primary-keys-many-to-one.ts
TypeScript
ArrowFunction
() => Promise.all(connections.map(async connection => { const category1 = new Category(); category1.name = "cars"; category1.type = "common-category"; category1.code = 1; category1.version = 1; await connection.manager.save(category1); const category2 = new Category(); category2.name = "airplanes"; category2.type = "common-category"; category2.code = 2; category2.version = 1; await connection.manager.save(category2); const post1 = new Post(); post1.title = "About BMW"; post1.category = category1; await connection.manager.save(post1); const post2 = new Post(); post2.title = "About Boeing"; post2.category = category2; await connection.manager.save(post2); const loadedPosts = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.category", "category") .orderBy("post.id") .getMany(); expect(loadedPosts[0].category).to.not.be.empty; expect(loadedPosts[0].category.name).to.be.equal("cars"); expect(loadedPosts[0].category.type).to.be.equal("common-category"); expect(loadedPosts[1].category).to.not.be.empty; expect(loadedPosts[1].category.name).to.be.equal("airplanes"); expect(loadedPosts[1].category.type).to.be.equal("common-category"); const loadedPost = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.category", "category") .where("post.id = :id", {id: 1}) .getOne(); expect(loadedPost!.category).to.not.be.empty; expect(loadedPost!.category.name).to.be.equal("cars"); expect(loadedPost!.category.type).to.be.equal("common-category"); }))
hisamu/typeorm
test/functional/relations/multiple-primary-keys/multiple-primary-keys-many-to-one/multiple-primary-keys-many-to-one.ts
TypeScript
ArrowFunction
async connection => { const category1 = new Category(); category1.name = "cars"; category1.type = "common-category"; category1.code = 1; category1.version = 1; await connection.manager.save(category1); const category2 = new Category(); category2.name = "airplanes"; category2.type = "common-category"; category2.code = 2; category2.version = 1; await connection.manager.save(category2); const post1 = new Post(); post1.title = "About BMW"; post1.category = category1; await connection.manager.save(post1); const post2 = new Post(); post2.title = "About Boeing"; post2.category = category2; await connection.manager.save(post2); const loadedPosts = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.category", "category") .orderBy("post.id") .getMany(); expect(loadedPosts[0].category).to.not.be.empty; expect(loadedPosts[0].category.name).to.be.equal("cars"); expect(loadedPosts[0].category.type).to.be.equal("common-category"); expect(loadedPosts[1].category).to.not.be.empty; expect(loadedPosts[1].category.name).to.be.equal("airplanes"); expect(loadedPosts[1].category.type).to.be.equal("common-category"); const loadedPost = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.category", "category") .where("post.id = :id", {id: 1}) .getOne(); expect(loadedPost!.category).to.not.be.empty; expect(loadedPost!.category.name).to.be.equal("cars"); expect(loadedPost!.category.type).to.be.equal("common-category"); }
hisamu/typeorm
test/functional/relations/multiple-primary-keys/multiple-primary-keys-many-to-one/multiple-primary-keys-many-to-one.ts
TypeScript
ArrowFunction
() => Promise.all(connections.map(async connection => { const category1 = new Category(); category1.name = "cars"; category1.type = "common-category"; category1.code = 1; category1.version = 1; await connection.manager.save(category1); const category2 = new Category(); category2.name = "airplanes"; category2.type = "common-category"; category2.code = 2; category2.version = 1; await connection.manager.save(category2); const post1 = new Post(); post1.title = "About BMW"; post1.categoryWithEmptyJoinColumn = category1; await connection.manager.save(post1); const post2 = new Post(); post2.title = "About Boeing"; post2.categoryWithEmptyJoinColumn = category2; await connection.manager.save(post2); const loadedPosts = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.categoryWithEmptyJoinColumn", "category") .orderBy("post.id") .getMany(); expect(loadedPosts[0].categoryWithEmptyJoinColumn).to.not.be.empty; expect(loadedPosts[0].categoryWithEmptyJoinColumn.name).to.be.equal("cars"); expect(loadedPosts[0].categoryWithEmptyJoinColumn.type).to.be.equal("common-category"); expect(loadedPosts[1].categoryWithEmptyJoinColumn).to.not.be.empty; expect(loadedPosts[1].categoryWithEmptyJoinColumn.name).to.be.equal("airplanes"); expect(loadedPosts[1].categoryWithEmptyJoinColumn.type).to.be.equal("common-category"); const loadedPost = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.categoryWithEmptyJoinColumn", "category") .where("post.id = :id", {id: 1}) .getOne(); expect(loadedPost!.categoryWithEmptyJoinColumn).to.not.be.empty; expect(loadedPost!.categoryWithEmptyJoinColumn.name).to.be.equal("cars"); expect(loadedPost!.categoryWithEmptyJoinColumn.type).to.be.equal("common-category"); }))
hisamu/typeorm
test/functional/relations/multiple-primary-keys/multiple-primary-keys-many-to-one/multiple-primary-keys-many-to-one.ts
TypeScript
ArrowFunction
async connection => { const category1 = new Category(); category1.name = "cars"; category1.type = "common-category"; category1.code = 1; category1.version = 1; await connection.manager.save(category1); const category2 = new Category(); category2.name = "airplanes"; category2.type = "common-category"; category2.code = 2; category2.version = 1; await connection.manager.save(category2); const post1 = new Post(); post1.title = "About BMW"; post1.categoryWithEmptyJoinColumn = category1; await connection.manager.save(post1); const post2 = new Post(); post2.title = "About Boeing"; post2.categoryWithEmptyJoinColumn = category2; await connection.manager.save(post2); const loadedPosts = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.categoryWithEmptyJoinColumn", "category") .orderBy("post.id") .getMany(); expect(loadedPosts[0].categoryWithEmptyJoinColumn).to.not.be.empty; expect(loadedPosts[0].categoryWithEmptyJoinColumn.name).to.be.equal("cars"); expect(loadedPosts[0].categoryWithEmptyJoinColumn.type).to.be.equal("common-category"); expect(loadedPosts[1].categoryWithEmptyJoinColumn).to.not.be.empty; expect(loadedPosts[1].categoryWithEmptyJoinColumn.name).to.be.equal("airplanes"); expect(loadedPosts[1].categoryWithEmptyJoinColumn.type).to.be.equal("common-category"); const loadedPost = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.categoryWithEmptyJoinColumn", "category") .where("post.id = :id", {id: 1}) .getOne(); expect(loadedPost!.categoryWithEmptyJoinColumn).to.not.be.empty; expect(loadedPost!.categoryWithEmptyJoinColumn.name).to.be.equal("cars"); expect(loadedPost!.categoryWithEmptyJoinColumn.type).to.be.equal("common-category"); }
hisamu/typeorm
test/functional/relations/multiple-primary-keys/multiple-primary-keys-many-to-one/multiple-primary-keys-many-to-one.ts
TypeScript
ArrowFunction
() => Promise.all(connections.map(async connection => { const category1 = new Category(); category1.name = "cars"; category1.type = "common-category"; category1.code = 1; category1.version = 1; await connection.manager.save(category1); const category2 = new Category(); category2.name = "airplanes"; category2.type = "common-category"; category2.code = 2; category2.version = 1; await connection.manager.save(category2); const post1 = new Post(); post1.title = "About BMW"; post1.categoryWithOptions = category1; await connection.manager.save(post1); const post2 = new Post(); post2.title = "About Boeing"; post2.categoryWithOptions = category2; await connection.manager.save(post2); const loadedPosts = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.categoryWithOptions", "category") .orderBy("post.id") .getMany(); expect(loadedPosts[0].categoryWithOptions).to.not.be.empty; expect(loadedPosts[0].categoryWithOptions.name).to.be.equal("cars"); expect(loadedPosts[0].categoryWithOptions.type).to.be.equal("common-category"); expect(loadedPosts[1].categoryWithOptions).to.not.be.empty; expect(loadedPosts[1].categoryWithOptions.name).to.be.equal("airplanes"); expect(loadedPosts[1].categoryWithOptions.type).to.be.equal("common-category"); const loadedPost = await connection.manager .createQueryBuilder(Post, "post") .leftJoinAndSelect("post.categoryWithOptions", "category") .where("post.id = :id", {id: 1}) .getOne(); expect(loadedPost!.categoryWithOptions).to.not.be.empty; expect(loadedPost!.categoryWithOptions.name).to.be.equal("cars"); expect(loadedPost!.categoryWithOptions.type).to.be.equal("common-category"); }))
hisamu/typeorm
test/functional/relations/multiple-primary-keys/multiple-primary-keys-many-to-one/multiple-primary-keys-many-to-one.ts
TypeScript