Skip to content

Commit 8800bcb

Browse files
committed
Improve isDouble to look for big integers.
1 parent a73ae6c commit 8800bcb

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- JSON literal value handling issues (`null` and `[]`).
66
- Always pass typeScopedContext to _expandObject.
77
- Allow a keyword to exist when expanding in _expandObject when the key is `@included` or `@type`.
8+
- Improve isDouble to look for big integers.
89

910
## 2.0.2 - 2020-01-17
1011

lib/types.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ api.isBoolean = v => (typeof v === 'boolean' ||
3232
*
3333
* @return true if the value is a double, false if not.
3434
*/
35-
api.isDouble = v => api.isNumber(v) && String(v).indexOf('.') !== -1;
35+
api.isDouble = v => api.isNumber(v) &&
36+
(String(v).indexOf('.') !== -1 || Math.abs(v) >= 1e21);
3637

3738
/**
3839
* Returns true if the given value is an empty Object.

tests/test-common.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,12 @@ const TEST_TYPES = {
334334
/html-manifest.jsonld#tr020$/,
335335
/html-manifest.jsonld#tr021$/,
336336
/html-manifest.jsonld#tr022$/,
337-
// number fixes
338-
/toRdf-manifest.jsonld#trt01$/,
339337
// IRI resolution
340338
/toRdf-manifest.jsonld#t0130$/,
341339
/toRdf-manifest.jsonld#t0131$/,
342340
/toRdf-manifest.jsonld#t0132$/,
343-
// @vocab mapping
344-
/toRdf-manifest.jsonld#te075$/,
345341
// Invalid Statement
342+
/toRdf-manifest.jsonld#te075$/,
346343
/toRdf-manifest.jsonld#te111$/,
347344
/toRdf-manifest.jsonld#te112$/,
348345
// @import

0 commit comments

Comments
 (0)