mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Move the isSpace
utility function from core/parser.js to shared/util.js
Currently the `isSpace` utility function is a member of `Lexer`, which seems suboptimal, given that it's placed in `core/parser.js`. In practice, this means that in a number of `core/*.js` files we thus have an *otherwise* completely unnecessary dependency on `core/parser.js` for a one-line function. Instead, this patch moves `isSpace` into `shared/util.js` which seems more appropriate for this kind of utility function. Not to mention that since all the affected `core/*.js` files already depends on `shared/util.js`, this doesn't incur any more file dependencies.
This commit is contained in:
parent
bd47440e79
commit
a36a946976
7 changed files with 29 additions and 34 deletions
|
@ -1092,6 +1092,11 @@ function isArrayBuffer(v) {
|
|||
return typeof v === 'object' && v !== null && v.byteLength !== undefined;
|
||||
}
|
||||
|
||||
// Checks if ch is one of the following characters: SPACE, TAB, CR or LF.
|
||||
function isSpace(ch) {
|
||||
return (ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A);
|
||||
}
|
||||
|
||||
/**
|
||||
* Promise Capability object.
|
||||
*
|
||||
|
@ -2345,6 +2350,7 @@ exports.isEmptyObj = isEmptyObj;
|
|||
exports.isInt = isInt;
|
||||
exports.isNum = isNum;
|
||||
exports.isString = isString;
|
||||
exports.isSpace = isSpace;
|
||||
exports.isSameOrigin = isSameOrigin;
|
||||
exports.isValidUrl = isValidUrl;
|
||||
exports.isLittleEndian = isLittleEndian;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue