Skip to content

Commit 13965c1

Browse files
gkelloggdavidlehn
authored andcommitted
Improve isDouble to look for big integers.
1 parent d83cded commit 13965c1

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
@@ -337,15 +337,12 @@ const TEST_TYPES = {
337337
/html-manifest.jsonld#tr020$/,
338338
/html-manifest.jsonld#tr021$/,
339339
/html-manifest.jsonld#tr022$/,
340-
// number fixes
341-
/toRdf-manifest.jsonld#trt01$/,
342340
// IRI resolution
343341
/toRdf-manifest.jsonld#t0130$/,
344342
/toRdf-manifest.jsonld#t0131$/,
345343
/toRdf-manifest.jsonld#t0132$/,
346-
// @vocab mapping
347-
/toRdf-manifest.jsonld#te075$/,
348344
// Invalid Statement
345+
/toRdf-manifest.jsonld#te075$/,
349346
/toRdf-manifest.jsonld#te111$/,
350347
/toRdf-manifest.jsonld#te112$/,
351348
// @import

0 commit comments

Comments
 (0)