mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Rename the isSpace
helper function to isWhiteSpace
Trying to enable the ESLint rule `no-shadow`, against the `master` branch, would result in a fair number of errors in the `Glyph` class in `src/core/fonts.js`. Since the glyphs are exposed through the API, we can't very well change the `isSpace` property on `Glyph` instances. Thus the best approach seems, at least to me, to simply rename the `isSpace` helper function to `isWhiteSpace` which shouldn't cause any issues given that it's only used in the `src/core/` folder.
This commit is contained in:
parent
e4758beaaa
commit
c5f67300e9
8 changed files with 32 additions and 28 deletions
|
@ -16,7 +16,7 @@
|
|||
import { Dict, Ref } from "../../src/core/primitives.js";
|
||||
import {
|
||||
getInheritableProperty,
|
||||
isSpace,
|
||||
isWhiteSpace,
|
||||
log2,
|
||||
toRomanNumerals,
|
||||
} from "../../src/core/core_utils.js";
|
||||
|
@ -197,18 +197,18 @@ describe("core_utils", function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe("isSpace", function() {
|
||||
describe("isWhiteSpace", function() {
|
||||
it("handles space characters", function() {
|
||||
expect(isSpace(0x20)).toEqual(true);
|
||||
expect(isSpace(0x09)).toEqual(true);
|
||||
expect(isSpace(0x0d)).toEqual(true);
|
||||
expect(isSpace(0x0a)).toEqual(true);
|
||||
expect(isWhiteSpace(0x20)).toEqual(true);
|
||||
expect(isWhiteSpace(0x09)).toEqual(true);
|
||||
expect(isWhiteSpace(0x0d)).toEqual(true);
|
||||
expect(isWhiteSpace(0x0a)).toEqual(true);
|
||||
});
|
||||
|
||||
it("handles non-space characters", function() {
|
||||
expect(isSpace(0x0b)).toEqual(false);
|
||||
expect(isSpace(null)).toEqual(false);
|
||||
expect(isSpace(undefined)).toEqual(false);
|
||||
expect(isWhiteSpace(0x0b)).toEqual(false);
|
||||
expect(isWhiteSpace(null)).toEqual(false);
|
||||
expect(isWhiteSpace(undefined)).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue