type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
() => { let input = "1 LETTERS G A G SIGNS & EXIT_SIGNS B EXIT_LETTERS 3" let lexResult = ModeLexer.tokenize(input) expect(lexResult.errors).to.be.empty let images = map(lexResult.tokens, currTok => currTok.image) expect(images).to.deep.equal([ "1", "LETTERS", "G", "A", "G", "SIGNS", "&", "EXIT_SIGNS", "B", // back in letters mode "EXIT_LETTERS", "3" // back in numbers mode ]) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
currTok => currTok.image
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let input = "1 LETTERS EXIT_LETTERS +" let lexResult = ModeLexer.tokenize(input) expect(lexResult.errors).to.have.lengthOf(1) expect(lexResult.errors[0].message).to.equal( "unexpected character: ->+<- at offset: 23, skipped 1 characters." ) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let input = "A G SIGNS ^" let lexResult = ModeLexer.tokenize(input, "letters") expect(lexResult.errors).to.be.empty let images = map(lexResult.tokens, currTok => currTok.image) expect(images).to.deep.equal(["A", "G", "SIGNS", "^"]) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let input = "1 LETTERS 1A" let lexResult = ModeLexer.tokenize(input) expect(lexResult.errors).to.have.lengthOf(1) expect(lexResult.errors[0].message).to.include("skipped 1") expect(lexResult.errors[0].message).to.include(">1<") let images = map(lexResult.tokens, currTok => currTok.image) expect(images).to.deep.equal([ "1", "LETTERS", "A" // the second "1" is missing because its not allowed in the "letters" mode ]) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let input = "1 EXIT_NUMBERS 2" let lexResult = ModeLexer.tokenize(input) expect(lexResult.errors).to.have.lengthOf(1) expect(lexResult.errors[0].message).to.include( ">EXIT_NUMBERS<" ) expect(lexResult.errors[0].message).to.include( "Unable to pop" ) if (testStart) { expect(lexResult.errors[0].line).to.equal(1) expect(lexResult.errors[0].column).to.equal(3) } else { expect(lexResult.errors[0].line).to.equal(undefined) expect(lexResult.errors[0].column).to.equal(undefined) } expect(lexResult.errors[0].length).to.equal(12) let images = map(lexResult.tokens, currTok => currTok.image) expect(images).to.deep.equal(["1", "EXIT_NUMBERS", "2"]) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let input = "LETTERS SIGNS_AND_EXIT_LETTERS &" let lexResult = ModeLexer.tokenize(input) expect(lexResult.errors).to.be.empty let images = map(lexResult.tokens, currTok => currTok.image) expect(images).to.deep.equal([ "LETTERS", "SIGNS_AND_EXIT_LETTERS", "&" ]) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { const One = createToken({ name: "One", pattern: /1/ }) const Two = createToken({ name: "Two", pattern: /2/ }) const Alpha = createToken({ name: "Alpha", pattern: /A/ }) const Beta = createToken({ name: "Beta", pattern: /B/ }) const Gamma = createToken({ name: "Gamma", pattern: /G/ }) const EnterNumbers = createToken({ name: "EnterNumbers", pattern: /NUMBERS/ }) EnterNumbers.PUSH_MODE = "numbers" let lexerDef: IMultiModeLexerDefinition = { modes: { letters: [ Alpha, Beta, Gamma, Whitespace, EnterNumbers ], // the numbers mode has a typo! so the PUSH_MODE in the 'EnterNumbers' is invalid nuMbers_TYPO: [One, Two, Whitespace, NewLine] }, defaultMode: "letters" } let badLexer = new Lexer(lexerDef, { deferDefinitionErrorsHandling: true }) expect(badLexer.lexerDefinitionErrors).to.have.lengthOf(1) expect( badLexer.lexerDefinitionErrors[0].tokenTypes ).to.deep.equal([EnterNumbers]) expect(badLexer.lexerDefinitionErrors[0].type).to.equal( LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST ) expect( badLexer.lexerDefinitionErrors[0].message ).to.include("PUSH_MODE") expect( badLexer.lexerDefinitionErrors[0].message ).to.include("EnterNumbers") expect( badLexer.lexerDefinitionErrors[0].message ).to.include("which does not exist") }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let lexerDef: any = { modes___: { // typo in 'modes' property name }, defaultMode: "" } let badLexer = new Lexer(lexerDef, { deferDefinitionErrorsHandling: true, positionTracking: "onlyOffset" }) expect(badLexer.lexerDefinitionErrors).to.have.lengthOf(1) expect(badLexer.lexerDefinitionErrors[0].type).to.equal( LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY ) expect( badLexer.lexerDefinitionErrors[0].message ).to.include("MultiMode Lexer cannot be initialized") expect( badLexer.lexerDefinitionErrors[0].message ).to.include("without a <modes> property") }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let lexerDef: any = { modes: {}, defaultMode___: "" // typo in 'defaultMode' property name } let badLexer = new Lexer(lexerDef, { deferDefinitionErrorsHandling: true, positionTracking: "onlyOffset" }) expect(badLexer.lexerDefinitionErrors).to.have.lengthOf(1) expect(badLexer.lexerDefinitionErrors[0].type).to.equal( LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE ) expect( badLexer.lexerDefinitionErrors[0].message ).to.include("MultiMode Lexer cannot be initialized") expect( badLexer.lexerDefinitionErrors[0].message ).to.include("without a <defaultMode> property") }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let lexerDef: any = { modes: { bamba: [] }, defaultMode: "bisli" } let badLexer = new Lexer(lexerDef, { deferDefinitionErrorsHandling: true, positionTracking: "onlyOffset" }) expect(badLexer.lexerDefinitionErrors).to.have.lengthOf( 1 ) expect(badLexer.lexerDefinitionErrors[0].type).to.equal( LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST ) expect( badLexer.lexerDefinitionErrors[0].message ).to.include("MultiMode Lexer cannot be initialized") expect( badLexer.lexerDefinitionErrors[0].message ).to.include("which does not exist") expect( badLexer.lexerDefinitionErrors[0].message ).to.include("bisli") }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let lexerDef: any = [ Alpha, Beta /* this is undefined */, , Gamma ] let badLexer = new Lexer(lexerDef, { deferDefinitionErrorsHandling: true, positionTracking: "onlyOffset" }) expect(badLexer.lexerDefinitionErrors).to.have.lengthOf(1) expect(badLexer.lexerDefinitionErrors[0].type).to.equal( LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED ) expect( badLexer.lexerDefinitionErrors[0].message ).to.include( "A Lexer cannot be initialized using an undefined Token Type" ) expect( badLexer.lexerDefinitionErrors[0].message ).to.include("2") }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { function defineCustomPatternSpec(variant, customPattern) { it(variant, () => { let time = 1 function extraContextValidator( text, offset, tokens, groups ) { let result = isFunction(customPattern) ? customPattern(text, offset) : customPattern.exec(text, offset) if (result !== null) { if (time === 1) { expect(tokens).to.be.empty time++ } else if (time === 2) { expect(tokens).to.have.lengthOf(2) expect( groups.whitespace ).to.have.lengthOf(2) time++ } else { throw Error( "Issue with Custom Token pattern context" ) } } return result } let A = createToken({ name: "A", pattern: "A" }) let B = createToken({ name: "B", pattern: <any>extraContextValidator }) let WS = createToken({ name: "WS", pattern: { exec: (text, offset) => /^\s+/.exec(text.substring(offset)) }, group: "whitespace", line_breaks: true }) let lexerDef: any = [WS, A, B] let myLexer = new Lexer(lexerDef, lexerConfig) let lexResult = myLexer.tokenize("B A\n B ") expect(lexResult.tokens).to.have.length(3) expect(tokenMatcher(lexResult.tokens[0], B)).to.be .true expect(tokenMatcher(lexResult.tokens[1], A)).to.be .true expect(tokenMatcher(lexResult.tokens[2], B)).to.be .true let lastToken = lexResult.tokens[2] expect(lastToken.startOffset).to.equal(5) if (testStart) { expect(lastToken.startLine).to.equal(2) expect(lastToken.startColumn).to.equal(2) } if (testFull) { expect(lastToken.endLine).to.equal(2) expect(lastToken.endColumn).to.equal(2) expect(lastToken.endOffset).to.equal(5) } }) } defineCustomPatternSpec( "With short function syntax", (text, offset) => /^B/.exec(text.substring(offset)) ) defineCustomPatternSpec("verbose syntax", { exec: (text, offset) => /^B/.exec(text.substring(offset)) }) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let time = 1 function extraContextValidator( text, offset, tokens, groups ) { let result = isFunction(customPattern) ? customPattern(text, offset) : customPattern.exec(text, offset) if (result !== null) { if (time === 1) { expect(tokens).to.be.empty time++ } else if (time === 2) { expect(tokens).to.have.lengthOf(2) expect( groups.whitespace ).to.have.lengthOf(2) time++ } else { throw Error( "Issue with Custom Token pattern context" ) } } return result } let A = createToken({ name: "A", pattern: "A" }) let B = createToken({ name: "B", pattern: <any>extraContextValidator }) let WS = createToken({ name: "WS", pattern: { exec: (text, offset) => /^\s+/.exec(text.substring(offset)) }, group: "whitespace", line_breaks: true }) let lexerDef: any = [WS, A, B] let myLexer = new Lexer(lexerDef, lexerConfig) let lexResult = myLexer.tokenize("B A\n B ") expect(lexResult.tokens).to.have.length(3) expect(tokenMatcher(lexResult.tokens[0], B)).to.be .true expect(tokenMatcher(lexResult.tokens[1], A)).to.be .true expect(tokenMatcher(lexResult.tokens[2], B)).to.be .true let lastToken = lexResult.tokens[2] expect(lastToken.startOffset).to.equal(5) if (testStart) { expect(lastToken.startLine).to.equal(2) expect(lastToken.startColumn).to.equal(2) } if (testFull) { expect(lastToken.endLine).to.equal(2) expect(lastToken.endColumn).to.equal(2) expect(lastToken.endOffset).to.equal(5) } }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
(text, offset) => /^\s+/.exec(text.substring(offset))
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
(text, offset) => /^B/.exec(text.substring(offset))
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
(text, offset) => /^B/.exec(text.substring(offset))
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { before(disableSticky) lexerSpecs() after(enableSticky) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { let consoleSpy beforeEach(function() { // @ts-ignore consoleSpy = sinon.spy(console, "error") }) afterEach(function() { // @ts-ignore console.error.restore() }) it("not report unicode flag", () => { // using new RegExp() to avoid IE 11 syntax errors const One = createToken({ name: "One", pattern: new RegExp("1", "u") }) new Lexer([One], { positionTracking: "onlyOffset" }) expect(console.error).to.have.not.been.called }) it("report unicode flag with ensureOptimizations enabled", () => { // using new RegExp() to avoid IE 11 syntax errors const One = createToken({ name: "One", pattern: new RegExp("1", "u") }) expect( () => new Lexer([One], { ensureOptimizations: true, positionTracking: "onlyOffset" }) ).to.throw("Lexer Modes: < defaultMode > cannot be optimized.") expect(console.error).to.have.been.called expect(consoleSpy.args[0][0]).to.include( "The regexp unicode flag is not currently supported by the regexp-to-ast library" ) }) it("report custom patterns without 'start_chars_hint'", () => { const One = createToken({ name: "One", pattern: (text, offset) => { return /1/.exec(text) } }) expect( () => new Lexer([One], { ensureOptimizations: true, positionTracking: "onlyOffset" }) ).to.throw("Lexer Modes: < defaultMode > cannot be optimized.") expect(console.error).to.have.been.called expect(consoleSpy.args[0][0]).to.include( "TokenType: <One> is using a custom token pattern without providing <start_chars_hint>" ) }) it("Will report mutually exclusive safeMode and ensureOptimizations flags", () => { // using new RegExp() to avoid IE 11 syntax errors const One = createToken({ name: "One", pattern: new RegExp("1", "u") }) expect( () => new Lexer([One], { safeMode: true, ensureOptimizations: true, positionTracking: "onlyOffset" }) ).to.throw( '"safeMode" and "ensureOptimizations" flags are mutually exclusive.' ) }) it("won't pack first char optimizations array for too large arrays", () => { // without hints we expect the lexer const PileOfPooNoHints = createToken({ name: "PileOfPoo", pattern: /💩/ }) const pooLexerNoHints = new Lexer([PileOfPooNoHints], { positionTracking: "onlyOffset" }) expect( keys( (<any>pooLexerNoHints).charCodeToPatternIdxToConfig.defaultMode ).length ).to.equal("💩".charCodeAt(0) + 1) const PileOfPoo = createToken({ name: "PileOfPoo", pattern: /💩/, start_chars_hint: [100000] }) const pooLexer = new Lexer([PileOfPoo], { positionTracking: "onlyOffset" }) expect( keys((<any>pooLexer).charCodeToPatternIdxToConfig.defaultMode) .length ).to.equal(1) }) it("won't optimize with safe mode enabled", () => { const Alpha = createToken({ name: "A", pattern: /a/ }) const alphaLexerSafeMode = new Lexer([Alpha], { positionTracking: "onlyOffset", safeMode: true }) expect( (<any>alphaLexerSafeMode).charCodeToPatternIdxToConfig.defaultMode ).to.be.empty // compare to safeMode disabled const alphaLexerNoSafeMode = new Lexer([Alpha], { positionTracking: "onlyOffset" }) expect( (<any>alphaLexerNoSafeMode).charCodeToPatternIdxToConfig .defaultMode[97][0].tokenType ).to.equal(Alpha) }) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { // using new RegExp() to avoid IE 11 syntax errors const One = createToken({ name: "One", pattern: new RegExp("1", "u") }) new Lexer([One], { positionTracking: "onlyOffset" }) expect(console.error).to.have.not.been.called }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { // using new RegExp() to avoid IE 11 syntax errors const One = createToken({ name: "One", pattern: new RegExp("1", "u") }) expect( () => new Lexer([One], { ensureOptimizations: true, positionTracking: "onlyOffset" }) ).to.throw("Lexer Modes: < defaultMode > cannot be optimized.") expect(console.error).to.have.been.called expect(consoleSpy.args[0][0]).to.include( "The regexp unicode flag is not currently supported by the regexp-to-ast library" ) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => new Lexer([One], { ensureOptimizations: true, positionTracking: "onlyOffset" })
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { const One = createToken({ name: "One", pattern: (text, offset) => { return /1/.exec(text) } }) expect( () => new Lexer([One], { ensureOptimizations: true, positionTracking: "onlyOffset" }) ).to.throw("Lexer Modes: < defaultMode > cannot be optimized.") expect(console.error).to.have.been.called expect(consoleSpy.args[0][0]).to.include( "TokenType: <One> is using a custom token pattern without providing <start_chars_hint>" ) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
(text, offset) => { return /1/.exec(text) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { // using new RegExp() to avoid IE 11 syntax errors const One = createToken({ name: "One", pattern: new RegExp("1", "u") }) expect( () => new Lexer([One], { safeMode: true, ensureOptimizations: true, positionTracking: "onlyOffset" }) ).to.throw( '"safeMode" and "ensureOptimizations" flags are mutually exclusive.' ) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => new Lexer([One], { safeMode: true, ensureOptimizations: true, positionTracking: "onlyOffset" })
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { // without hints we expect the lexer const PileOfPooNoHints = createToken({ name: "PileOfPoo", pattern: /💩/ }) const pooLexerNoHints = new Lexer([PileOfPooNoHints], { positionTracking: "onlyOffset" }) expect( keys( (<any>pooLexerNoHints).charCodeToPatternIdxToConfig.defaultMode ).length ).to.equal("💩".charCodeAt(0) + 1) const PileOfPoo = createToken({ name: "PileOfPoo", pattern: /💩/, start_chars_hint: [100000] }) const pooLexer = new Lexer([PileOfPoo], { positionTracking: "onlyOffset" }) expect( keys((<any>pooLexer).charCodeToPatternIdxToConfig.defaultMode) .length ).to.equal(1) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ArrowFunction
() => { const Alpha = createToken({ name: "A", pattern: /a/ }) const alphaLexerSafeMode = new Lexer([Alpha], { positionTracking: "onlyOffset", safeMode: true }) expect( (<any>alphaLexerSafeMode).charCodeToPatternIdxToConfig.defaultMode ).to.be.empty // compare to safeMode disabled const alphaLexerNoSafeMode = new Lexer([Alpha], { positionTracking: "onlyOffset" }) expect( (<any>alphaLexerNoSafeMode).charCodeToPatternIdxToConfig .defaultMode[97][0].tokenType ).to.equal(Alpha) }
benjie/chevrotain
test/scan/lexer_spec.ts
TypeScript
ClassDeclaration
export class ListVersionsResponseAllOf { 'nextVersion'?: number; 'versions'?: Array<ListVersionsResponseAllOfVersions>; static discriminator: string | undefined = undefined; static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ { "name": "nextVersion", "baseName": "nextVersion", "type": "number" }, { "name": "versions", "baseName": "versions", "type": "Array<ListVersionsResponseAllOfVersions>" } ]; static getAttributeTypeMap() { return ListVersionsResponseAllOf.attributeTypeMap; } }
AItoAir/edge-impulse-linux-cli
sdk/studio/model/listVersionsResponseAllOf.ts
TypeScript
MethodDeclaration
static getAttributeTypeMap() { return ListVersionsResponseAllOf.attributeTypeMap; }
AItoAir/edge-impulse-linux-cli
sdk/studio/model/listVersionsResponseAllOf.ts
TypeScript
FunctionDeclaration
function ScoreIcon(props: {header: string, score: number}) { const {header, score} = props; // score between -2 and 2 return ( <Tooltip title={`${header} Score = ${score}`}
Fair-Exchange/safestake
src/components/ValidatorScoreTray.tsx
TypeScript
FunctionDeclaration
export function ValidatorScoreTray(props: {validatorScore: ValidatorScore}) { const { validatorScore } = props; return ( <Typography> <ScoreIcon header="Root Distance" score={validatorScore.root_distance_score} /> <ScoreIcon header="Vote Distance" score={validatorScore.vote_distance_score} /> <ScoreIcon header="Skipped Slot" score={validatorScore.skipped_slot_score} /> <ScoreIcon header="Published Info" score={validatorScore.published_information_score} /> <ScoreIcon header="Software Version" score={validatorScore.software_version_score} /> <ScoreIcon header="Security Report" score={validatorScore.security_report_score} /> {validatorScore.stake_concentration_score < 0 && <ScoreIcon header="Stake concentration" score={validatorScore.stake_concentration_score} /> } {(validatorScore.data_center_concentration_score ?? 0) < 0 && <ScoreIcon header="Data Center Centration" score={validatorScore.data_center_concentration_score ?? 0} /> } ({validatorScore.total_score}) </Typography> ); }
Fair-Exchange/safestake
src/components/ValidatorScoreTray.tsx
TypeScript
InterfaceDeclaration
/** * @internal */ export interface PaintGeometry { sx: number sy: number tx: number ty: number xSpan: number ySpan: number mx: number my: number so: Orientation to: Orientation x: number y: number w: number h: number segment: number startStubX: number startStubY: number endStubX: number endStubY: number isXGreaterThanStubTimes2: boolean isYGreaterThanStubTimes2: boolean opposite: boolean perpendicular: boolean orthogonal: boolean sourceAxis: PaintAxis points: [ number, number, number, number, number, number, number, number ] stubs:[number, number] anchorOrientation?:string }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
TypeAliasDeclaration
/** * @internal */ type SegmentForPoint = { d: number, s: Segment, x: number, y: number, l: number, x1:number, y1:number, x2:number, y2:number, index:number, connectorLocation: number }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
TypeAliasDeclaration
export type ConnectorComputeParams = { sourcePos: AnchorPlacement, targetPos: AnchorPlacement, sourceEndpoint: Endpoint, targetEndpoint: Endpoint, strokeWidth: number, sourceInfo: ViewportElement<any>, targetInfo: ViewportElement<any> }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
abstract getDefaultStubs():[number, number]
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
getTypeDescriptor ():string { return "connector" }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
getIdPrefix () { return "_jsplumb_connector"; }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
protected setGeometry(g:Geometry, internal:boolean) { this.geometry = g this.edited = g != null && !internal }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
/** * Subclasses can override this. By default we just pass back the geometry we are using internally. */ exportGeometry():Geometry { return this.geometry }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
/** * Subclasses can override this. By default we just set the given geometry as our internal representation. */ importGeometry(g:Geometry):boolean { this.geometry = g return true }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
resetGeometry():void { this.geometry = null this.edited = false }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
abstract _compute(geometry:PaintGeometry, params:ConnectorComputeParams):void
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
resetBounds():void { this.bounds = EMPTY_BOUNDS() }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
/** * Function: findSegmentForPoint * Returns the segment that is closest to the given [x,y], * null if nothing found. This function returns a JS * object with: * * d - distance from segment * l - proportional location in segment * x - x point on the segment * y - y point on the segment * s - the segment itself. */ findSegmentForPoint (x:number, y:number):SegmentForPoint { let out:SegmentForPoint = { d: Infinity, s: null, x: null, y: null, l: null, x1:null, y1:null, x2:null, y2:null, index:null, connectorLocation:null } for (let i = 0; i < this.segments.length; i++) { let _s = this.segments[i].findClosestPointOnPath(x, y) if (_s.d < out.d) { out.d = _s.d out.l = _s.l out.x = _s.x out.y = _s.y out.s = this.segments[i] out.x1 = _s.x1 out.x2 = _s.x2 out.y1 = _s.y1 out.y2 = _s.y2 out.index = i out.connectorLocation = this.segmentProportions[i][0] + (_s.l * (this.segmentProportions[i][1] - this.segmentProportions[i][0])) } } return out }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
lineIntersection (x1:number, y1:number, x2:number, y2:number):Array<PointXY> { let out:Array<PointXY> = [] for (let i = 0; i < this.segments.length; i++) { out.push.apply(out, this.segments[i].lineIntersection(x1, y1, x2, y2)) } return out }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
boxIntersection (x:number, y:number, w:number, h:number):Array<PointXY> { let out:Array<PointXY> = [] for (let i = 0; i < this.segments.length; i++) { out.push.apply(out, this.segments[i].boxIntersection(x, y, w, h)) } return out }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
boundingBoxIntersection (box:any):Array<PointXY> { let out:Array<PointXY> = [] for (let i = 0; i < this.segments.length; i++) { out.push.apply(out, this.segments[i].boundingBoxIntersection(box)) } return out }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
_updateSegmentProportions () { let curLoc = 0 for (let i = 0; i < this.segments.length; i++) { let sl = this.segments[i].getLength() this.segmentProportionalLengths[i] = sl / this.totalLength this.segmentProportions[i] = [curLoc, (curLoc += (sl / this.totalLength)) ] } }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
/** * returns [segment, proportion of travel in segment, segment index] for the segment * that contains the point which is 'location' distance along the entire path, where * 'location' is a decimal between 0 and 1 inclusive. in this connector type, paths * are made up of a list of segments, each of which contributes some fraction to * the total length. * From 1.3.10 this also supports the 'absolute' property, which lets us specify a location * as the absolute distance in pixels, rather than a proportion of the total path. */ _findSegmentForLocation (location:number, absolute?:boolean):{segment:Segment, proportion:number, index:number } { let idx, i, inSegmentProportion if (absolute) { location = location > 0 ? location / this.totalLength : (this.totalLength + location) / this.totalLength } // if location 1 we know its the last segment if (location === 1) { idx = this.segments.length - 1 inSegmentProportion = 1 } else if (location === 0) { // if location 0 we know its the first segment inSegmentProportion = 0 idx = 0 } else { // if location >= 0.5, traverse backwards (of course not exact, who knows the segment proportions. but // an educated guess at least) if (location >= 0.5) { idx = 0 inSegmentProportion = 0 for (i = this.segmentProportions.length - 1; i > -1; i--) { if (this.segmentProportions[i][1] >= location && this.segmentProportions[i][0] <= location) { idx = i inSegmentProportion = (location - this.segmentProportions[i][0]) / this.segmentProportionalLengths[i] break } } } else { idx = this.segmentProportions.length - 1 inSegmentProportion = 1 for (i = 0; i < this.segmentProportions.length; i++) { if (this.segmentProportions[i][1] >= location) { idx = i inSegmentProportion = (location - this.segmentProportions[i][0]) / this.segmentProportionalLengths[i] break } } } } return { segment: this.segments[idx], proportion: inSegmentProportion, index: idx } }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
_addSegment (clazz:Constructable<Segment>, params:any) { if (params.x1 === params.x2 && params.y1 === params.y2) { return } let s = (new clazz(params)) this.segments.push(s) this.totalLength += s.getLength() this.updateBounds(s) }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
_clearSegments () { this.totalLength = 0 this.segments.length = 0 this.segmentProportions.length = 0 this.segmentProportionalLengths.length = 0 }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
getLength ():number { return this.totalLength }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
private _prepareCompute (params:ConnectorComputeParams):PaintGeometry { this.strokeWidth = params.strokeWidth let x1 = params.sourcePos.curX, x2 = params.targetPos.curX, y1 = params.sourcePos.curY, y2 = params.targetPos.curY, segment = quadrant({x:x1, y:y1}, {x:x2, y:y2}), swapX = x2 < x1, swapY = y2 < y1, so:Orientation = [ params.sourcePos.ox, params.sourcePos.oy ], to:Orientation = [ params.targetPos.ox, params.targetPos.oy ], x = swapX ? x2 : x1, y = swapY ? y2 : y1, w = Math.abs(x2 - x1), h = Math.abs(y2 - y1) // if either anchor does not have an orientation set, we derive one from their relative // positions. we fix the axis to be the one in which the two elements are further apart, and // point each anchor at the other element. this is also used when dragging a new connection. if (so[0] === 0 && so[1] === 0 || to[0] === 0 && to[1] === 0) { let index = w > h ? 0 : 1, oIndex = [1, 0][index], v1 = index === 0 ? x1 : y1, v2 = index === 0 ? x2 : y2 so[index] = v1 > v2 ? -1 : 1 to[index] = v1 > v2 ? 1 : -1 so[oIndex] = 0 to[oIndex] = 0 } let sx = swapX ? w + (this.sourceGap * so[0]) : this.sourceGap * so[0], sy = swapY ? h + (this.sourceGap * so[1]) : this.sourceGap * so[1], tx = swapX ? this.targetGap * to[0] : w + (this.targetGap * to[0]), ty = swapY ? this.targetGap * to[1] : h + (this.targetGap * to[1]), oProduct = ((so[0] * to[0]) + (so[1] * to[1])) let result:PaintGeometry = { sx: sx, sy: sy, tx: tx, ty: ty, xSpan: Math.abs(tx - sx), ySpan: Math.abs(ty - sy), mx: (sx + tx) / 2, my: (sy + ty) / 2, so: so, to: to, x: x, y: y, w: w, h: h, segment: segment, startStubX: sx + (so[0] * this.sourceStub), startStubY: sy + (so[1] * this.sourceStub), endStubX: tx + (to[0] * this.targetStub), endStubY: ty + (to[1] * this.targetStub), isXGreaterThanStubTimes2: Math.abs(sx - tx) > (this.sourceStub + this.targetStub), isYGreaterThanStubTimes2: Math.abs(sy - ty) > (this.sourceStub + this.targetStub), opposite: oProduct === -1, perpendicular: oProduct === 0, orthogonal: oProduct === 1, sourceAxis: so[0] === 0 ? "y" : "x", points: [x, y, w, h, sx, sy, tx, ty ], stubs:[this.sourceStub, this.targetStub] } result.anchorOrientation = result.opposite ? "opposite" : result.orthogonal ? "orthogonal" : "perpendicular" return result }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
updateBounds (segment:Segment):void { let segBounds = segment.extents this.bounds.xmin = Math.min(this.bounds.xmin, segBounds.xmin) this.bounds.xmax = Math.max(this.bounds.xmax, segBounds.xmax) this.bounds.ymin = Math.min(this.bounds.ymin, segBounds.ymin) this.bounds.ymax = Math.max(this.bounds.ymax, segBounds.ymax) }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
private dumpSegmentsToConsole ():void { log("SEGMENTS:") for (let i = 0; i < this.segments.length; i++) { log(this.segments[i].type, "" + this.segments[i].getLength(), "" + this.segmentProportions[i]) } }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
pointOnPath (location:number, absolute?:boolean):PointXY { let seg = this._findSegmentForLocation(location, absolute) return seg.segment && seg.segment.pointOnPath(seg.proportion, false) || {x:0, y:0} }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
gradientAtPoint (location:number, absolute?:boolean):number { let seg = this._findSegmentForLocation(location, absolute) return seg.segment && seg.segment.gradientAtPoint(seg.proportion, false) || 0 }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
pointAlongPathFrom (location:number, distance:number, absolute?:boolean):PointXY { let seg = this._findSegmentForLocation(location, absolute) // TODO what happens if this crosses to the next segment? return seg.segment && seg.segment.pointAlongPathFrom(seg.proportion, distance, false) || {x:0, y:0} }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
compute (params:ConnectorComputeParams):void { this.paintInfo = this._prepareCompute(params) this._clearSegments() this._compute(this.paintInfo, params) this.x = this.paintInfo.points[0] this.y = this.paintInfo.points[1] this.w = this.paintInfo.points[2] this.h = this.paintInfo.points[3] this.segment = this.paintInfo.segment this._updateSegmentProportions() }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
MethodDeclaration
// // a dummy implementation for subclasses to override if they want to. // setAnchorOrientation(idx:number, orientation:number[]):void { }
collabsoft/jsplumb
ts/core/connector/abstract-connector.ts
TypeScript
ArrowFunction
async () => { it('should group issues by associated categories when checked', async () => { await goToResource('elements/element-reveal-inline-issue.html'); await navigateToIssuesTab(); if (!await getGroupByCategoryChecked()) { await toggleGroupByCategory(); } await expandCategory(); await assertCategoryName('Content Security Policy'); await expandIssue(); await assertIssueTitle('Content Security Policy blocks inline execution of scripts and stylesheets'); }); it('should use a flat list of issues when not checked', async () => { await goToResource('elements/element-reveal-inline-issue.html'); await navigateToIssuesTab(); if (await getGroupByCategoryChecked()) { await toggleGroupByCategory(); } await expandIssue(); await assertIssueTitle('Content Security Policy blocks inline execution of scripts and stylesheets'); }); }
zys-contrib/devtools-frontend
test/e2e/issues/group-by-categories_test.ts
TypeScript
ArrowFunction
async () => { await goToResource('elements/element-reveal-inline-issue.html'); await navigateToIssuesTab(); if (!await getGroupByCategoryChecked()) { await toggleGroupByCategory(); } await expandCategory(); await assertCategoryName('Content Security Policy'); await expandIssue(); await assertIssueTitle('Content Security Policy blocks inline execution of scripts and stylesheets'); }
zys-contrib/devtools-frontend
test/e2e/issues/group-by-categories_test.ts
TypeScript
ArrowFunction
async () => { await goToResource('elements/element-reveal-inline-issue.html'); await navigateToIssuesTab(); if (await getGroupByCategoryChecked()) { await toggleGroupByCategory(); } await expandIssue(); await assertIssueTitle('Content Security Policy blocks inline execution of scripts and stylesheets'); }
zys-contrib/devtools-frontend
test/e2e/issues/group-by-categories_test.ts
TypeScript
ArrowFunction
(props) => { const [globalState, globalActions] = useGlobal() const tlt = props.tlt const { setState, editTaskListType, deleteTaskListType, deleteTaskType, addTaskType } = globalActions const { taskListTypes, currentTaskType } = globalState const [newVisible, setNewVisible] = useState(false) const blankTaskListType = { uid: '_:uid', name: '', editing: false, type: 'TaskListType', associatedWith: '', includesTaskType: [] } const blankTaskType = { uid: '_:uid', name: '', editing: false, type: 'TaskType', ownerUid: props.ownerUid, displayOrder: 0, associatedWith: '' } const showHideEdit = useShowHideForm(globalActions, tlt, blankTaskListType, 'edit') const [showEdit, hideEdit, editVisible] = showHideEdit const handleDelete = (event) => { deleteTaskListType(tlt) .subscribe(() => { setState({ taskListTypes: taskListTypes.filter((item) => item.uid !== tlt.uid) }) }) } const handleDeleteTaskType = (event, item) => { const deleteItem = { uid: tlt.uid, hasTaskTypes: { uid: item.uid } } deleteTaskType(deleteItem) .subscribe(() => { const list = taskListTypes.filter((tltItem) => tltItem.uid !== tlt.uid) const ttList = tlt.taskTypes.filter((ttItem) => ttItem.uid !== item.uid) const ownerItem = { ...tlt, taskTypes: ttList } const newList = [...list, ownerItem] setState({taskListTypes: newList}) }) } const handleNew = (event) => { of(setState({ currentTaskType: blankTaskType })) .subscribe(() => setNewVisible(true)) } const handleCancelNew = (event) => { of(setState({ currentTaskType: blankTaskType })) .subscribe(() => setNewVisible(false)) } const handleSave = (event, taskListType) => { editTaskListType(taskListType) .subscribe(prom => { prom.then(tlts => { tlts.subscribe(list => { setState({ taskListTypes: list, currentTaskListType: blankTaskListType }) hideEdit() }) }) }) } const handleSaveTaskType = (event, taskType) => { addTaskType(taskType) .subscribe(prom => { prom.then(tls => { const item = { ...currentTaskType, uid: tls.uid } const taskListType = { ...tlt, taskTypes: [...tlt.taskTypes, item] } const oldTaskListTypes = taskListTypes .filter(oldtlt => oldtlt.uid !== tlt.uid) const updatedTaskListTypes = [...oldTaskListTypes, taskListType] setState({taskListTypes: updatedTaskListTypes}) setNewVisible(false) }) }) } const handleEdit = (event) => { of(setState({ currentTaskListType: tlt })) .subscribe(() => showEdit()) } const handleCancelEdit = (event) => { of(setState({ currentTaskType: blankTaskType })) .subscribe(() => hideEdit()) } const taskTypeForm = () => { if(newVisible) { return ( <TaskTypeForm tt={ currentTaskType } handleCancel={ handleCancelNew } handleSave={ handleSaveTaskType } ownerUid={tlt.uid}/>
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(event) => { deleteTaskListType(tlt) .subscribe(() => { setState({ taskListTypes: taskListTypes.filter((item) => item.uid !== tlt.uid) }) }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => { setState({ taskListTypes: taskListTypes.filter((item) => item.uid !== tlt.uid) }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(item) => item.uid !== tlt.uid
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(event, item) => { const deleteItem = { uid: tlt.uid, hasTaskTypes: { uid: item.uid } } deleteTaskType(deleteItem) .subscribe(() => { const list = taskListTypes.filter((tltItem) => tltItem.uid !== tlt.uid) const ttList = tlt.taskTypes.filter((ttItem) => ttItem.uid !== item.uid) const ownerItem = { ...tlt, taskTypes: ttList } const newList = [...list, ownerItem] setState({taskListTypes: newList}) }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => { const list = taskListTypes.filter((tltItem) => tltItem.uid !== tlt.uid) const ttList = tlt.taskTypes.filter((ttItem) => ttItem.uid !== item.uid) const ownerItem = { ...tlt, taskTypes: ttList } const newList = [...list, ownerItem] setState({taskListTypes: newList}) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(tltItem) => tltItem.uid !== tlt.uid
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(ttItem) => ttItem.uid !== item.uid
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(event) => { of(setState({ currentTaskType: blankTaskType })) .subscribe(() => setNewVisible(true)) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => setNewVisible(true)
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(event) => { of(setState({ currentTaskType: blankTaskType })) .subscribe(() => setNewVisible(false)) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => setNewVisible(false)
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(event, taskListType) => { editTaskListType(taskListType) .subscribe(prom => { prom.then(tlts => { tlts.subscribe(list => { setState({ taskListTypes: list, currentTaskListType: blankTaskListType }) hideEdit() }) }) }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
prom => { prom.then(tlts => { tlts.subscribe(list => { setState({ taskListTypes: list, currentTaskListType: blankTaskListType }) hideEdit() }) }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
tlts => { tlts.subscribe(list => { setState({ taskListTypes: list, currentTaskListType: blankTaskListType }) hideEdit() }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
list => { setState({ taskListTypes: list, currentTaskListType: blankTaskListType }) hideEdit() }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(event, taskType) => { addTaskType(taskType) .subscribe(prom => { prom.then(tls => { const item = { ...currentTaskType, uid: tls.uid } const taskListType = { ...tlt, taskTypes: [...tlt.taskTypes, item] } const oldTaskListTypes = taskListTypes .filter(oldtlt => oldtlt.uid !== tlt.uid) const updatedTaskListTypes = [...oldTaskListTypes, taskListType] setState({taskListTypes: updatedTaskListTypes}) setNewVisible(false) }) }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
prom => { prom.then(tls => { const item = { ...currentTaskType, uid: tls.uid } const taskListType = { ...tlt, taskTypes: [...tlt.taskTypes, item] } const oldTaskListTypes = taskListTypes .filter(oldtlt => oldtlt.uid !== tlt.uid) const updatedTaskListTypes = [...oldTaskListTypes, taskListType] setState({taskListTypes: updatedTaskListTypes}) setNewVisible(false) }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
tls => { const item = { ...currentTaskType, uid: tls.uid } const taskListType = { ...tlt, taskTypes: [...tlt.taskTypes, item] } const oldTaskListTypes = taskListTypes .filter(oldtlt => oldtlt.uid !== tlt.uid) const updatedTaskListTypes = [...oldTaskListTypes, taskListType] setState({taskListTypes: updatedTaskListTypes}) setNewVisible(false) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
oldtlt => oldtlt.uid !== tlt.uid
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(event) => { of(setState({ currentTaskListType: tlt })) .subscribe(() => showEdit()) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => showEdit()
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(event) => { of(setState({ currentTaskType: blankTaskType })) .subscribe(() => hideEdit()) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => hideEdit()
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => { if(newVisible) { return ( <TaskTypeForm tt={ currentTaskType } handleCancel={ handleCancelNew } handleSave={ handleSaveTaskType } ownerUid={tlt.uid}/>
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => { const taskTypeList = tlt.taskTypes || [] if(taskTypeList.length > 0) { return taskTypeList.map((item, index) => { return ( <TaskType key={ `taskType-${ item.uid }` } item={ item } ownerUid={ tlt.uid } handleDelete={ handleDeleteTaskType } /> ) }) }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
(item, index) => { return ( <TaskType key={ `taskType-${ item.uid }` }
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ArrowFunction
() => { if(editVisible) { return ( <TaskListTypeForm tlt={ tlt } handleCancel={ handleCancelEdit } handleSave={ handleSave }/>
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
MethodDeclaration
formOrData()
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
MethodDeclaration
taskTypes()
bmw2621/vwc_fng_tracker
vwc_fng_tracker_fe/src/components/Tasks/TaskListType/TaskListTypeItem.tsx
TypeScript
ClassDeclaration
export default class ExchangeRequestMessage extends Message { public exchangeType: number; constructor(exchangeType = 0) { super(); this.exchangeType = exchangeType; } }
Joryss/cookietouch
src/cookie/protocol/network/messages/ExchangeRequestMessage.ts
TypeScript
ArrowFunction
(size: number): string => { let str: string; if (size >= 1024 * 1024) { str = (size / 1024 / 1024).toFixed(2); str = `${str} MB`; } else if (size >= 1024) { str = (size / 1024).toFixed(2); str = `${str} KB`; } else { str = `${size} B`; } return str; }
bmybbs/bmybbs-content-parser
src/utils.ts
TypeScript
InterfaceDeclaration
export interface DeployedModel { /** * deploymentID is ModelDeployment that deploys this model */ deploymentID?: string; servedModel?: models.ServedModel; }
odahu/odahu-ui
src/models/service-catalog/DeployedModel.ts
TypeScript
FunctionDeclaration
export function createAuthClient(authServerUri: string) { return new AuthClient(authServerUri); }
biancadanforth/fxa
packages/fxa-settings/src/lib/auth.ts
TypeScript
FunctionDeclaration
export function useAuth() { const { auth } = useContext(AuthContext); if (!auth) { throw new Error('Are you forgetting an AuthContext.Provider?'); } return auth!; }
biancadanforth/fxa
packages/fxa-settings/src/lib/auth.ts
TypeScript
FunctionDeclaration
export function usePasswordChanger({ onSuccess, onError, }: { onSuccess?: (r: PasswordChangeResponse) => void; onError?: (e: AuthServerError) => void; } = {}) { const auth = useAuth(); return useAsyncCallback( async ( email: string, oldPassword: string, newPassword: string, sessionToken: hexstring ) => { const response = await auth.passwordChange( email, oldPassword, newPassword, { sessionToken, } ); return response; }, { onSuccess, onError, } ); }
biancadanforth/fxa
packages/fxa-settings/src/lib/auth.ts
TypeScript