type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
MethodDeclaration
ngOnInit(): void { this.phoneN = 'PHONE: ' + appSettings.getString('phoneN', 'ENTER PHONE NUMBER'); this.auto = appSettings.getBoolean('auto', false); this.bgSource = appSettings.getBoolean('bgsource', false); this.rangeText = "AUTO STOP AT BG VALUE: " + appSettings.getNumber('range', 80) + " MG/DL"; this.traceWriterService.subscribe( ({ message, date, category, messageType }) => { this.databaseService.insertLogs(date, message, messageType, category); } ); this.sendDatatoNightscout7().then(() => console.log(this.nsUrl2 + "fffffffff3333333f") ); }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
getBGRange(){ dialogs.prompt({ title: "ENTER LIMIT BG VALUE TO SUSPEND PUMP", message: "LIMIT BG VALUE IS:", okButtonText: "OK", cancelButtonText: "CANCEL", inputType: dialogs.inputType.number }).then(r => { console.log("Dialog closed!" + r.result + ", A TO TEKST:" + r.text); this.range = Number(r.text); if(this.range < 80 || this.range > 120){ dialogs.alert({message: "BG VALUE OUT OF ACCEPTABLE RANGE: 80 - 120 mg/dl", okButtonText: "OK"}); } else { appSettings.setNumber('range', this.range); this.rangeText = "AUTO STOP AT BG VALUE: " + this.range + " MG/DL"; } }); }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
setPhoneNumber(){ dialogs.prompt({ title: "ENTER PHONE NUMBER", message: "Enter parent or guardian phone number for remote SMS commands: START, STOP, BOLUS", okButtonText: "OK", cancelButtonText: "CANCEL", inputType: dialogs.inputType.number }).then(r => { console.log("Dialog closed!" + r.result + ", A TO TEKST:" + r.text); if (r.text === '') { appSettings.setString('phoneN', 'ENTER PHONE NUMBER'); this.phoneN = 'ENTER PHONE NUMBER'; } else { Permissions.requestPermission( android.Manifest.permission.SEND_SMS, "zezwolic na czytanie SMS?" ).then(() => Permissions.requestPermission(android.Manifest.permission.READ_SMS)); appSettings.setString('phoneN', r.text); this.phoneN = 'PHONE: ' + r.text; } }); }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
sendLogs() { const documents = fs.path.join(android.os.Environment.getExternalStorageDirectory().getAbsolutePath().toString()); const myFolder = fs.Folder.fromPath(documents); const myFile = myFolder.getFile("my.txt"); const a = Runtime.getRuntime().exec('logcat -v time -f /sdcard/my.txt -d'); console.log("to ta wielkosc pliku: " + myFile.size); if (myFile.size > 2000000 ) { myFile.remove(); } const u = setInterval( () => { if (a.isAlive() === false){ clearInterval(u); console.log("CIOSs"); Permissions.requestPermission( android.Manifest.permission.WRITE_EXTERNAL_STORAGE, ).then(() => compose({ subject: "Debug med-link-ui", body: "aReduced2", to: ["[email protected]"], attachments: [{ mimeType: 'text', path: myFile.path, fileName: 'my.txt' }] }) ) } else { console.log("BAM BAM"); } }, 500); }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
Zapisz() { console.log("aaaaaa" + this.nsUrl); const sha1 = require("sha1"); this.databaseService.insertNS(this.nsUrl, sha1(this.nsKey), this.nsKey); console.log("NS URL: " + this.nsUrl + " ddddddddddd " + this.nsKey); this.sendDatatoNightscout6().then(() => console.log(this.slowo + "aRRRRRRRRRR") ); if ( this.nsUrl.substring(0, 4).toUpperCase() !== "HTTP" || this.nsUrl.substring(this.nsUrl.length - 1, this.nsUrl.length) === "/" ) { this.slowo2 = "INCORRECT URL!"; } else { this.slowo2 = "OK! "; } }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
onCheckedChangeAuto(args: EventData) { const mySwitch = args.object as Switch; const isChecked = mySwitch.checked; // boolean if (isChecked === true) { appSettings.setBoolean("auto", true); this.auto = appSettings.getBoolean('auto'); } else { appSettings.setBoolean("auto", false); this.auto = appSettings.getBoolean('auto'); } }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
onCheckedChangeSource(args: EventData) { const mySwitch = args.object as Switch; const isChecked = mySwitch.checked; // boolean if (isChecked === true) { appSettings.setBoolean("bgsource", true); this.bgSource = appSettings.getBoolean('bgsource'); } else { appSettings.setBoolean("bgsource", false); this.bgSource = appSettings.getBoolean('bgsource'); } }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
sendDatatoNightscout6() { return new Promise((resolve, reject) => { this.getNSData().subscribe(g => { g.map(bol => { console.log(bol.http.toString() + "JJJJJJJ" + bol.secret.toString()); this.slowo = this.slowo2 + " " + bol.http.toString() + " " + bol.secret.toString(); }); console.log("as" + this.slowo); resolve(), reject(); }); }); }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
sendDatatoNightscout7() { return new Promise((resolve, reject) => { this.getNSData().subscribe(g => { g.map(bol => { console.log( bol.http.toString() + "66666666666" + bol.secret.toString() ); this.nsUrl2 = bol.http.toString(); this.nsKey2 = bol.hash.toString(); }); console.log("as" + this.nsUrl2); resolve(), reject(); }); }); }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
setNS(arg) { console.log("setttNS"); console.log(arg.text); this.nsUrl = arg.text; }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
setNSurl(arg) { console.log("setttNSUURRL"); console.log(arg.text); this.nsKey = arg.text; }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
MethodDeclaration
getNSData(): Observable< Array<{ http: string; secret: string; hash: string }> > { return this.databaseService.NSconf().pipe( map(rows => { return rows.map(a => ({ http: a[0], secret: a[1], hash: a[2] })); }) ); }
dirceusemighini/Med-Link-User-EN
src/app/search/search.component.ts
TypeScript
ArrowFunction
() => { const BGMUser = new BangumiUser('test', 'test'); const P = (<jest.Mock<BangumiApiRequest>>BangumiApiRequest).mock.instances[0]; // eslint-disable-next-line @typescript-eslint/ban-ts-comment ///@ts-ignore const mockGet = <jest.Mock>P.get; it('getMeInfo(): 路径', async () => { mockGet.mockResolvedValue({}); await BGMUser.getMeInfo(); expect(mockGet.mock.calls[0][0]).toBe('/v0/me'); }); it('getUserInfo(): 替换请求路径', async () => { mockGet.mockResolvedValue({}); await BGMUser.getUserInfo(1); expect(mockGet.mock.calls[0][0]).toBe('/user/1'); }); it('getUserCollectionsStatus(): 替换请求路径', async () => { mockGet.mockResolvedValue({}); await BGMUser.getUserCollectionsStatus(1); expect(mockGet.mock.calls[0][0]).toBe('/user/1/collections/status'); }); it('getgetUserCollectionProgress(): 替换请求路径, 拼接 query', async () => { mockGet.mockResolvedValue({}); await BGMUser.getUserCollectionProgress(1, 2); expect(mockGet.mock.calls[0][0]).toBe('/user/1/progress?subject_id=2'); }); beforeEach(() => { jest.clearAllMocks(); }); }
1574242600/bgmtv-importer
src/bangumi/api/__test__/uesr.test.ts
TypeScript
ArrowFunction
async () => { mockGet.mockResolvedValue({}); await BGMUser.getMeInfo(); expect(mockGet.mock.calls[0][0]).toBe('/v0/me'); }
1574242600/bgmtv-importer
src/bangumi/api/__test__/uesr.test.ts
TypeScript
ArrowFunction
async () => { mockGet.mockResolvedValue({}); await BGMUser.getUserInfo(1); expect(mockGet.mock.calls[0][0]).toBe('/user/1'); }
1574242600/bgmtv-importer
src/bangumi/api/__test__/uesr.test.ts
TypeScript
ArrowFunction
async () => { mockGet.mockResolvedValue({}); await BGMUser.getUserCollectionsStatus(1); expect(mockGet.mock.calls[0][0]).toBe('/user/1/collections/status'); }
1574242600/bgmtv-importer
src/bangumi/api/__test__/uesr.test.ts
TypeScript
ArrowFunction
async () => { mockGet.mockResolvedValue({}); await BGMUser.getUserCollectionProgress(1, 2); expect(mockGet.mock.calls[0][0]).toBe('/user/1/progress?subject_id=2'); }
1574242600/bgmtv-importer
src/bangumi/api/__test__/uesr.test.ts
TypeScript
ArrowFunction
() => { jest.clearAllMocks(); }
1574242600/bgmtv-importer
src/bangumi/api/__test__/uesr.test.ts
TypeScript
ClassDeclaration
@NgModule({ declarations: [ MyApp ], imports: [ BrowserModule, IonicModule.forRoot(MyApp), AngularFireModule.initializeApp(FIREBASE_CONFIG), AngularFireDatabaseModule, ], bootstrap: [IonicApp], entryComponents: [ MyApp ], providers: [ StatusBar, SplashScreen, {provide: ErrorHandler, useClass: IonicErrorHandler}, ShoppingListService, ToastService ] }) export class AppModule {}
priyamshah112/Ionic-Projects
IonicShoppingList/src/app/app.module.ts
TypeScript
ArrowFunction
() => { it('should open and close the modal', async () => { const Element = () => { const { openModal } = useContext(ModalContext) const handleOpen = () => openModal('modal title', 'modal message') return ( <div> <button type="button" onClick={handleOpen}> open modal </button> </div> ) }
Henriquepb22/pokemon-shop
src/contexts/ModalContext/index.test.tsx
TypeScript
ArrowFunction
async () => { const Element = () => { const { openModal } = useContext(ModalContext) const handleOpen = () => openModal('modal title', 'modal message') return ( <div> <button type="button" onClick={handleOpen}> open modal </button> </div>
Henriquepb22/pokemon-shop
src/contexts/ModalContext/index.test.tsx
TypeScript
ArrowFunction
() => { const { openModal } = useContext(ModalContext) const handleOpen = () => openModal('modal title', 'modal message') return ( <div> <button type="button" onClick={handleOpen}> open modal </button> </div>
Henriquepb22/pokemon-shop
src/contexts/ModalContext/index.test.tsx
TypeScript
ArrowFunction
() => openModal('modal title', 'modal message')
Henriquepb22/pokemon-shop
src/contexts/ModalContext/index.test.tsx
TypeScript
ArrowFunction
() => { expect( screen.queryByRole('heading', { name: /modal title/i }) ).toBeInTheDocument() expect(screen.queryByText(/modal message/i)).toBeInTheDocument() }
Henriquepb22/pokemon-shop
src/contexts/ModalContext/index.test.tsx
TypeScript
ArrowFunction
() => { expect( screen.queryByRole('heading', { name: /modal title/i }) ).not.toBeInTheDocument() expect(screen.queryByText(/modal message/i)).not.toBeInTheDocument() }
Henriquepb22/pokemon-shop
src/contexts/ModalContext/index.test.tsx
TypeScript
ClassDeclaration
class Component extends Vue {}
ggkk0818/fan_controller
src/module.d.ts
TypeScript
FunctionDeclaration
function brushed() { let selected = null; selected = x2.domain() .filter(function(d) { return (brush.extent()[0] <= x2(d)) && (x2(d) <= brush.extent()[1]); }); let start; let end; if (brush.extent()[0] != brush.extent()[1]) { start = selected[0]; end = selected[selected.length - 1] + 1; } else { start = 0; end = data.length; } const updatedData = data.slice(start, end); update(updatedData); enter(updatedData); exit(updatedData); updateScale(updatedData); }
klarjun/twitter-angular-template
src/app/graphs/brushing-bar-graph/brushing-bar-graph.component.ts
TypeScript
FunctionDeclaration
function updateScale(data) { const tickScale = d3.scale.pow().range([data.length / 10, 0]).domain([data.length, 0]).exponent(.5); let brushValue = brush.extent()[1] - brush.extent()[0]; if (brushValue === 0) { brushValue = width; } const tickValueMultiplier = Math.ceil(Math.abs(tickScale(brushValue))); const filteredTickValues = data.filter(function(d, i) {return i % tickValueMultiplier === 0; }).map(function(d) { return d.date; }); focus.select('.x.axis').call(xAxis.tickValues(filteredTickValues)); focus.select('.y.axis').call(yAxis); }
klarjun/twitter-angular-template
src/app/graphs/brushing-bar-graph/brushing-bar-graph.component.ts
TypeScript
FunctionDeclaration
function update(data) { x.domain(data.map(function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.price; })]); const bars = focus.selectAll('.bar') .data(data); bars .attr( { height: function (d, i) { return height - y(d.price); }, width: function(d) { return x.rangeBand(); }, x: function(d) { return x(d.date); }, y: function(d) { return y(d.price); } }); }
klarjun/twitter-angular-template
src/app/graphs/brushing-bar-graph/brushing-bar-graph.component.ts
TypeScript
FunctionDeclaration
function exit(data) { const bars = focus.selectAll('.bar').data(data); bars.exit().remove(); }
klarjun/twitter-angular-template
src/app/graphs/brushing-bar-graph/brushing-bar-graph.component.ts
TypeScript
FunctionDeclaration
function enter(data) { x.domain(data.map(function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.price; })]); const bars = focus.selectAll('.bar') .data(data); bars.enter().append('rect') .classed('bar', true) .attr( { height: function (d, i) { return height - y(d.price); }, width: function(d) { return x.rangeBand(); }, x: function(d) { return x(d.date); }, y: function(d) { return y(d.price); } }); }
klarjun/twitter-angular-template
src/app/graphs/brushing-bar-graph/brushing-bar-graph.component.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-brushing-bar-graph', templateUrl: './brushing-bar-graph.component.html', styleUrls: ['./brushing-bar-graph.component.css'] }) export class BrushingBarGraphComponent implements OnInit { constructor() { } ngOnInit(): void { this.loadGraph(); } loadGraph() { const data = []; for (let i = 0; i < 300; i++) { const datum = {} as any; datum.date = i; datum.price = Math.floor(Math.random() * 600); data.push(datum); } const margin = {top: 10, right: 10, bottom: 100, left: 40}, margin2 = {top: 430, right: 10, bottom: 20, left: 40}, width = 750 - margin.left - margin.right, height = 300 - margin.top - margin.bottom, height2 = 300 - margin2.top - margin2.bottom; const x = d3.scale.ordinal().rangeBands([0, width], .1), x2 = d3.scale.ordinal().rangeBands([0, width], .1), y = d3.scale.linear().range([height, 0]), y2 = d3.scale.linear().range([height2, 0]); const xAxis = d3.svg.axis().scale(x).orient('bottom'), xAxis2 = d3.svg.axis().scale(x2).orient('bottom').tickValues([]), yAxis = d3.svg.axis().scale(y).orient('left'); x.domain(data.map(function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.price; })]); x2.domain(x.domain()); y2.domain(y.domain()); const brush = d3.svg.brush() .x(x2) .on('brush', brushed); const svg = d3.select('.brushing-bar-graph').append('svg') .attr('width', width + margin.left + margin.right) .attr('height', height + margin.top + margin.bottom); const focus = svg.append('g') .attr('class', 'focus') .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); const context = svg.append('g') .attr('class', 'context') .attr('transform', 'translate(' + margin2.left + ',' + margin2.top + ')'); focus.append('g') .attr('class', 'x axis') .attr('transform', 'translate(0,' + height + ')') .call(xAxis); focus.append('g') .attr('class', 'y axis') .call(yAxis); console.log(x(data[0].date)); enter(data); updateScale(data); const subBars = context.selectAll('.subBar') .data(data); subBars.enter().append('rect') .classed('subBar', true) .attr( { height: function (d) { return height2 - y2(d.price); }, width: function(d) { return x.rangeBand(); }, x: function(d) { return x2(d.date); }, y: function(d) { return y2(d.price); } }); context.append('g') .attr('class', 'x axis') .attr('transform', 'translate(0,' + height2 + ')') .call(xAxis2); context.append('g') .attr('class', 'x brush') .call(brush) .selectAll('rect') .attr('y', -6) .attr('height', height2 + 7); function brushed() { let selected = null; selected = x2.domain() .filter(function(d) { return (brush.extent()[0] <= x2(d)) && (x2(d) <= brush.extent()[1]); }); let start; let end; if (brush.extent()[0] != brush.extent()[1]) { start = selected[0]; end = selected[selected.length - 1] + 1; } else { start = 0; end = data.length; } const updatedData = data.slice(start, end); update(updatedData); enter(updatedData); exit(updatedData); updateScale(updatedData); } function updateScale(data) { const tickScale = d3.scale.pow().range([data.length / 10, 0]).domain([data.length, 0]).exponent(.5); let brushValue = brush.extent()[1] - brush.extent()[0]; if (brushValue === 0) { brushValue = width; } const tickValueMultiplier = Math.ceil(Math.abs(tickScale(brushValue))); const filteredTickValues = data.filter(function(d, i) {return i % tickValueMultiplier === 0; }).map(function(d) { return d.date; }); focus.select('.x.axis').call(xAxis.tickValues(filteredTickValues)); focus.select('.y.axis').call(yAxis); } function update(data) { x.domain(data.map(function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.price; })]); const bars = focus.selectAll('.bar') .data(data); bars .attr( { height: function (d, i) { return height - y(d.price); }, width: function(d) { return x.rangeBand(); }, x: function(d) { return x(d.date); }, y: function(d) { return y(d.price); } }); } function exit(data) { const bars = focus.selectAll('.bar').data(data); bars.exit().remove(); } function enter(data) { x.domain(data.map(function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.price; })]); const bars = focus.selectAll('.bar') .data(data); bars.enter().append('rect') .classed('bar', true) .attr( { height: function (d, i) { return height - y(d.price); }, width: function(d) { return x.rangeBand(); }, x: function(d) { return x(d.date); }, y: function(d) { return y(d.price); } }); } } }
klarjun/twitter-angular-template
src/app/graphs/brushing-bar-graph/brushing-bar-graph.component.ts
TypeScript
MethodDeclaration
ngOnInit(): void { this.loadGraph(); }
klarjun/twitter-angular-template
src/app/graphs/brushing-bar-graph/brushing-bar-graph.component.ts
TypeScript
MethodDeclaration
loadGraph() { const data = []; for (let i = 0; i < 300; i++) { const datum = {} as any; datum.date = i; datum.price = Math.floor(Math.random() * 600); data.push(datum); } const margin = {top: 10, right: 10, bottom: 100, left: 40}, margin2 = {top: 430, right: 10, bottom: 20, left: 40}, width = 750 - margin.left - margin.right, height = 300 - margin.top - margin.bottom, height2 = 300 - margin2.top - margin2.bottom; const x = d3.scale.ordinal().rangeBands([0, width], .1), x2 = d3.scale.ordinal().rangeBands([0, width], .1), y = d3.scale.linear().range([height, 0]), y2 = d3.scale.linear().range([height2, 0]); const xAxis = d3.svg.axis().scale(x).orient('bottom'), xAxis2 = d3.svg.axis().scale(x2).orient('bottom').tickValues([]), yAxis = d3.svg.axis().scale(y).orient('left'); x.domain(data.map(function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.price; })]); x2.domain(x.domain()); y2.domain(y.domain()); const brush = d3.svg.brush() .x(x2) .on('brush', brushed); const svg = d3.select('.brushing-bar-graph').append('svg') .attr('width', width + margin.left + margin.right) .attr('height', height + margin.top + margin.bottom); const focus = svg.append('g') .attr('class', 'focus') .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); const context = svg.append('g') .attr('class', 'context') .attr('transform', 'translate(' + margin2.left + ',' + margin2.top + ')'); focus.append('g') .attr('class', 'x axis') .attr('transform', 'translate(0,' + height + ')') .call(xAxis); focus.append('g') .attr('class', 'y axis') .call(yAxis); console.log(x(data[0].date)); enter(data); updateScale(data); const subBars = context.selectAll('.subBar') .data(data); subBars.enter().append('rect') .classed('subBar', true) .attr( { height: function (d) { return height2 - y2(d.price); }, width: function(d) { return x.rangeBand(); }, x: function(d) { return x2(d.date); }, y: function(d) { return y2(d.price); } }); context.append('g') .attr('class', 'x axis') .attr('transform', 'translate(0,' + height2 + ')') .call(xAxis2); context.append('g') .attr('class', 'x brush') .call(brush) .selectAll('rect') .attr('y', -6) .attr('height', height2 + 7); function brushed() { let selected = null; selected = x2.domain() .filter(function(d) { return (brush.extent()[0] <= x2(d)) && (x2(d) <= brush.extent()[1]); }); let start; let end; if (brush.extent()[0] != brush.extent()[1]) { start = selected[0]; end = selected[selected.length - 1] + 1; } else { start = 0; end = data.length; } const updatedData = data.slice(start, end); update(updatedData); enter(updatedData); exit(updatedData); updateScale(updatedData); } function updateScale(data) { const tickScale = d3.scale.pow().range([data.length / 10, 0]).domain([data.length, 0]).exponent(.5); let brushValue = brush.extent()[1] - brush.extent()[0]; if (brushValue === 0) { brushValue = width; } const tickValueMultiplier = Math.ceil(Math.abs(tickScale(brushValue))); const filteredTickValues = data.filter(function(d, i) {return i % tickValueMultiplier === 0; }).map(function(d) { return d.date; }); focus.select('.x.axis').call(xAxis.tickValues(filteredTickValues)); focus.select('.y.axis').call(yAxis); } function update(data) { x.domain(data.map(function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.price; })]); const bars = focus.selectAll('.bar') .data(data); bars .attr( { height: function (d, i) { return height - y(d.price); }, width: function(d) { return x.rangeBand(); }, x: function(d) { return x(d.date); }, y: function(d) { return y(d.price); } }); } function exit(data) { const bars = focus.selectAll('.bar').data(data); bars.exit().remove(); } function enter(data) { x.domain(data.map(function(d) { return d.date; })); y.domain([0, d3.max(data, function(d) { return d.price; })]); const bars = focus.selectAll('.bar') .data(data); bars.enter().append('rect') .classed('bar', true) .attr( { height: function (d, i) { return height - y(d.price); }, width: function(d) { return x.rangeBand(); }, x: function(d) { return x(d.date); }, y: function(d) { return y(d.price); } }); } }
klarjun/twitter-angular-template
src/app/graphs/brushing-bar-graph/brushing-bar-graph.component.ts
TypeScript
ClassDeclaration
/***************************************************************************** * A rectangular in 2D space. * * @author Christopher Stock * @version 0.0.2 *****************************************************************************/ class LibRect2D extends LibShape2D { /***************************************************************************** * Constructs a new rectangular. * * @param left Left coordinate for this rect. * @param top Top coordinate for this rect. * @param width Width for the new rect. * @param height Height for the new rect. *****************************************************************************/ public constructor( left:number, top:number, width:number, height:number ) { super( left, top, width, height ); } /***************************************************************************** * Checks if this rect contains the given point. * * @param x The X coordinate of the point to check. * @param y The Y coordinate of the point to check. * @return <code>true</code> if the point lies inside the rectangle. * Otherwise <code>false</code>. *****************************************************************************/ public containsPoint( x:number, y:number ):boolean { return ( x >= this.anchor.x && x < this.anchor.x + this.size.width && y >= this.anchor.y && y < this.anchor.y + this.size.height ); } /***************************************************************************** * Checks if the given rect intersects this rect. * * @param rect The rect to check for intersection. * @return <code>true</code> if the rects collide. * Otherwise <code>false</code>. *****************************************************************************/ public collidesWithRect( rect:LibRect2D ):boolean { return !( this.anchor.x >= rect.anchor.x + rect.size.width || this.anchor.x + this.size.width <= rect.anchor.x || this.anchor.y >= rect.anchor.y + rect.size.height || this.anchor.y + this.size.height <= rect.anchor.y ); } /***************************************************************************** * Checks if the given rect equals with this rect. * * @param rect The rect to check for equality. * @return <code>true</code> if the rects equal. * Otherwise <code>false</code>. *****************************************************************************/ public equalsWithRect( rect:LibRect2D ):boolean { return ( this.anchor.x == rect.anchor.x && this.size.width == rect.size.width && this.anchor.y == rect.anchor.y && this.size.height == rect.size.height ); } }
christopherstock/HTML5-TypeScript-WebGL-Demo
src_lib/de/mayflower/lib/math/geom2d/LibRect2D.ts
TypeScript
MethodDeclaration
/***************************************************************************** * Checks if this rect contains the given point. * * @param x The X coordinate of the point to check. * @param y The Y coordinate of the point to check. * @return <code>true</code> if the point lies inside the rectangle. * Otherwise <code>false</code>. *****************************************************************************/ public containsPoint( x:number, y:number ):boolean { return ( x >= this.anchor.x && x < this.anchor.x + this.size.width && y >= this.anchor.y && y < this.anchor.y + this.size.height ); }
christopherstock/HTML5-TypeScript-WebGL-Demo
src_lib/de/mayflower/lib/math/geom2d/LibRect2D.ts
TypeScript
MethodDeclaration
/***************************************************************************** * Checks if the given rect intersects this rect. * * @param rect The rect to check for intersection. * @return <code>true</code> if the rects collide. * Otherwise <code>false</code>. *****************************************************************************/ public collidesWithRect( rect:LibRect2D ):boolean { return !( this.anchor.x >= rect.anchor.x + rect.size.width || this.anchor.x + this.size.width <= rect.anchor.x || this.anchor.y >= rect.anchor.y + rect.size.height || this.anchor.y + this.size.height <= rect.anchor.y ); }
christopherstock/HTML5-TypeScript-WebGL-Demo
src_lib/de/mayflower/lib/math/geom2d/LibRect2D.ts
TypeScript
MethodDeclaration
/***************************************************************************** * Checks if the given rect equals with this rect. * * @param rect The rect to check for equality. * @return <code>true</code> if the rects equal. * Otherwise <code>false</code>. *****************************************************************************/ public equalsWithRect( rect:LibRect2D ):boolean { return ( this.anchor.x == rect.anchor.x && this.size.width == rect.size.width && this.anchor.y == rect.anchor.y && this.size.height == rect.size.height ); }
christopherstock/HTML5-TypeScript-WebGL-Demo
src_lib/de/mayflower/lib/math/geom2d/LibRect2D.ts
TypeScript
ArrowFunction
(event: React.MouseEvent<HTMLAnchorElement>) => { event.preventDefault() if (this.props.disabled) { return } const uri = this.props.uri if (uri) { shell.openExternal(uri) } const onClick = this.props.onClick if (onClick) { onClick() } }
123kiril/desktop
app/src/ui/lib/link-button.tsx
TypeScript
ClassDeclaration
/** * A link component. * * Provide `children` elements for the title of the rendered hyperlink. */ export class LinkButton extends React.Component<ILinkButtonProps, {}> { public render() { const href = this.props.uri || '' const className = classNames('link-button-component', this.props.className) return ( <a className={className} href={href} onClick={this.onClick} title={this.props.title} tabIndex={this.props.tabIndex} > {this.props.children} </a> ) } private onClick = (event: React.MouseEvent<HTMLAnchorElement>) => { event.preventDefault() if (this.props.disabled) { return } const uri = this.props.uri if (uri) { shell.openExternal(uri) } const onClick = this.props.onClick if (onClick) { onClick() } } }
123kiril/desktop
app/src/ui/lib/link-button.tsx
TypeScript
InterfaceDeclaration
interface ILinkButtonProps { /** A URI to open on click. */ readonly uri?: string /** A function to call on click. */ readonly onClick?: () => void /** CSS classes attached to the component */ readonly className?: string /** The tab index of the anchor element. */ readonly tabIndex?: number /** Disable the link from being clicked */ readonly disabled?: boolean /** title-text or tooltip for the link */ readonly title?: string }
123kiril/desktop
app/src/ui/lib/link-button.tsx
TypeScript
MethodDeclaration
public render() { const href = this.props.uri || '' const className = classNames('link-button-component', this.props.className) return ( <a className={className} href={href} onClick={this.onClick} title={this.props.title} tabIndex={this.props.tabIndex} > {this.props.children} </a> ) }
123kiril/desktop
app/src/ui/lib/link-button.tsx
TypeScript
ArrowFunction
(asset: Asset): PoolFeeLD => { // special case for RUNE if (isRuneNativeAsset(asset)) { return FP.pipe( THOR.fees$(), liveData.map((fees) => ({ amount: fees.fast, asset: AssetRuneNative })) ) } else { return FP.pipe( gasRateByChain$(asset.chain), liveData.map((gasRate) => getChainFeeByGasRate({ asset, gasRate })), // Map to an error if fee could not be found liveData.chain(liveData.fromOption(() => Error(`Could not find fee for ${asset.chain} chain`))) ) } }
SS-FS-58/asgardex-electron
src/renderer/services/chain/fees/common.ts
TypeScript
ArrowFunction
(fees) => ({ amount: fees.fast, asset: AssetRuneNative })
SS-FS-58/asgardex-electron
src/renderer/services/chain/fees/common.ts
TypeScript
ArrowFunction
(gasRate) => getChainFeeByGasRate({ asset, gasRate })
SS-FS-58/asgardex-electron
src/renderer/services/chain/fees/common.ts
TypeScript
ArrowFunction
() => Error(`Could not find fee for ${asset.chain} chain`)
SS-FS-58/asgardex-electron
src/renderer/services/chain/fees/common.ts
TypeScript
ArrowFunction
(sc:any) => { sumAbs += Math.abs(sc.difference); }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
ArrowFunction
(a:any, b:any) => b.membership - a.membership
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
ArrowFunction
(element:any) => { let spotResult = this._getSpotRatio(p.find((item:any) => item.id === element.id), q.find((item:any) => item.id === element.id)); sumSpotResults += spotResult; j++; if (j >= this._k){ aux = sumSpotResults / this._k valaux = true; } }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
ArrowFunction
(item:any) => item.id === element.id
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
ArrowFunction
(a:any, b:any) => (a.nonmembership > b.nonmembership) ? 1 : -1
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
ArrowFunction
(p: any )=> { colectiva.forEach((q:any) => { if(p.id === q.id){ let spotc: any = {}; spotc['id'] = p.id spotc['difference'] = (p.membership - q.membership) + this._alpha * (p.hesitation - q.hesitation); spotComparisons.push(spotc); } }); }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
ArrowFunction
(q:any) => { if(p.id === q.id){ let spotc: any = {}; spotc['id'] = p.id spotc['difference'] = (p.membership - q.membership) + this._alpha * (p.hesitation - q.hesitation); spotComparisons.push(spotc); } }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
ClassDeclaration
@Injectable({ providedIn: 'root' }) export class SimilarityMeasureService { _alpha = 0.5; _k = -1 constructor() { } public _getSimilarity(individual: any, colectivo: any, k: number) { this._k = k; let ret = 0; if (this._k < 0) { this._k = individual.length; } let _result = this._getSimilarityExtended(individual, colectivo); ret = _result.level as number; return ret; } private _getSimilarityExtended(individual: any, colectiva: any) { let spotComparisons = this._getSpotComparisons(individual, colectiva); let sumAbs = 0; let n = spotComparisons.length; spotComparisons.forEach((sc:any) => { sumAbs += Math.abs(sc.difference); }); let grossLevel = 1 - sumAbs / n; let cdfMembership = this._approximateMembershipCDF(individual, colectiva) ; let cdfNonMembership = this._approximateNonMembershipCDF(individual, colectiva); let _result:any = { CDFMembership: 0, CDFNonMembership: 0, CDF: 0, grossLevel:0, level:0 }; _result['CDFMembership'] = cdfMembership; _result['CDFNonMembership'] = cdfNonMembership; _result['CDF'] = (cdfMembership + cdfNonMembership) / 2; _result['grossLevel'] = grossLevel; _result['level'] = grossLevel * _result.CDF; return _result; } private _approximateMembershipCDF(p: any, q: any){ let ret = 0; let n = p.length; let j = 0; let sumSpotResults = 0; let aux = 0; let valaux = false; if (n == 0){ return ret; } let sortedP = p.slice().sort((a:any, b:any) => b.membership - a.membership); sortedP.forEach((element:any) => { let spotResult = this._getSpotRatio(p.find((item:any) => item.id === element.id), q.find((item:any) => item.id === element.id)); sumSpotResults += spotResult; j++; if (j >= this._k){ aux = sumSpotResults / this._k valaux = true; } }); ret = sumSpotResults / this._k; if(valaux){ ret = aux } return ret; } private _getSpotRatio(a:any, b:any){ let r = 0.5; //default value let a_mu = a.membership + this._alpha * a.hesitation; let a_nu = a.nonmembership + (1 - this._alpha) * a.hesitation; let b_mu = b.membership + this._alpha * b.hesitation; let b_nu = b.nonmembership + (1 - this._alpha) * b.hesitation; let o_mu = a.nonmembership + this._alpha * a.hesitation; let o_nu = a.membership + (1 - this._alpha) * a.hesitation; let Aao = a_mu * o_nu - a_nu * o_mu; let Abo = b_mu * o_nu - b_nu * o_mu; if (Math.abs(Aao) > 0) { r = Abo / Aao; if (r > 0) { r = Math.min(1, r); } else { r = 0; } } return r; } private _approximateNonMembershipCDF(p: any, q:any){ let ret = 0; let n = p.length; let j = 0; let sumSpotResults = 0; let aux = 0; let valaux = false; if (n == 0){ return ret; } let sortedP = p.slice().sort((a:any, b:any) => (a.nonmembership > b.nonmembership) ? 1 : -1); sortedP.forEach((element:any) => { let spotResult = this._getSpotRatio(p.find((item:any) => item.id === element.id), q.find((item:any) => item.id === element.id)); sumSpotResults += spotResult; j++; if (j >= this._k){ aux = sumSpotResults / this._k valaux = true; } }); ret = sumSpotResults / this._k; if(valaux){ ret = aux } return ret; } private _getSpotComparisons(individual: any, colectiva: any) { let spotComparisons: any = [] individual.forEach((p: any )=> { colectiva.forEach((q:any) => { if(p.id === q.id){ let spotc: any = {}; spotc['id'] = p.id spotc['difference'] = (p.membership - q.membership) + this._alpha * (p.hesitation - q.hesitation); spotComparisons.push(spotc); } }); }); return spotComparisons; } }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
MethodDeclaration
public _getSimilarity(individual: any, colectivo: any, k: number) { this._k = k; let ret = 0; if (this._k < 0) { this._k = individual.length; } let _result = this._getSimilarityExtended(individual, colectivo); ret = _result.level as number; return ret; }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
MethodDeclaration
private _getSimilarityExtended(individual: any, colectiva: any) { let spotComparisons = this._getSpotComparisons(individual, colectiva); let sumAbs = 0; let n = spotComparisons.length; spotComparisons.forEach((sc:any) => { sumAbs += Math.abs(sc.difference); }); let grossLevel = 1 - sumAbs / n; let cdfMembership = this._approximateMembershipCDF(individual, colectiva) ; let cdfNonMembership = this._approximateNonMembershipCDF(individual, colectiva); let _result:any = { CDFMembership: 0, CDFNonMembership: 0, CDF: 0, grossLevel:0, level:0 }; _result['CDFMembership'] = cdfMembership; _result['CDFNonMembership'] = cdfNonMembership; _result['CDF'] = (cdfMembership + cdfNonMembership) / 2; _result['grossLevel'] = grossLevel; _result['level'] = grossLevel * _result.CDF; return _result; }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
MethodDeclaration
private _approximateMembershipCDF(p: any, q: any){ let ret = 0; let n = p.length; let j = 0; let sumSpotResults = 0; let aux = 0; let valaux = false; if (n == 0){ return ret; } let sortedP = p.slice().sort((a:any, b:any) => b.membership - a.membership); sortedP.forEach((element:any) => { let spotResult = this._getSpotRatio(p.find((item:any) => item.id === element.id), q.find((item:any) => item.id === element.id)); sumSpotResults += spotResult; j++; if (j >= this._k){ aux = sumSpotResults / this._k valaux = true; } }); ret = sumSpotResults / this._k; if(valaux){ ret = aux } return ret; }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
MethodDeclaration
private _getSpotRatio(a:any, b:any){ let r = 0.5; //default value let a_mu = a.membership + this._alpha * a.hesitation; let a_nu = a.nonmembership + (1 - this._alpha) * a.hesitation; let b_mu = b.membership + this._alpha * b.hesitation; let b_nu = b.nonmembership + (1 - this._alpha) * b.hesitation; let o_mu = a.nonmembership + this._alpha * a.hesitation; let o_nu = a.membership + (1 - this._alpha) * a.hesitation; let Aao = a_mu * o_nu - a_nu * o_mu; let Abo = b_mu * o_nu - b_nu * o_mu; if (Math.abs(Aao) > 0) { r = Abo / Aao; if (r > 0) { r = Math.min(1, r); } else { r = 0; } } return r; }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
MethodDeclaration
private _approximateNonMembershipCDF(p: any, q:any){ let ret = 0; let n = p.length; let j = 0; let sumSpotResults = 0; let aux = 0; let valaux = false; if (n == 0){ return ret; } let sortedP = p.slice().sort((a:any, b:any) => (a.nonmembership > b.nonmembership) ? 1 : -1); sortedP.forEach((element:any) => { let spotResult = this._getSpotRatio(p.find((item:any) => item.id === element.id), q.find((item:any) => item.id === element.id)); sumSpotResults += spotResult; j++; if (j >= this._k){ aux = sumSpotResults / this._k valaux = true; } }); ret = sumSpotResults / this._k; if(valaux){ ret = aux } return ret; }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
MethodDeclaration
private _getSpotComparisons(individual: any, colectiva: any) { let spotComparisons: any = [] individual.forEach((p: any )=> { colectiva.forEach((q:any) => { if(p.id === q.id){ let spotc: any = {}; spotc['id'] = p.id spotc['difference'] = (p.membership - q.membership) + this._alpha * (p.hesitation - q.hesitation); spotComparisons.push(spotc); } }); }); return spotComparisons; }
appconsensus21/AppConsensus
src/app/services/similarity-measure.service.ts
TypeScript
ArrowFunction
() => this._isError
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => this._isCompleted
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => this._isPending
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => this._isImporting
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => this._isInProgress
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => this._isUnknown
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
(): StatusMetadata => ({ isError: this._isError, isCompleted: this._isCompleted, isPending: this._isPending, isImporting: this._isImporting, isInProgress: this._isInProgress, isUnknown: this._isUnknown, group: this.group, } as any)
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => this.label
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => this.group
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => this.simpleLabel
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => { return `${this.simpleLabel}${this.simpleLabel === this.toString() ? '' : this.toString()}`; }
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ArrowFunction
() => { const result = this.label || super.toString(); return this.group && !this._isUnknown ? `${result} (${this.group.getVerboseName()})` : result; }
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
ClassDeclaration
export abstract class StatusEnum<SIMPLE_LABEL = StatusSimpleLabel> extends ObjectEnum<string> { protected readonly _isError: boolean; protected readonly _isCompleted: boolean; protected readonly _isPending: boolean; protected readonly _isImporting: boolean; protected readonly _isInProgress: boolean; protected readonly _isUnknown: boolean; protected readonly group: StatusGroup; protected readonly label: string; protected readonly simpleLabel: SIMPLE_LABEL | StatusSimpleLabel; // cache resolveSimpleLabel call protected constructor( value: string, label: string, { isError, isCompleted, isPending, isImporting, isInProgress, isUnknown, group, }: StatusMetadata = {}, ) { super(value); if (label == null) { throw new Error('StatusEnum: requires label'); } this._isError = isError || false; this._isCompleted = isCompleted || false; this._isPending = isPending || false; this._isImporting = isImporting || false; this._isInProgress = this._isPending || this._isImporting || isInProgress || false; // pending means expected progress const isKnown = isError || isCompleted || isPending || isImporting || isInProgress; if (isUnknown && isKnown) { throw new Error('StatusEnum: isUnknown flag should not include other metadata'); } this._isUnknown = isUnknown; this.group = group; this.label = label; this.simpleLabel = this.resolveSimpleLabel(); } isError = () => this._isError; isCompleted = () => this._isCompleted; isPending = () => this._isPending; isImporting = () => this._isImporting; isInProgress = () => this._isInProgress; isUnknown = () => this._isUnknown; getMetadata = (): StatusMetadata => ({ isError: this._isError, isCompleted: this._isCompleted, isPending: this._isPending, isImporting: this._isImporting, isInProgress: this._isInProgress, isUnknown: this._isUnknown, group: this.group, } as any); getLabel = () => this.label; getGroup = () => this.group; getSimpleLabel = () => this.simpleLabel; toString() { const result = this.label || super.toString(); return this.group && !this._isUnknown ? `${result} (${this.group.toString()})` : result; } toSimpleSortString = () => { return `${this.simpleLabel}${this.simpleLabel === this.toString() ? '' : this.toString()}`; }; toVerboseString = () => { const result = this.label || super.toString(); return this.group && !this._isUnknown ? `${result} (${this.group.getVerboseName()})` : result; }; protected resolveSimpleLabel(): SIMPLE_LABEL | StatusSimpleLabel { if (this._isError) { return StatusSimpleLabel.Error; } if (this._isCompleted) { return StatusSimpleLabel.Completed; } if (this._isPending) { return StatusSimpleLabel.Pending; } if (this._isImporting) { return StatusSimpleLabel.Importing; } if (this._isInProgress) { return StatusSimpleLabel.InProgress; } return StatusSimpleLabel.Other; } }
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
InterfaceDeclaration
export interface StatusMetadata { isError?: boolean; isCompleted?: boolean; isPending?: boolean; isImporting?: boolean; isInProgress?: boolean; isUnknown?: boolean; group?: StatusGroup; }
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
MethodDeclaration
toString() { const result = this.label || super.toString(); return this.group && !this._isUnknown ? `${result} (${this.group.toString()})` : result; }
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
MethodDeclaration
protected resolveSimpleLabel(): SIMPLE_LABEL | StatusSimpleLabel { if (this._isError) { return StatusSimpleLabel.Error; } if (this._isCompleted) { return StatusSimpleLabel.Completed; } if (this._isPending) { return StatusSimpleLabel.Pending; } if (this._isImporting) { return StatusSimpleLabel.Importing; } if (this._isInProgress) { return StatusSimpleLabel.InProgress; } return StatusSimpleLabel.Other; }
benjaminapetersen/console
frontend/packages/kubevirt-plugin/src/constants/status-enum.ts
TypeScript
InterfaceDeclaration
export interface BotSite { name: string; enabled: boolean; url: string; authorization: string; body: string; }
kennedy-steve/skylink-if
src/models/config-models.ts
TypeScript
InterfaceDeclaration
export interface BaseConfig { client: { ID: string; TOKEN: string; INTENTS: any[]; PARTIALS: PartialTypes[]; CACHES: { [key: string]: number; }; }; DEVELOPERS: string[]; infiniteFlight: { API_KEY: string; }; api: { PORT: number; SECRET: string; }; sharding: { SPAWN_DELAY: number; SPAWN_TIMEOUT: number; SERVERS_PER_SHARD: number; }; clustering: { ENABLED: boolean; SHARD_COUNT: number; CALLBACK_URL: string; masterApi: { URL: string; TOKEN: string; }; }; jobs: { updateServerCount: { SCHEDULE: string; LOG: boolean; }; notifyActiveInfiniteFlightUsers: { SCHEDULE: string; LOG: boolean; }; }; rateLimiting: { commands: { AMOUNT: number; INTERVAL: number; }; triggers: { AMOUNT: number; INTERVAL: number; }; reactions: { AMOUNT: number; INTERVAL: number; }; buttons: { AMOUNT: number; INTERVAL: number; }; }; logging: { PRETTY: boolean; rateLimit: { MIN_TIMEOUT: number; }; }; modelConstants: { verifyInfiniteFlightUserIdTicket: { STALE_BY_MINUTES: number; }; }; development: { dummyMode: { ENABLED: boolean; WHITE_LIST: string[]; }; CHECK_PERMS: boolean; shardMode: { ENABLED: boolean; VALUE: ShardingManagerMode; }; }; BOT_SITES: BotSite[]; }
kennedy-steve/skylink-if
src/models/config-models.ts
TypeScript
FunctionDeclaration
function _getImageSetProps(props: React.Props<{}>, markdownProps: IPageMarkdownProps): IPageImageSetProps | undefined { let imageSet: IImageProps[] | undefined; if (props && props.children) { // tslint:disable-next-line:no-any React.Children.forEach(props.children, (child: any) => { if (child && child.type === 'li') { const textContent = child.props.children; const { resources } = markdownProps; if (typeof textContent === 'string' && textContent.indexOf('image:') === 0 && resources && resources.images) { const imageProps = resources.images[textContent.substr(6).trim()]; if (imageProps) { imageSet = imageSet || []; imageSet.push(imageProps); } } } }); } if (imageSet) { return { images: imageSet }; } }
CharlesgdHill/office-ui-fabric-react
packages/example-app-base/src/components/templates/PageMarkdown.tsx
TypeScript
ArrowFunction
(child: any) => { if (child && child.type === 'li') { const textContent = child.props.children; const { resources } = markdownProps; if (typeof textContent === 'string' && textContent.indexOf('image:') === 0 && resources && resources.images) { const imageProps = resources.images[textContent.substr(6).trim()]; if (imageProps) { imageSet = imageSet || []; imageSet.push(imageProps); } } } }
CharlesgdHill/office-ui-fabric-react
packages/example-app-base/src/components/templates/PageMarkdown.tsx
TypeScript
ArrowFunction
(markdownProps: IPageMarkdownProps): IMarkdownProps => ({ options: { overrides: { h1: { component: PageHeader }, h2: { component: PageHeader, props: { as: 'h2' } }, h3: { component: PageHeader, props: { as: 'h3' } }, code: { component: PageTag }, p: { component: (props: React.HTMLAttributes<HTMLElement>) => { const { resources } = markdownProps; const textContent = props.children; if (typeof textContent === 'string' && resources) { if (textContent.indexOf('image:') === 0 && resources.images) { const imageProps = resources.images[textContent.substr(6).trim()]; if (imageProps) { return <Image {...imageProps} />; } } } return <PageParagraph {...props} />; } }, a: { component: Link }, ul: { component: (props: React.HTMLAttributes<HTMLElement>) => { let imageSetProps = _getImageSetProps(props, markdownProps); if (imageSetProps) { return <PageImageSet {...imageSetProps} />; } return <ul {...props} />; } }, img: { component: Image }, button: { component: DefaultButton } } } })
CharlesgdHill/office-ui-fabric-react
packages/example-app-base/src/components/templates/PageMarkdown.tsx
TypeScript
ArrowFunction
(props: React.HTMLAttributes<HTMLElement>) => { const { resources } = markdownProps; const textContent = props.children; if (typeof textContent === 'string' && resources) { if (textContent.indexOf('image:') === 0 && resources.images) { const imageProps = resources.images[textContent.substr(6).trim()]; if (imageProps) { return <Image {...imageProps} />; } } } return <PageParagraph {...props} />; }
CharlesgdHill/office-ui-fabric-react
packages/example-app-base/src/components/templates/PageMarkdown.tsx
TypeScript
ArrowFunction
(props: React.HTMLAttributes<HTMLElement>) => { let imageSetProps = _getImageSetProps(props, markdownProps); if (imageSetProps) { return <PageImageSet {...imageSetProps} />; } return <ul {...props} />; }
CharlesgdHill/office-ui-fabric-react
packages/example-app-base/src/components/templates/PageMarkdown.tsx
TypeScript
ArrowFunction
(props: IPageMarkdownProps) => <Markdown {...getMarkdownProps(props)}>{props.children}</Markdown>;
CharlesgdHill/office-ui-fabric-react
packages/example-app-base/src/components/templates/PageMarkdown.tsx
TypeScript
InterfaceDeclaration
export interface IPageMarkdownResources { images?: { [key: string]: IImageProps; }; }
CharlesgdHill/office-ui-fabric-react
packages/example-app-base/src/components/templates/PageMarkdown.tsx
TypeScript
InterfaceDeclaration
export interface IPageMarkdownProps { resources?: IPageMarkdownResources; children: string; }
CharlesgdHill/office-ui-fabric-react
packages/example-app-base/src/components/templates/PageMarkdown.tsx
TypeScript
EnumDeclaration
export enum FeedbackTypeEnum { Bug = "Bug", Improvement = "Improvement", }
Tomashow/car-maintenance
src/app/shared/components/feedback-dialog/feedback-type.enum.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ imports: [NzInputNumberModule, FormsModule, ReactiveFormsModule], declarations: [NzTestInputNumberBasicComponent, NzTestInputNumberFormComponent] }); TestBed.compileComponents(); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(NzTestInputNumberBasicComponent); fixture.detectChanges(); testComponent = fixture.debugElement.componentInstance; inputNumber = fixture.debugElement.query(By.directive(NzInputNumberComponent)); inputElement = inputNumber.nativeElement.querySelector('input'); upArrowEvent = createKeyboardEvent('keydown', UP_ARROW, inputElement, 'ArrowUp'); downArrowEvent = createKeyboardEvent('keydown', DOWN_ARROW, inputElement, 'ArrowDown'); upArrowCtrlEvent = createKeyboardEvent('keydown', UP_ARROW, inputElement, 'ArrowUp', true); downArrowCtrlEvent = createKeyboardEvent('keydown', DOWN_ARROW, inputElement, 'ArrowDown', true); upArrowMetaEvent = createKeyboardEvent('keydown', UP_ARROW, inputElement, 'ArrowUp', false, true); downArrowMetaEvent = createKeyboardEvent('keydown', DOWN_ARROW, inputElement, 'ArrowDown', false, true); upArrowShiftEvent = createKeyboardEvent('keydown', UP_ARROW, inputElement, 'ArrowUp', false, false, true); downArrowShiftEvent = createKeyboardEvent('keydown', DOWN_ARROW, inputElement, 'ArrowDown', false, false, true); upHandler = inputNumber.nativeElement.querySelector('.ant-input-number-handler-up'); downHandler = inputNumber.nativeElement.querySelector('.ant-input-number-handler-down'); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { fixture.detectChanges(); expect(inputNumber.nativeElement.classList).toContain('ant-input-number'); expect(inputElement.getAttribute('placeholder')).toBe('placeholder'); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { fixture.detectChanges(); expect(inputNumber.nativeElement.classList).toContain('ng-untouched'); dispatchFakeEvent(inputElement, 'focus'); fixture.detectChanges(); tick(); fixture.detectChanges(); expect(inputNumber.nativeElement.classList).toContain('ng-untouched'); expect(inputNumber.nativeElement.classList).toContain('ant-input-number-focused'); dispatchFakeEvent(inputElement, 'blur'); fixture.detectChanges(); tick(); fixture.detectChanges(); expect(inputNumber.nativeElement.classList).not.toContain('ant-input-number-focused'); expect(inputNumber.nativeElement.classList).toContain('ng-touched'); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { testComponent.size = 'large'; fixture.detectChanges(); expect(inputNumber.nativeElement.classList).toContain('ant-input-number-lg'); testComponent.size = 'small'; fixture.detectChanges(); expect(inputNumber.nativeElement.classList).toContain('ant-input-number-sm'); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { fixture.detectChanges(); testComponent.autofocus = true; testComponent.nzInputNumberComponent.nzAutoFocus = true; testComponent.nzInputNumberComponent.ngAfterViewInit(); fixture.detectChanges(); expect(inputElement === document.activeElement).toBe(true); expect(inputElement.attributes.getNamedItem('autofocus')!.name).toBe('autofocus'); testComponent.autofocus = false; fixture.detectChanges(); expect(inputElement.attributes.getNamedItem('autofocus')).toBe(null); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { fixture.detectChanges(); testComponent.nzInputNumberComponent.focus(); fixture.detectChanges(); expect(inputElement === document.activeElement).toBe(true); testComponent.nzInputNumberComponent.blur(); fixture.detectChanges(); expect(inputElement === document.activeElement).toBe(false); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { testComponent.value = 5; fixture.detectChanges(); flush(); expect(inputElement.value).toBe('5'); expect(testComponent.modelChange).toHaveBeenCalledTimes(0); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { testComponent.nzInputNumberComponent.onModelChange(''); fixture.detectChanges(); expect(testComponent.value).toBe(''); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { testComponent.nzInputNumberComponent.onModelChange('NaN'); fixture.detectChanges(); expect(testComponent.value).toBe(undefined); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { dispatchFakeEvent(upHandler, 'mousedown'); fixture.detectChanges(); expect(inputElement.value).toBe('1'); expect(testComponent.modelChange).toHaveBeenCalledTimes(1); dispatchFakeEvent(downHandler, 'mousedown'); fixture.detectChanges(); expect(inputElement.value).toBe('0'); expect(testComponent.modelChange).toHaveBeenCalledTimes(2); dispatchFakeEvent(downHandler, 'mousedown'); fixture.detectChanges(); expect(inputElement.value).toBe('-1'); expect(testComponent.modelChange).toHaveBeenCalledTimes(3); dispatchFakeEvent(downHandler, 'mousedown'); fixture.detectChanges(); expect(inputElement.value).toBe('-1'); expect(testComponent.modelChange).toHaveBeenCalledTimes(3); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { testComponent.nzInputNumberComponent.onModelChange('1.'); fixture.detectChanges(); expect(testComponent.value).toBe(undefined); expect(inputElement.value).toBe('1.'); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript
ArrowFunction
() => { testComponent.nzInputNumberComponent.onModelChange('1.'); fixture.detectChanges(); dispatchFakeEvent(upHandler, 'mousedown'); fixture.detectChanges(); expect(testComponent.value).toBe(1); }
Anberm/ng-zorro-antd
components/input-number/input-number.spec.ts
TypeScript