1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Remove the isString helper function

The call-sites are replaced by direct `typeof`-checks instead, which removes unnecessary function calls. Note that in the `src/`-folder we already had more `typeof`-cases than `isString`-calls.
This commit is contained in:
Jonas Jenwald 2022-02-23 17:02:19 +01:00
parent 6bd4e0f5af
commit 99cd24ce3e
9 changed files with 47 additions and 75 deletions

View file

@ -22,7 +22,6 @@ import {
isArrayBuffer,
isAscii,
isSameOrigin,
isString,
string32,
stringToBytes,
stringToPDFString,
@ -73,20 +72,6 @@ describe("util", function () {
});
});
describe("isString", function () {
it("handles string values", function () {
expect(isString("foo")).toEqual(true);
expect(isString("")).toEqual(true);
});
it("handles non-string values", function () {
expect(isString(true)).toEqual(false);
expect(isString(1)).toEqual(false);
expect(isString(null)).toEqual(false);
expect(isString(undefined)).toEqual(false);
});
});
describe("string32", function () {
it("converts unsigned 32-bit integers to strings", function () {
expect(string32(0x74727565)).toEqual("true");