Skip to content

Commit

Permalink
Linting rule fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomshaw committed Nov 18, 2023
1 parent d56cfea commit 8da8b25
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"@typescript-eslint/no-floating-promises": 0,
"@typescript-eslint/no-unnecessary-type-assertion": 0,
"@typescript-eslint/unbound-method": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/require-await": 0
"@typescript-eslint/no-inferrable-types": 0
}
},
{
Expand Down
45 changes: 26 additions & 19 deletions src/app/shared/components/glyph-list/glyph-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,33 @@ export class GlyphListComponent implements OnInit, OnChanges {
this.paginate().then(() => this.initGlyphList(0));
}

async paginate() {
const numGlyphs: number = this.fontObject.numGlyphs;
const numPages: number = Math.ceil(numGlyphs / this.cellCount);

const data = [];
for (let i = 0; i < numPages; i++) {
const lastIndex = Math.min(numGlyphs - 1, (i + 1) * this.cellCount - 1);
const text = i * this.cellCount + '-' + lastIndex;
data.push({
key: i,
value: text
});
}

this.paginatorOptions = data;
this.numGlyphs = numGlyphs - 1;
this.numPages = numPages;

return data;
paginate() {
return new Promise((resolve, reject) => {
try {
const numGlyphs: number = this.fontObject.numGlyphs;
const numPages: number = Math.ceil(numGlyphs / this.cellCount);

const data = [];
for (let i = 0; i < numPages; i++) {
const lastIndex = Math.min(numGlyphs - 1, (i + 1) * this.cellCount - 1);
const text = i * this.cellCount + '-' + lastIndex;
data.push({
key: i,
value: text
});
}

this.paginatorOptions = data;
this.numGlyphs = numGlyphs - 1;
this.numPages = numPages;

resolve(data);
} catch (error) {
reject(error);
}
});
}


initGlyphList(page: number = 0) {
const firstGlyph = page * this.cellCount;
Expand Down

0 comments on commit 8da8b25

Please sign in to comment.