type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
name => { if (!ruleNames[name]) { throw new Error(`found undefined reference ${name}`); } }
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
ClassDeclaration
class parseError extends Error { public fragmentSize: number; constructor(message: string, fragmentSize: number) { super(message); this.fragmentSize = fragmentSize; } }
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
MethodDeclaration
public Parse(rulesDoc: string): Rules { const referencedNames = [] as string[]; let fragment = rulesDoc; const rules = [] as Rule[]; try { for (;;) { const r = this.parseRule(fragment, referencedNames); if (r) { rules.push(...
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
MethodDeclaration
private parseRule( inputFragment: string, referenceNames: string[] ): {rule: Rule; fragment: string} | null { let fragment = inputFragment.trimStart(); for (;;) { if (fragment.length == 0) { return null; } if (fragment.match(/^[(]...
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
MethodDeclaration
private parseAlternationNode( inputFragment: string, closeBracket: string, referenceNames: string[] ): {node: RuleNode; fragment: string} { const alternations = [[]] as RuleNode[][]; let nodes = alternations[0] as RuleNode[]; let fragment = inputFragment; for...
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
MethodDeclaration
private parseStringNode( fragment: string ): {node: RuleNode; fragment: string} { let escaped = false; let text = ''; const quote = fragment[0]; for (let i = 1; i < fragment.length; i++) { if (escaped) { escaped = false; switch (fr...
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
MethodDeclaration
private parseRegexNode( fragment: string ): {node: RuleNode; fragment: string} { let text = ''; for (let i = 1; i < fragment.length; i++) { switch (fragment[i]) { case '/': return { node: { t...
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
MethodDeclaration
private parseReferenceNode( fragment: string, referencedNames: string[] ): {node: RuleNode; fragment: string} { const name = fragment.match(/^\w+/); if (!name) { throw new Error('implemented error'); } referencedNames.push(name[0]); return { ...
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
MethodDeclaration
private checkReferences(rules: Rule[], referencedNames: string[]) { const ruleNames = {} as {[index: string]: boolean}; rules.forEach(rule => { ruleNames[rule.name] = true; }); referencedNames.forEach(name => { if (!ruleNames[name]) { throw new Er...
74th/ls-ebnf-parser
src/ruleparser.ts
TypeScript
ArrowFunction
() => { it ('getParsedStatement should return null when no operation match', () => { const matcher = new StatementMatcher( 'select', /^[^\S]*?select\b[\s\S]+?\bfrom[\s\n\r\[\(]+([^\]\s\n\r,)(;]*)/gim ); const res = matcher.getParsedStatement('update user set age=1;'); expect(res).to.be....
MichaelMULLER/pandora
packages/component-auto-patching/test/StatementMatcher.test.ts
TypeScript
ArrowFunction
() => { const matcher = new StatementMatcher( 'select', /^[^\S]*?select\b[\s\S]+?\bfrom[\s\n\r\[\(]+([^\]\s\n\r,)(;]*)/gim ); const res = matcher.getParsedStatement('update user set age=1;'); expect(res).to.be.null; }
MichaelMULLER/pandora
packages/component-auto-patching/test/StatementMatcher.test.ts
TypeScript
ArrowFunction
(event) => { if (!event.data || (event.data !== 'ok' && !event.data.error)) { return; } const eventSourceWindow = event.source as Window; const childRunner = ChildRunner.get(eventSourceWindow); if (!childRunner) { return; } childRunner.ready(); // The name of the suite as exposed to the user. ...
Acidburn0zzz/learn-reader
packages/wct-mocha/src/environment/compatability.ts
TypeScript
ArrowFunction
(_event: BeforeUnloadEvent) => { // Mocha's hook queue is asynchronous; but we want synchronous behavior if // we've gotten to the point of unloading the document. Mocha.Runner['immediately'] = (callback: () => void) => { callback(); }; }
Acidburn0zzz/learn-reader
packages/wct-mocha/src/environment/compatability.ts
TypeScript
ArrowFunction
(callback: () => void) => { callback(); }
Acidburn0zzz/learn-reader
packages/wct-mocha/src/environment/compatability.ts
TypeScript
ArrowFunction
async (configService: ConfigService) => { console.log('MONGO_URI=', process.env.MONGO_URI); return ({ uri: process.env.MONGO_URI || configService.get('MONGO_URI'), useNewUrlParser: true, useUnifiedTopology: true, useFindAndModify: ...
ethiers/quote-server
src/app.module.ts
TypeScript
ClassDeclaration
@Module({ imports: [MongooseModule.forRootAsync({ imports: [ConfigModule], useFactory: async (configService: ConfigService) => { console.log('MONGO_URI=', process.env.MONGO_URI); return ({ uri: process.env.MONGO_URI || configService.get('MONGO_URI'), ...
ethiers/quote-server
src/app.module.ts
TypeScript
MethodDeclaration
configure(consumer: MiddlewareConsumer): any { consumer.apply(LoggerMiddleware).forRoutes('quotes'); }
ethiers/quote-server
src/app.module.ts
TypeScript
ArrowFunction
() => { let componentWrapper: RenderResult; let componentProps: React.ComponentProps<typeof GestionPedido> & { listarPedido: SinonStub; finalizarPedido: SinonStub; eliminarProductoSolicitado: SinonStub; }; beforeEach(() => { componentProps = { pedido: { id: 1, numeroPedid...
davidecb/adn-ceiba-front
src/app/feature/Pedido/containers/GestionPedido/GestionPedido.spec.tsx
TypeScript
ArrowFunction
() => { componentProps = { pedido: { id: 1, numeroPedido: '123456789', direccion: '', cliente: '', estado: '', costo: 10000, tiempo: 30, productosSolicitados:[] }, listarPedido: stub(), finalizarPedido: stub(), eliminarPr...
davidecb/adn-ceiba-front
src/app/feature/Pedido/containers/GestionPedido/GestionPedido.spec.tsx
TypeScript
ArrowFunction
() => { expect(componentWrapper.container).toMatchSnapshot(); }
davidecb/adn-ceiba-front
src/app/feature/Pedido/containers/GestionPedido/GestionPedido.spec.tsx
TypeScript
FunctionDeclaration
/** * deploy the given contract * * @param {String} from - sender address * @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ). * @param {String} value - decimal representation of value. * @param {String} gasLimit - decimal representation of gas limit....
KenMan79/remix-project
libs/remix-lib/src/execution/txExecution.ts
TypeScript
FunctionDeclaration
/** * call the current given contract ! that will create a transaction ! * * @param {String} from - sender address * @param {String} to - recipient address * @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ). * @param {String} value - decimal represen...
KenMan79/remix-project
libs/remix-lib/src/execution/txExecution.ts
TypeScript
FunctionDeclaration
/** * check if the vm has errored * * @param {Object} execResult - execution result given by the VM * @return {Object} - { error: true/false, message: DOMNode } */ export function checkVMError (execResult, abi, contract) { const errorCode = { OUT_OF_GAS: 'out of gas', STACK_UNDERFLOW: 'stack und...
KenMan79/remix-project
libs/remix-lib/src/execution/txExecution.ts
TypeScript
ArrowFunction
(error, txResult) => { // see universaldapp.js line 660 => 700 to check possible values of txResult (error case) finalCallback(error, txResult) }
KenMan79/remix-project
libs/remix-lib/src/execution/txExecution.ts
TypeScript
MethodDeclaration
install(vue: Application): void { registerComponent(vue, SpAccountList) }
Siyris/vue
packages/vue/src/components/SpAccountList/index.ts
TypeScript
InterfaceDeclaration
export interface ThemeModel { themeID: number; libelle: string; ordre: number; questions: QuestionModel[]; }
ptrkvsky/nomad
src/isadom-models/questionnaire/front/ThemeModel.ts
TypeScript
ArrowFunction
params => { if (params['id'] != null) { this.fetchData(params['id']); this.isView = true; this.disabled = true; this.isReadOnly = true; } }
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
ArrowFunction
(response) => { if (response) { this.model.stationCode = response.stationCode; this.model.nameOfStation = response.nameOfStation; this.model.county = response.county; this.model.headOfStation = response.headOfStation; this.model.location = response.location; ...
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
ArrowFunction
(response) => { console.log(response); if (response) { inst.notify.showSuccess(response.message); this.router.navigate(['home/master-data/police-station']); } else { inst.notify.showWarning(response.message); } }
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
ArrowFunction
error => { console.log(error); inst.notify.showWarning(error.error.message); }
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
ArrowFunction
(response) => { console.log(response); if (response.code === 200) { inst.notify.showSuccess(response.message); this.router.navigate(['home/master-data/police-station']); } else { inst.notify.showWarning(response.message); } }
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-add-police-station', templateUrl: './add-police-station.component.html', styleUrls: ['./add-police-station.component.scss'] }) export class AddPoliceStationComponent implements OnInit { model: PoliceStationModel; subscription: Subscription; isUpdate: boolean; isReadOnly = fals...
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
MethodDeclaration
ngOnInit() { this.route.params.subscribe(params => { if (params['id'] != null) { this.fetchData(params['id']); this.isView = true; this.disabled = true; this.isReadOnly = true; } }); }
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
MethodDeclaration
private fetchData(id: number) { const inst = this; inst.subscription.add( this.stewardService.getMasterData('app/rest/v2/entities/ecurfew_PoliceStation/' + id).subscribe((response) => { if (response) { this.model.stationCode = response.stationCode; this.model.nameOfStation = r...
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
MethodDeclaration
@HostListener('window:beforeunload') // tslint:disable-next-line: use-life-cycle-interface ngOnDestroy(): void { if (this.subscription) { this.subscription.unsubscribe(); } }
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
MethodDeclaration
enableUpdate() { this.isReadOnly = false; this.isUpdate = !this.isUpdate; }
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
MethodDeclaration
disableUpdate() { this.isReadOnly = true; this.isUpdate = !this.isUpdate; }
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
MethodDeclaration
onCreateForm(createForm: NgForm) { const params: Map<any, string> = new Map(); const inst = this; if (this.isUpdate) { this.stewardService.put('app/rest/v2/update/station/' + this.id, this.model).subscribe((response) => { console.log(response); if (response) { inst.notify.sh...
Hanan-Hussein/eCurfewFrontend
src/app/views/layout/master-data/police-station/add-police-station/add-police-station.component.ts
TypeScript
ArrowFunction
() => { let testServer: ApolloServer; const username: string = "jimmy"; const email: string = "jimmy@gmail.com"; const password: string = "notHashed!"; beforeAll(async () => { testServer = await createTestServer(); }); describe("when the username is taken", () => { let result: GraphQLResponse; ...
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { testServer = await createTestServer(); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
() => { let result: GraphQLResponse; let duplicateUser: User; beforeAll(async () => { duplicateUser = await factory .for(User) .with({ username }) .create(); const { mutate } = createTestClient(testServer); result = await mutate({ mutation: registerMutati...
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { duplicateUser = await factory .for(User) .with({ username }) .create(); const { mutate } = createTestClient(testServer); result = await mutate({ mutation: registerMutation, variables: { formData: { username, emai...
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { await connection.manager.delete(User, duplicateUser.id); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
() => { expect(result.errors![0]).toBeInstanceOf(GraphQLError); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { const user = await connection.manager.findOne(User, { where: { email } }); expect(user).toBeUndefined(); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
() => { expect(sendMail).not.toHaveBeenCalled(); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
() => { let result: GraphQLResponse; let duplicateUser: User; beforeAll(async () => { duplicateUser = await factory .for(User) .with({ email }) .create(); const { mutate } = createTestClient(testServer); result = await mutate({ mutation: registerMutation,...
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { duplicateUser = await factory .for(User) .with({ email }) .create(); const { mutate } = createTestClient(testServer); result = await mutate({ mutation: registerMutation, variables: { formData: { username, email, ...
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { const user = await connection.manager.findOne(User, { where: { username } }); expect(user).toBeUndefined(); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
() => { let result: GraphQLResponse; beforeAll(async () => { const { mutate } = createTestClient(testServer); result = await mutate({ mutation: registerMutation, variables: { formData: { username, email, password: "weak" } ...
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { const { mutate } = createTestClient(testServer); result = await mutate({ mutation: registerMutation, variables: { formData: { username, email, password: "weak" } } }); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
() => { let result: GraphQLResponse; beforeAll(async () => { const { mutate } = createTestClient(testServer); result = await mutate({ mutation: registerMutation, variables: { formData: { username, email, password } } ...
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { const { mutate } = createTestClient(testServer); result = await mutate({ mutation: registerMutation, variables: { formData: { username, email, password } } }); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
() => { expect(result!.data!.register).toMatchObject({ username, email }); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
async () => { const user = await connection.manager.findOne(User, { where: { email } }); expect(user!.password).not.toEqual(password); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
() => { expect(sendMail).toHaveBeenCalled(); }
yis4yimmy/typescript-graphql-node-server
src/authentication/Register.test.ts
TypeScript
ArrowFunction
props => ( <svg width={19}
codesee-sandbox/ricos
packages/editor/web/src/RichContentEditor/Icons/UnderlineIcon.tsx
TypeScript
ArrowFunction
(theme: GrafanaTheme) => { const bgColor = selectThemeVariant({ light: theme.colors.gray7, dark: theme.colors.dark2 }, theme.type); return { hoverBackground: css` label: hoverBackground; background-color: ${bgColor}; `, logsRowLevelDetails: css` label: logs-row__level_details; &...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
(rowEntry): FieldDef[] => { const parser = this.getParser(rowEntry); if (!parser) { return []; } // Use parser to highlight detected fields const parsedFields = parser.getFields(rowEntry); const fields = parsedFields.map(field => { const key = parser.getLabelFromField(field); ...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
field => { const key = parser.getLabelFromField(field); const value = parser.getValueFromField(field); return { key, value }; }
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
(row: LogRowModel): FieldDef[] => { return ( row.dataFrame.fields .map((field, index) => ({ ...field, index })) // Remove Id which we use for react key and entry field which we are showing as the log message. .filter((field, index) => 'id' !== field.name && row.entryFieldIndex !== ind...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
(field, index) => ({ ...field, index })
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
(field, index) => 'id' !== field.name && row.entryFieldIndex !== index
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
field => { const value = field.values.get(row.rowIndex); // Not sure exactly what will be the empty value here. And we want to keep 0 as some values can be non // string. return value !== null && value !== undefined; }
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
field => { const { getFieldLinks } = this.props; const links = getFieldLinks ? getFieldLinks(field, row.rowIndex) : []; return { key: field.name, value: field.values.get(row.rowIndex).toString(), links: links.map(link => link.href), fieldInd...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
link => link.href
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
(row: LogRowModel) => { const fields = this.parseMessage(row.entry); const derivedFields = this.getDerivedFields(row); const fieldsMap = [...derivedFields, ...fields].reduce((acc, field) => { // Strip enclosing quotes for hashing. When values are parsed from log line the quotes are kept, but if same ...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
(acc, field) => { // Strip enclosing quotes for hashing. When values are parsed from log line the quotes are kept, but if same // value is in the dataFrame it will be without the quotes. We treat them here as the same value. const value = field.value.replace(/(^")|("$)/g, ''); const fieldHash =...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
(key: string) => { const matcher = this.getParser(this.props.row.entry)!.buildMatcher(key); return calculateFieldStats(this.props.getRows(), matcher); }
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
key => { const value = labels[key]; return ( <LogDetailsRow key={`${key}=${value}`}
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
field => { const { key, value, links, fieldIndex } = field; return ( <LogDetailsRow key={`${key}=${value}`}
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ClassDeclaration
class UnThemedLogDetails extends PureComponent<Props> { getParser = memoizeOne(getParser); parseMessage = memoizeOne((rowEntry): FieldDef[] => { const parser = this.getParser(rowEntry); if (!parser) { return []; } // Use parser to highlight detected fields const parsedFields = parser.get...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
InterfaceDeclaration
export interface Props extends Themeable { row: LogRowModel; showDuplicates: boolean; getRows: () => LogRowModel[]; className?: string; onMouseEnter?: () => void; onMouseLeave?: () => void; onClickFilterLabel?: (key: string, value: string) => void; onClickFilterOutLabel?: (key: string, value: string) =...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
TypeAliasDeclaration
type FieldDef = { key: string; value: string; links?: string[]; fieldIndex?: number; };
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
MethodDeclaration
render() { const { row, theme, onClickFilterOutLabel, onClickFilterLabel, getRows, showDuplicates, className, onMouseEnter, onMouseLeave, } = this.props; const style = getLogRowStyles(theme, row.logLevel); const styles = getStyles(theme); const ...
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
MethodDeclaration
cx(className, styles
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
MethodDeclaration
cx(style
91jme/grafana
packages/grafana-ui/src/components/Logs/LogDetails.tsx
TypeScript
ArrowFunction
(s: string) => { const { lexer } = parser const variables = [] lexer.setInput(s) let token do { token = lexer.lex() if (token === parser.symbols_.ID) { variables.push(lexer.yytext) } } while (token !== false && token !== lexer.EOF) return variables.filter(v => v !== 'math_e') }
consbio/seedsource-ui
src/parser/index.ts
TypeScript
ArrowFunction
v => v !== 'math_e'
consbio/seedsource-ui
src/parser/index.ts
TypeScript
ArrowFunction
(expr: string, context: any = {}) => { parser.yy.context = { ...context, math_e: Math.E, } console.log('...') console.log('parser.yy.context', parser.yy.context) console.log('???') console.log('parser.parse(expr)', parser.parse(expr)) console.log('after parse') return parser.parse(expr) }
consbio/seedsource-ui
src/parser/index.ts
TypeScript
ArrowFunction
(style: string) => { result[style] = StyleRules.getLegendForStyle(style, this.nodeRules[style], itemsData); }
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(style: string) => { result[style] = StyleRules.getLegendForStyle(style, this.edgeRules[style], itemsData); }
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(d) => { return styleRule.canApplyTo(d); }
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(k, i) => { if (i > 0) { template += ' and '; } template += `${k} ${value[k]}`; }
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(data) => { const propValue = Tools.getIn(data, styleRule.style.color.input); if (Array.isArray(propValue)) { propValue.forEach((value) => { const label = styleRule.style.color.input.includes('properties') ? `${StyleRules.getTypeLabel(styleRule.itemType)}.${propertyKey} = ${va...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(value) => { const label = styleRule.style.color.input.includes('properties') ? `${StyleRules.getTypeLabel(styleRule.itemType)}.${propertyKey} = ${value}` : `${StyleRules.getTypeLabel(value)}`; const color = ItemAttributes.autoColor(value, styleRule.style.color.ignoreCase); ...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(r) => r.label
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(style: IStyleRule<INodeStyle | IEdgeStyle>) => { switch (styleType) { case StyleType.COLOR: return style.style.color !== undefined; case StyleType.ICON: return 'icon' in style.style && style.style.icon !== undefined; case StyleType.IMAGE: ret...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(style: IStyleRule<INodeStyle | IEdgeStyle>) => StyleRules.getRule(style, styleType)
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(s) => s.index
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
ArrowFunction
(style) => { if (seenIndex.includes(style.index)) { style.index = maxIndex; maxIndex++; } else { seenIndex.push(style.index); } return style; }
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
InterfaceDeclaration
export interface Legend { [key: string]: Array<{label: string; value: string | IStyleIcon | IStyleImage | number}>; }
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
EnumDeclaration
export enum StyleType { COLOR = 'color', ICON = 'icon', SIZE = 'size', IMAGE = 'image', SHAPE = 'shape', WIDTH = 'width' }
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
MethodDeclaration
/** * Generate a legend with an array of style rules and existing items in visualization */ public generateLegend(itemsData: Array<LkNodeData | LkEdgeData>): Legend { const result: Legend = {}; if (itemsData.length === 0) { return result; } if ('categories' in itemsData[0]) { Object.k...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
MethodDeclaration
/** * Return the legend for a specific style type (color, icon, image...) */ public static getLegendForStyle( styleType: string, styles: Array<StyleRule>, itemsData: Array<LkNodeData | LkEdgeData> ): Array<{label: string; value: string | number | IStyleIcon | IStyleImage}> { const result: Array<...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
MethodDeclaration
/** * Sanitize value for legend */ public static sanitizeValue(styleType: SelectorType, value: any): string { switch (styleType) { case SelectorType.NO_VALUE: return 'is undefined'; case SelectorType.NAN: return 'is not an number'; case SelectorType.RANGE: let templ...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
MethodDeclaration
/** * Add items in legend for automatic coloring */ public static addLegendAutoColors( itemsData: Array<LkNodeData | LkEdgeData>, styleRule: StyleRule, currentLegend: Array<{label: string; value: string | number | IStyleIcon | IStyleImage}> ): void { const propertyKey: string = styleRule.style.c...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
MethodDeclaration
/** * Return the label of item type for a legend item */ public static getTypeLabel(type: string | undefined | null): string { return type === undefined ? 'All' : type === null ? 'Others' : type; }
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
MethodDeclaration
/** * Check if a legend item already exists and overwrite it / push it */ public static updateLegend( legend: Array<{label: string; value: string | number | IStyleIcon | IStyleImage}>, {label, value}: {[key: string]: string} ): void { const indexOfLegendItem = legend.map((r) => r.label).indexOf(labe...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript
MethodDeclaration
/** * return an array of StyleRule, containing only the desired style */ public static getBy( styleType: StyleType, rules: Array<IStyleRule<INodeStyle | IEdgeStyle>> ): Array<StyleRule> { return rules .filter((style: IStyleRule<INodeStyle | IEdgeStyle>) => { switch (styleType) { ...
Linkurious/ogma-linkurious-parser
src/styles/styleRules.ts
TypeScript