type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
(success) =>{ this.gituser =this.serviceusersearch.user; }
antonymburia/github-search
src/app/user-data/user-data.component.ts
TypeScript
ArrowFunction
(error)=>{ alert(error); }
antonymburia/github-search
src/app/user-data/user-data.component.ts
TypeScript
ArrowFunction
(success)=>{ this.newrepo = success return(this.newrepo) }
antonymburia/github-search
src/app/user-data/user-data.component.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-user-data', templateUrl: './user-data.component.html', styleUrls: ['./user-data.component.css'] }) export class UserDataComponent implements OnInit { gituser!: UserData[]; newrepo!: Repos[]; constructor(public serviceusersearch: UserSearchService, public reposearch: RepoSearchService) { } userinput(search: any) { this.serviceusersearch.usersearch(search).then( (success) =>{ this.gituser =this.serviceusersearch.user; }, (error)=>{ alert(error); } ); this.reposearch.FetchRepositories(search).subscribe( (success)=>{ this.newrepo = success return(this.newrepo) } ) } ngOnInit(): void { this.userinput('antonymburia'); } }
antonymburia/github-search
src/app/user-data/user-data.component.ts
TypeScript
MethodDeclaration
userinput(search: any) { this.serviceusersearch.usersearch(search).then( (success) =>{ this.gituser =this.serviceusersearch.user; }, (error)=>{ alert(error); } ); this.reposearch.FetchRepositories(search).subscribe( (success)=>{ this.newrepo = success return(this.newrepo) } ) }
antonymburia/github-search
src/app/user-data/user-data.component.ts
TypeScript
MethodDeclaration
ngOnInit(): void { this.userinput('antonymburia'); }
antonymburia/github-search
src/app/user-data/user-data.component.ts
TypeScript
InterfaceDeclaration
export interface DeleteLinkResponse { /** * Unique Oracle-assigned identifier for the request. If you need to contact * Oracle about a particular request, please provide the request ID. * */ "opcRequestId": string; }
ramjiiyengar/oci-typescript-sdk
lib/tenantmanagercontrolplane/lib/response/delete-link-response.ts
TypeScript
ClassDeclaration
export class PlatformWrapper extends EventEmitter { private platform: any = null /** * Here we set an adprovider, any can be given as long as it implements the IProvider interface * * @param platform */ public setPlatform(platform: any): void { if (platform) { this.platform = platform this.platform.setWrapper(this) } } public gameLoaded(...args: any[]): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.gameLoaded.apply(this.platform, args) } public gameStarted(...args: any[]): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.gameStarted.apply(this.platform, args) } public getGameSettings(...args: any[]): any { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.getGameSettings.apply(this.platform, args) } public gameEnded(fail: boolean, score?: number, level?: number | string, ...args: any[]): void { if (null === this.platform) { throw new Error( 'Can not request an ad without an provider, please attach an ad provider!' ) } this.platform.gameEnded.apply(this.platform, args) if (score) { this.sendScore(score) } } public gamePaused(...args: any[]): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.gamePaused.apply(this.platform, args) } public gameResumed(...args: any[]): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.gameResumed.apply(this.platform, args) } public sendScore(score: number): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.sendScore.apply(this.platform, score) } }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
MethodDeclaration
/** * Here we set an adprovider, any can be given as long as it implements the IProvider interface * * @param platform */ public setPlatform(platform: any): void { if (platform) { this.platform = platform this.platform.setWrapper(this) } }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
MethodDeclaration
public gameLoaded(...args: any[]): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.gameLoaded.apply(this.platform, args) }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
MethodDeclaration
public gameStarted(...args: any[]): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.gameStarted.apply(this.platform, args) }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
MethodDeclaration
public getGameSettings(...args: any[]): any { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.getGameSettings.apply(this.platform, args) }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
MethodDeclaration
public gameEnded(fail: boolean, score?: number, level?: number | string, ...args: any[]): void { if (null === this.platform) { throw new Error( 'Can not request an ad without an provider, please attach an ad provider!' ) } this.platform.gameEnded.apply(this.platform, args) if (score) { this.sendScore(score) } }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
MethodDeclaration
public gamePaused(...args: any[]): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.gamePaused.apply(this.platform, args) }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
MethodDeclaration
public gameResumed(...args: any[]): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.gameResumed.apply(this.platform, args) }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
MethodDeclaration
public sendScore(score: number): void { if (null === this.platform) { //Silently return for when no platform is set return } this.platform.sendScore.apply(this.platform, score) }
azerion/h5-platform-wrapper
src/platform-wrapper.ts
TypeScript
ClassDeclaration
export declare class CategoriesController { private categoriesService; constructor(categoriesService: CategoriesService); getAllCategories(limit: number, offset: number, brand: string): import("../entitis/categories.entity").Categories[]; getCategories(productId: number): import("../entitis/categories.entity").Categories; createCategories(payload: CreateCategorie): { name: string; stock: number; logo: string; id: number; }; updateCategorie(id: number, payload: UpdateCategories): { id: number; name: string; stock: number; logo?: string; }; delete(id: number): boolean; }
pritorres/practic-store
dist/controllers/categories.controller.d.ts
TypeScript
MethodDeclaration
getAllCategories(limit: number, offset: number, brand: string): import("../entitis/categories.entity").Categories[];
pritorres/practic-store
dist/controllers/categories.controller.d.ts
TypeScript
MethodDeclaration
getCategories(productId: number): import("../entitis/categories.entity").Categories;
pritorres/practic-store
dist/controllers/categories.controller.d.ts
TypeScript
MethodDeclaration
createCategories(payload: CreateCategorie): { name: string; stock: number; logo: string; id: number; };
pritorres/practic-store
dist/controllers/categories.controller.d.ts
TypeScript
MethodDeclaration
updateCategorie(id: number, payload: UpdateCategories): { id: number; name: string; stock: number; logo?: string; };
pritorres/practic-store
dist/controllers/categories.controller.d.ts
TypeScript
MethodDeclaration
delete(id: number): boolean;
pritorres/practic-store
dist/controllers/categories.controller.d.ts
TypeScript
ArrowFunction
(routeProps: RouteProperties) => routeProps.route === route
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
ClassDeclaration
@Injectable({ providedIn: 'root' }) export class ProjectMapService { projectData: Project; constructor() { this.projectData = projectData; } getRoute(route: string) { const found = this.findRoute(route); return (found > -1) ? this.projectData.routes[found] : undefined; } setRoute(routeProps: RouteProperties) { routeProps.route = this.normalizeRoute(routeProps.route); const found = this.findRoute(routeProps.route); if (found > -1) { this.projectData.routes[found] = routeProps; } else { this.projectData.routes.push(routeProps); } } findRoute(route: string): number { route = this.normalizeRoute(route); return this.projectData.routes.findIndex((routeProps: RouteProperties) => routeProps.route === route); } normalizeRoute(route: string): string { if ( route === '' ) { route = '/'; } return route; } getGlobalExits() { return this.projectData.globalExits; } setGlobalExits(globalExits: Exit[]) { this.projectData.globalExits = globalExits; } export() { const a = document.createElement('a'); a.href = URL.createObjectURL( new Blob([JSON.stringify(this.projectData)], {type: 'application/json'}) ); a.download = 'project.json'; a.click(); } reset() { this.projectData = { routes: [ { route: '/', description: 'Homepage for the website', exits: [], forms: [] } ], globalExits: [ { route: '/', visibleText: 'Home', routeLocations: [''] } ] }; } }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
MethodDeclaration
getRoute(route: string) { const found = this.findRoute(route); return (found > -1) ? this.projectData.routes[found] : undefined; }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
MethodDeclaration
setRoute(routeProps: RouteProperties) { routeProps.route = this.normalizeRoute(routeProps.route); const found = this.findRoute(routeProps.route); if (found > -1) { this.projectData.routes[found] = routeProps; } else { this.projectData.routes.push(routeProps); } }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
MethodDeclaration
findRoute(route: string): number { route = this.normalizeRoute(route); return this.projectData.routes.findIndex((routeProps: RouteProperties) => routeProps.route === route); }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
MethodDeclaration
normalizeRoute(route: string): string { if ( route === '' ) { route = '/'; } return route; }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
MethodDeclaration
getGlobalExits() { return this.projectData.globalExits; }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
MethodDeclaration
setGlobalExits(globalExits: Exit[]) { this.projectData.globalExits = globalExits; }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
MethodDeclaration
export() { const a = document.createElement('a'); a.href = URL.createObjectURL( new Blob([JSON.stringify(this.projectData)], {type: 'application/json'}) ); a.download = 'project.json'; a.click(); }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
MethodDeclaration
reset() { this.projectData = { routes: [ { route: '/', description: 'Homepage for the website', exits: [], forms: [] } ], globalExits: [ { route: '/', visibleText: 'Home', routeLocations: [''] } ] }; }
starkraving/hangular-cli
src/project-map/files/src/app/scaffular/service/project-map.service.ts
TypeScript
ArrowFunction
(proxy) => ( <li className="nav-item"
lsjroberts/muster
packages/muster-devtools/src/ui/pages/network/view.tsx
TypeScript
ClassDeclaration
export class NetworkView extends React.PureComponent<NetworkProps> { constructor(props: NetworkProps) { super(props); if (props.selectedProxyId === undefined && props.proxies.length > 0) { props.setSelectedProxyId(props.proxies[0].id); } } render() { const { isInstanceSelected, proxies, selectedProxyId, setSelectedProxyId } = this.props; if (!isInstanceSelected) { return <h1 className="centered-heading">Select Muster instance to begin</h1>; } return ( <> {selectedProxyId === undefined && ( <h1 className="centered-heading">Select Proxy instance to begin</h1> )}
lsjroberts/muster
packages/muster-devtools/src/ui/pages/network/view.tsx
TypeScript
InterfaceDeclaration
export interface MiddlewareProxy { id: string; path: Array<any>; }
lsjroberts/muster
packages/muster-devtools/src/ui/pages/network/view.tsx
TypeScript
InterfaceDeclaration
export interface NetworkProps { isInstanceSelected: boolean; proxies: Array<MiddlewareProxy>; selectedProxyId: string | undefined; setSelectedProxyId: (value: string | undefined) => void; }
lsjroberts/muster
packages/muster-devtools/src/ui/pages/network/view.tsx
TypeScript
MethodDeclaration
render() { const { isInstanceSelected, proxies, selectedProxyId, setSelectedProxyId } = this.props; if (!isInstanceSelected) { return <h1 className="centered-heading">Select Muster instance to begin</h1>; } return ( <> {selectedProxyId === undefined && ( <h1 className="centered-heading">Select Proxy instance to begin</h1> )}
lsjroberts/muster
packages/muster-devtools/src/ui/pages/network/view.tsx
TypeScript
MethodDeclaration
classnames('nav-link', { active: selectedProxyId
lsjroberts/muster
packages/muster-devtools/src/ui/pages/network/view.tsx
TypeScript
ArrowFunction
() => { beforeEach(() => { cy.login(); cy.goToAdultMeasures(); cy.goToMeasure("HVL-AD"); }); it("Ensure correct sections display if user is/not reporting", () => { cy.displaysSectionsWhenUserNotReporting(); cy.displaysSectionsWhenUserIsReporting(); }); it("If not reporting and not why not -> show error", () => { cy.get('[data-cy="DidReport1"]').click(); cy.get('[data-cy="Validate Measure"]').click(); cy.get( '[data-cy="Why Are You Not Reporting On This Measure Error"]' ).should("have.text", "Why Are You Not Reporting On This Measure Error"); }); it("should show correct measurement spec", () => { cy.get("#MeasurementSpecification-HRSA").should( "have.text", "Health Resources and Services Administration (HRSA)" ); }); it("should show correct data source options", () => { cy.get( '[data-cy="DataSource0"] > .chakra-checkbox__label > .chakra-text' ).should("have.text", "Administrative Data"); cy.get( '[data-cy="DataSource1"] > .chakra-checkbox__label > .chakra-text' ).should("have.text", "Electronic Health Records"); cy.get( '[data-cy="DataSource2"] > .chakra-checkbox__label > .chakra-text' ).should("have.text", "Other Data Source"); }); it("if primary measurement spec is selected -> show performance measures", () => { cy.get("#MeasurementSpecification-HRSA").click(); cy.get('[data-cy="Performance Measure"]').should( "have.text", "Performance Measure" ); cy.get('[data-cy="Ages 18 to 64"]').should("have.text", "Ages 18 to 64"); cy.get('[data-cy="Age 65 and older"]').should( "have.text", "Age 65 and older" ); }); it("if other measurement spec is selected -> show other performance measures", () => { cy.get('[data-cy="DidReport0"]').click(); cy.get('[data-cy="MeasurementSpecification1"]').click(); cy.get( '[data-cy="MeasurementSpecification-OtherMeasurementSpecificationDescription"]' ).should("be.visible"); cy.get('[data-cy="Other Performance Measure"]').should("be.visible"); }); it("if only admin data cannot override, if anything else, rate is editable", () => { cy.get("#MeasurementSpecification-HRSA").click(); cy.get( '[data-cy="PerformanceMeasure.rates.singleCategory.0.numerator"]' ).type("5"); cy.get( '[data-cy="PerformanceMeasure.rates.singleCategory.0.denominator"]' ).type("5"); cy.get('[data-cy="DataSource2"] > .chakra-checkbox__control').click(); cy.get('[data-cy="PerformanceMeasure.rates.singleCategory.0.rate"]').should( "not.have.attr", "aria-readonly" ); }); it("at least one dnr set if reporting and measurement spec or error.", () => { cy.get('[data-cy="DidReport0"]').click(); cy.get('[data-cy="Validate Measure"]').click(); cy.get( '[data-cy="Performance Measure/Other Performance Measure Error"]' ).should("be.visible"); }); it("if yes for combined rates → and no additional selection → show warning", () => { cy.get('[data-cy="DidReport0"]').click(); cy.get('[data-cy="MeasurementSpecification0"]').click(); cy.get('[data-cy="CombinedRates0"]').click(); cy.get('[data-cy="Validate Measure"]').click(); cy.get( '[data-cy="You must select at least one option for Combined Rate(s) Details if Yes is selected."]' ).should( "have.text", "You must select at least one option for Combined Rate(s) Details if Yes is selected." ); }); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.login(); cy.goToAdultMeasures(); cy.goToMeasure("HVL-AD"); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.displaysSectionsWhenUserNotReporting(); cy.displaysSectionsWhenUserIsReporting(); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.get('[data-cy="DidReport1"]').click(); cy.get('[data-cy="Validate Measure"]').click(); cy.get( '[data-cy="Why Are You Not Reporting On This Measure Error"]' ).should("have.text", "Why Are You Not Reporting On This Measure Error"); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.get("#MeasurementSpecification-HRSA").should( "have.text", "Health Resources and Services Administration (HRSA)" ); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.get( '[data-cy="DataSource0"] > .chakra-checkbox__label > .chakra-text' ).should("have.text", "Administrative Data"); cy.get( '[data-cy="DataSource1"] > .chakra-checkbox__label > .chakra-text' ).should("have.text", "Electronic Health Records"); cy.get( '[data-cy="DataSource2"] > .chakra-checkbox__label > .chakra-text' ).should("have.text", "Other Data Source"); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.get("#MeasurementSpecification-HRSA").click(); cy.get('[data-cy="Performance Measure"]').should( "have.text", "Performance Measure" ); cy.get('[data-cy="Ages 18 to 64"]').should("have.text", "Ages 18 to 64"); cy.get('[data-cy="Age 65 and older"]').should( "have.text", "Age 65 and older" ); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.get('[data-cy="DidReport0"]').click(); cy.get('[data-cy="MeasurementSpecification1"]').click(); cy.get( '[data-cy="MeasurementSpecification-OtherMeasurementSpecificationDescription"]' ).should("be.visible"); cy.get('[data-cy="Other Performance Measure"]').should("be.visible"); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.get("#MeasurementSpecification-HRSA").click(); cy.get( '[data-cy="PerformanceMeasure.rates.singleCategory.0.numerator"]' ).type("5"); cy.get( '[data-cy="PerformanceMeasure.rates.singleCategory.0.denominator"]' ).type("5"); cy.get('[data-cy="DataSource2"] > .chakra-checkbox__control').click(); cy.get('[data-cy="PerformanceMeasure.rates.singleCategory.0.rate"]').should( "not.have.attr", "aria-readonly" ); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.get('[data-cy="DidReport0"]').click(); cy.get('[data-cy="Validate Measure"]').click(); cy.get( '[data-cy="Performance Measure/Other Performance Measure Error"]' ).should("be.visible"); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { cy.get('[data-cy="DidReport0"]').click(); cy.get('[data-cy="MeasurementSpecification0"]').click(); cy.get('[data-cy="CombinedRates0"]').click(); cy.get('[data-cy="Validate Measure"]').click(); cy.get( '[data-cy="You must select at least one option for Combined Rate(s) Details if Yes is selected."]' ).should( "have.text", "You must select at least one option for Combined Rate(s) Details if Yes is selected." ); }
CMSgov/cms-mdct-qmr
tests/cypress/cypress/integration/measures/HVLAD.spec.ts
TypeScript
ArrowFunction
() => { let component: SpringBootAngularCrudComponent; let fixture: ComponentFixture<SpringBootAngularCrudComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ SpringBootAngularCrudComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(SpringBootAngularCrudComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); }
DevelopByTarun/FullStack-Crud-With-Angular6-SpringBoot-And-Mongodb
Frontend/src/app/spring-boot-angular-crud/spring-boot-angular-crud.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ declarations: [ SpringBootAngularCrudComponent ] }) .compileComponents(); }
DevelopByTarun/FullStack-Crud-With-Angular6-SpringBoot-And-Mongodb
Frontend/src/app/spring-boot-angular-crud/spring-boot-angular-crud.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(SpringBootAngularCrudComponent); component = fixture.componentInstance; fixture.detectChanges(); }
DevelopByTarun/FullStack-Crud-With-Angular6-SpringBoot-And-Mongodb
Frontend/src/app/spring-boot-angular-crud/spring-boot-angular-crud.component.spec.ts
TypeScript
ClassDeclaration
export class TaskStatusValidationPipe implements PipeTransform { readonly allowedStatuses = [ TaskStatus.OPEN, TaskStatus.IN_PROGRESS, TaskStatus.DONE, ]; transform(value: any){ value = value.toUpperCase(); if (!this.isStatusValid(value)) { throw new BadRequestException(`"${value}" is an invalid status`); } return value; } private isStatusValid(status: any) { const idx = this.allowedStatuses.indexOf(status); return idx !== -1; } }
enesozkurt/Task-Management-App
src/tasks/pipes/task-status-validation.pipe.ts
TypeScript
MethodDeclaration
transform(value: any){ value = value.toUpperCase(); if (!this.isStatusValid(value)) { throw new BadRequestException(`"${value}" is an invalid status`); } return value; }
enesozkurt/Task-Management-App
src/tasks/pipes/task-status-validation.pipe.ts
TypeScript
MethodDeclaration
private isStatusValid(status: any) { const idx = this.allowedStatuses.indexOf(status); return idx !== -1; }
enesozkurt/Task-Management-App
src/tasks/pipes/task-status-validation.pipe.ts
TypeScript
ArrowFunction
(...args) => args.join('_')
cMikolai/findify-js
packages/react-components/src/components/RatingFacet/index.ts
TypeScript
ArrowFunction
({ facet, config }) => ({ items: facet.get('values') })
cMikolai/findify-js
packages/react-components/src/components/RatingFacet/index.ts
TypeScript
FunctionDeclaration
export default function TourmalineJewelersSvgComponent(props: { icon: Icon }) { return ( <Svg width={props.icon.width} height={props.icon.height} viewBox="0 0 512 512"> <G fill={props.icon.color}> <Polygon points="393.06 130.05 393.06 36.854 293.87 36.854"/> <Polygon points="141.81 149.73 370.19 149.73 256 42.436"/> <Polygon points="385.13 179.73 126.87 179.73 256 475.15"/> <Polygon points="118.94 130.05 218.13 36.854 118.94 36.854"/> <Polygon points="88.938 149.73 88.938 59.447 3.25 149.73"/> <Polygon points="423.06 149.73 508.75 149.73 423.06 59.447"/> <Polygon points="417.88 179.73 312.55 420.67 512 179.73"/> <Polygon points="94.125 179.73 0 179.73 199.45 420.67"/> </G> </Svg> ); }
calebjmatthews/endless-desert
components/svg/symbols/tourmaline_jewelers.tsx
TypeScript
ArrowFunction
() => Highcharts
ejaszke/ns-plugins
packages/nativescript-highcharts/angular/index.ts
TypeScript
ClassDeclaration
@NgModule({ declarations: [HighchartsDirective], exports: [HighchartsDirective], }) export class HighchartsModule {}
ejaszke/ns-plugins
packages/nativescript-highcharts/angular/index.ts
TypeScript
ArrowFunction
(image: any, layer: SKLayer): Image => { // 画板图赋值 if (layer._class === 'artboard') { image.value = layer.imageUrl; // 切片转换为图片 } else if (layer.imageUrl) { image.type = 'Image'; image.value = layer.imageUrl; } return image; }
Chunxiaolalala/Picasso
packages/picasso-parse/src/parseDSL/parseImage.ts
TypeScript
FunctionDeclaration
function isRenderLocation(node: Node): node is Node & IRenderLocation { return node.textContent === 'au-end'; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
ArrowFunction
() => NodeSequence.empty
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
ArrowFunction
proto => { proto.previousSibling = null!; proto.childNodes = PLATFORM.emptyArray; proto.nodeName = 'AU-M'; proto.nodeType = NodeType.Element; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
ClassDeclaration
/** * IDOM implementation for Html. */ export class HTMLDOM implements IDOM { public readonly Node: typeof Node; public readonly Element: typeof Element; public readonly HTMLElement: typeof HTMLElement; public readonly CustomEvent: typeof CustomEvent; public readonly window: Window; public readonly document: Document; constructor( window: Window, document: Document, TNode: typeof Node, TElement: typeof Element, THTMLElement: typeof HTMLElement, TCustomEvent: typeof CustomEvent ) { this.window = window; this.document = document; this.Node = TNode; this.Element = TElement; this.HTMLElement = THTMLElement; this.CustomEvent = TCustomEvent; if (DOM.isInitialized) { Reporter.write(1001); // TODO: create reporters code // DOM already initialized (just info) DOM.destroy(); } DOM.initialize(this); } public static register(container: IContainer): IResolver<HTMLDOM> { return Registration.alias(IDOM, this).register(container); } public addEventListener(eventName: string, subscriber: EventListenerOrEventListenerObject, publisher?: Node, options?: boolean | AddEventListenerOptions): void { (publisher || this.document).addEventListener(eventName, subscriber, options); } public appendChild(parent: Node, child: Node): void { parent.appendChild(child); } public cloneNode<T>(node: T, deep?: boolean): T { return (node as unknown as Node).cloneNode(deep !== false) as unknown as T; } public convertToRenderLocation(node: Node): IRenderLocation { if (this.isRenderLocation(node)) { return node; // it's already a IRenderLocation (converted by FragmentNodeSequence) } if (node.parentNode == null) { throw Reporter.error(52); } const locationEnd = this.document.createComment('au-end'); const locationStart = this.document.createComment('au-start'); node.parentNode.replaceChild(locationEnd, node); locationEnd.parentNode!.insertBefore(locationStart, locationEnd); (locationEnd as IRenderLocation).$start = locationStart as IRenderLocation; (locationStart as IRenderLocation).$nodes = null!; return locationEnd as IRenderLocation; } public createDocumentFragment(markupOrNode?: string | Node): DocumentFragment { if (markupOrNode == null) { return this.document.createDocumentFragment(); } if (this.isNodeInstance(markupOrNode)) { if ((markupOrNode as HTMLTemplateElement).content !== undefined) { return (markupOrNode as HTMLTemplateElement).content; } const fragment = this.document.createDocumentFragment(); fragment.appendChild(markupOrNode); return fragment; } return this.createTemplate(markupOrNode).content; } public createElement(name: string): HTMLElement { return this.document.createElement(name); } public fetch(input: RequestInfo, init?: RequestInit): Promise<Response> { return this.window.fetch(input, init); } // tslint:disable-next-line:no-any // this is how the DOM is typed public createCustomEvent<T = any>(eventType: string, options?: CustomEventInit<T>): CustomEvent<T> { return new this.CustomEvent(eventType, options); } public dispatchEvent(evt: Event): void { this.document.dispatchEvent(evt); } public createNodeObserver(node: Node, cb: MutationCallback, init: MutationObserverInit): MutationObserver { if (typeof MutationObserver === 'undefined') { // TODO: find a proper response for this scenario return { disconnect(): void { /*empty*/ }, observe(): void { /*empty*/ }, takeRecords(): MutationRecord[] { return PLATFORM.emptyArray as typeof PLATFORM.emptyArray & MutationRecord[]; } }; } const observer = new MutationObserver(cb); observer.observe(node, init); return observer; } public createTemplate(markup?: unknown): HTMLTemplateElement { if (markup == null) { return this.document.createElement('template'); } const template = this.document.createElement('template'); template.innerHTML = (markup as string | object).toString(); return template; } public createTextNode(text: string): Text { return this.document.createTextNode(text); } public insertBefore(nodeToInsert: Node, referenceNode: Node): void { referenceNode.parentNode!.insertBefore(nodeToInsert, referenceNode); } public isMarker(node: unknown): node is HTMLElement { return (node as AuMarker).nodeName === 'AU-M'; } public isNodeInstance(potentialNode: unknown): potentialNode is Node { return potentialNode != null && (potentialNode as Node).nodeType > 0; } public isRenderLocation(node: unknown): node is IRenderLocation { return (node as Comment).textContent === 'au-end'; } public makeTarget(node: unknown): void { (node as Element).className = 'au'; } public registerElementResolver(container: IContainer, resolver: IResolver): void { container.registerResolver(INode, resolver); container.registerResolver(this.Node, resolver); container.registerResolver(this.Element, resolver); container.registerResolver(this.HTMLElement, resolver); } public remove(node: Node): void { if ((node as ChildNode).remove) { (node as ChildNode).remove(); } else { node.parentNode!.removeChild(node); } } public removeEventListener(eventName: string, subscriber: EventListenerOrEventListenerObject, publisher?: Node, options?: boolean | EventListenerOptions): void { (publisher || this.document).removeEventListener(eventName, subscriber, options); } public setAttribute(node: Element, name: string, value: unknown): void { node.setAttribute(name, value as string); } }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
ClassDeclaration
/** * A specialized INodeSequence with optimizations for text (interpolation) bindings * The contract of this INodeSequence is: * - the previous element is an `au-m` node * - text is the actual text node */ /** @internal */ export class TextNodeSequence implements INodeSequence { public isMounted: boolean; public isLinked: boolean; public dom: HTMLDOM; public firstChild: Text; public lastChild: Text; public childNodes: Text[]; public next?: INodeSequence<Node>; private refNode?: Node; private readonly targets: [Node]; constructor(dom: HTMLDOM, text: Text) { this.isMounted = false; this.isLinked = false; this.dom = dom; this.firstChild = text; this.lastChild = text; this.childNodes = [text]; this.targets = [new AuMarker(text) as unknown as Node]; this.next = void 0; this.refNode = void 0; } public findTargets(): ArrayLike<Node> { return this.targets; } public insertBefore(refNode: Node): void { if (this.isLinked && !!this.refNode) { this.addToLinked(); } else { this.isMounted = true; refNode.parentNode!.insertBefore(this.firstChild, refNode); } } public appendTo(parent: Node): void { if (this.isLinked && !!this.refNode) { this.addToLinked(); } else { this.isMounted = true; parent.appendChild(this.firstChild); } } public remove(): void { this.isMounted = false; this.firstChild.remove(); } public addToLinked(): void { const refNode = this.refNode!; this.isMounted = true; refNode.parentNode!.insertBefore(this.firstChild, refNode); } public unlink(): void { this.isLinked = false; this.next = void 0; this.refNode = void 0; } public link(next: INodeSequence<Node> | (IRenderLocation & Comment) | undefined): void { this.isLinked = true; if (this.dom.isRenderLocation(next)) { this.refNode = next; } else { this.next = next; this.obtainRefNode(); } } private obtainRefNode(): void { if (this.next !== void 0) { this.refNode = this.next.firstChild; } else { this.refNode = void 0; } } }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
ClassDeclaration
// tslint:enable:no-any // This is the most common form of INodeSequence. // Every custom element or template controller whose node sequence is based on an HTML template // has an instance of this under the hood. Anyone who wants to create a node sequence from // a string of markup would also receive an instance of this. // CompiledTemplates create instances of FragmentNodeSequence. /** * This is the most common form of INodeSequence. * @internal */ export class FragmentNodeSequence implements INodeSequence { public isMounted: boolean; public isLinked: boolean; public dom: IDOM; public firstChild: Node; public lastChild: Node; public childNodes: Node[]; public next?: INodeSequence<Node>; private refNode?: Node; private readonly fragment: DocumentFragment; private readonly targets: ArrayLike<Node>; constructor(dom: IDOM, fragment: DocumentFragment) { this.isMounted = false; this.isLinked = false; this.dom = dom; this.fragment = fragment; // tslint:disable-next-line:no-any const targetNodeList = fragment.querySelectorAll('.au'); let i = 0; let ii = targetNodeList.length; const targets = this.targets = Array(ii); while (i < ii) { // eagerly convert all markers to RenderLocations (otherwise the renderer // will do it anyway) and store them in the target list (since the comments // can't be queried) const target = targetNodeList[i]; if (target.nodeName === 'AU-M') { // note the renderer will still call this method, but it will just return the // location if it sees it's already a location targets[i] = this.dom.convertToRenderLocation(target); } else { // also store non-markers for consistent ordering targets[i] = target; } ++i; } const childNodeList = fragment.childNodes; i = 0; ii = childNodeList.length; const childNodes = this.childNodes = Array(ii); while (i < ii) { childNodes[i] = childNodeList[i] as Writable<Node>; ++i; } this.firstChild = fragment.firstChild!; this.lastChild = fragment.lastChild!; this.next = void 0; this.refNode = void 0; } public findTargets(): ArrayLike<Node> { return this.targets; } public insertBefore(refNode: IRenderLocation & Comment): void { if (this.isLinked && !!this.refNode) { this.addToLinked(); } else { const parent = refNode.parentNode!; if (this.isMounted) { let current = this.firstChild; const end = this.lastChild; let next: Node; while (current != null) { next = current.nextSibling!; parent.insertBefore(current, refNode); if (current === end) { break; } current = next; } } else { this.isMounted = true; refNode.parentNode!.insertBefore(this.fragment, refNode); } } } public appendTo(parent: Node): void { if (this.isMounted) { let current = this.firstChild; const end = this.lastChild; let next: Node; while (current != null) { next = current.nextSibling!; parent.appendChild(current); if (current === end) { break; } current = next; } } else { this.isMounted = true; parent.appendChild(this.fragment); } } public remove(): void { if (this.isMounted) { this.isMounted = false; const fragment = this.fragment; const end = this.lastChild; let next: Node; let current = this.firstChild; while (current !== null) { next = current.nextSibling!; fragment.appendChild(current); if (current === end) { break; } current = next; } } } public addToLinked(): void { const refNode = this.refNode!; const parent = refNode.parentNode!; if (this.isMounted) { let current = this.firstChild; const end = this.lastChild; let next: Node; while (current != null) { next = current.nextSibling!; parent.insertBefore(current, refNode); if (current === end) { break; } current = next; } } else { this.isMounted = true; parent.insertBefore(this.fragment, refNode); } } public unlink(): void { this.isLinked = false; this.next = void 0; this.refNode = void 0; } public link(next: INodeSequence<Node> | IRenderLocation & Comment | undefined): void { this.isLinked = true; if (this.dom.isRenderLocation(next)) { this.refNode = next; } else { this.next = next; this.obtainRefNode(); } } private obtainRefNode(): void { if (this.next !== void 0) { this.refNode = this.next.firstChild; } else { this.refNode = void 0; } } }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
ClassDeclaration
export class NodeSequenceFactory implements NodeSequenceFactory { private readonly dom: IDOM; private readonly deepClone!: boolean; private readonly node!: Node; private readonly Type!: Constructable<INodeSequence>; constructor(dom: IDOM, markupOrNode: string | Node) { this.dom = dom; const fragment = dom.createDocumentFragment(markupOrNode) as DocumentFragment; const childNodes = fragment.childNodes; switch (childNodes.length) { case 0: this.createNodeSequence = () => NodeSequence.empty; return; case 2: const target = childNodes[0]; if (target.nodeName === 'AU-M' || target.nodeName === '#comment') { const text = childNodes[1]; if (text.nodeType === NodeType.Text && text.textContent!.length === 0) { this.deepClone = false; this.node = text; this.Type = TextNodeSequence; return; } } // falls through if not returned default: this.deepClone = true; this.node = fragment; this.Type = FragmentNodeSequence; } } public createNodeSequence(): INodeSequence { return new this.Type(this.dom, this.node.cloneNode(this.deepClone)); } }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
ClassDeclaration
/** @internal */ export class AuMarker implements INode { public get parentNode(): Node & ParentNode { return this.nextSibling.parentNode!; } public readonly nextSibling: Node; public readonly previousSibling!: Node; public readonly content?: Node; public readonly childNodes!: ArrayLike<ChildNode>; public readonly nodeName!: 'AU-M'; public readonly nodeType!: NodeType.Element; public textContent: string; constructor(next: Node) { this.nextSibling = next; this.textContent = ''; } public remove(): void { /* do nothing */ } }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
ClassDeclaration
/** @internal */ export class HTMLTemplateFactory implements ITemplateFactory { public static readonly inject: InjectArray = [IDOM]; private readonly dom: IDOM; constructor(dom: IDOM) { this.dom = dom; } public static register(container: IContainer): IResolver<ITemplateFactory> { return Registration.singleton(ITemplateFactory, this).register(container); } public create(parentRenderContext: IRenderContext, definition: TemplateDefinition): ITemplate { return new CompiledTemplate(this.dom, definition, new NodeSequenceFactory(this.dom, definition.template as string | Node), parentRenderContext); } }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
InterfaceDeclaration
export interface NodeSequenceFactory { createNodeSequence(): INodeSequence; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
InterfaceDeclaration
export interface AuMarker extends INode { }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
EnumDeclaration
export const enum NodeType { Element = 1, Attr = 2, Text = 3, CDATASection = 4, EntityReference = 5, Entity = 6, ProcessingInstruction = 7, Comment = 8, Document = 9, DocumentType = 10, DocumentFragment = 11, Notation = 12 }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public static register(container: IContainer): IResolver<HTMLDOM> { return Registration.alias(IDOM, this).register(container); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public addEventListener(eventName: string, subscriber: EventListenerOrEventListenerObject, publisher?: Node, options?: boolean | AddEventListenerOptions): void { (publisher || this.document).addEventListener(eventName, subscriber, options); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public appendChild(parent: Node, child: Node): void { parent.appendChild(child); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public cloneNode<T>(node: T, deep?: boolean): T { return (node as unknown as Node).cloneNode(deep !== false) as unknown as T; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public convertToRenderLocation(node: Node): IRenderLocation { if (this.isRenderLocation(node)) { return node; // it's already a IRenderLocation (converted by FragmentNodeSequence) } if (node.parentNode == null) { throw Reporter.error(52); } const locationEnd = this.document.createComment('au-end'); const locationStart = this.document.createComment('au-start'); node.parentNode.replaceChild(locationEnd, node); locationEnd.parentNode!.insertBefore(locationStart, locationEnd); (locationEnd as IRenderLocation).$start = locationStart as IRenderLocation; (locationStart as IRenderLocation).$nodes = null!; return locationEnd as IRenderLocation; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public createDocumentFragment(markupOrNode?: string | Node): DocumentFragment { if (markupOrNode == null) { return this.document.createDocumentFragment(); } if (this.isNodeInstance(markupOrNode)) { if ((markupOrNode as HTMLTemplateElement).content !== undefined) { return (markupOrNode as HTMLTemplateElement).content; } const fragment = this.document.createDocumentFragment(); fragment.appendChild(markupOrNode); return fragment; } return this.createTemplate(markupOrNode).content; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public createElement(name: string): HTMLElement { return this.document.createElement(name); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public fetch(input: RequestInfo, init?: RequestInit): Promise<Response> { return this.window.fetch(input, init); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
// tslint:disable-next-line:no-any // this is how the DOM is typed public createCustomEvent<T = any>(eventType: string, options?: CustomEventInit<T>): CustomEvent<T> { return new this.CustomEvent(eventType, options); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public dispatchEvent(evt: Event): void { this.document.dispatchEvent(evt); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public createNodeObserver(node: Node, cb: MutationCallback, init: MutationObserverInit): MutationObserver { if (typeof MutationObserver === 'undefined') { // TODO: find a proper response for this scenario return { disconnect(): void { /*empty*/ }, observe(): void { /*empty*/ }, takeRecords(): MutationRecord[] { return PLATFORM.emptyArray as typeof PLATFORM.emptyArray & MutationRecord[]; } }; } const observer = new MutationObserver(cb); observer.observe(node, init); return observer; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
disconnect(): void { /*empty*/ }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
observe(): void { /*empty*/ }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
takeRecords(): MutationRecord[] { return PLATFORM.emptyArray as typeof PLATFORM.emptyArray & MutationRecord[]; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public createTemplate(markup?: unknown): HTMLTemplateElement { if (markup == null) { return this.document.createElement('template'); } const template = this.document.createElement('template'); template.innerHTML = (markup as string | object).toString(); return template; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public createTextNode(text: string): Text { return this.document.createTextNode(text); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public insertBefore(nodeToInsert: Node, referenceNode: Node): void { referenceNode.parentNode!.insertBefore(nodeToInsert, referenceNode); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public isMarker(node: unknown): node is HTMLElement { return (node as AuMarker).nodeName === 'AU-M'; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public isNodeInstance(potentialNode: unknown): potentialNode is Node { return potentialNode != null && (potentialNode as Node).nodeType > 0; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public isRenderLocation(node: unknown): node is IRenderLocation { return (node as Comment).textContent === 'au-end'; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public makeTarget(node: unknown): void { (node as Element).className = 'au'; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public registerElementResolver(container: IContainer, resolver: IResolver): void { container.registerResolver(INode, resolver); container.registerResolver(this.Node, resolver); container.registerResolver(this.Element, resolver); container.registerResolver(this.HTMLElement, resolver); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public remove(node: Node): void { if ((node as ChildNode).remove) { (node as ChildNode).remove(); } else { node.parentNode!.removeChild(node); } }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public removeEventListener(eventName: string, subscriber: EventListenerOrEventListenerObject, publisher?: Node, options?: boolean | EventListenerOptions): void { (publisher || this.document).removeEventListener(eventName, subscriber, options); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public setAttribute(node: Element, name: string, value: unknown): void { node.setAttribute(name, value as string); }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public findTargets(): ArrayLike<Node> { return this.targets; }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript
MethodDeclaration
public insertBefore(refNode: Node): void { if (this.isLinked && !!this.refNode) { this.addToLinked(); } else { this.isMounted = true; refNode.parentNode!.insertBefore(this.firstChild, refNode); } }
josiahhaswell/aurelia
packages/runtime-html/src/dom.ts
TypeScript