Comparing version
@@ -10,3 +10,3 @@ 'use strict' | ||
hello: 'world', | ||
answer: 42 | ||
answer: 42, | ||
} | ||
@@ -13,0 +13,0 @@ |
{ | ||
"name": "tinysonic", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "a quick syntax for JSON", | ||
"main": "tinysonic.js", | ||
"scripts": { | ||
"test": "standard && tape test.js | tap-spec" | ||
"test": "eslint && node --test test.js" | ||
}, | ||
@@ -30,11 +30,8 @@ "pre-commit": "test", | ||
"devDependencies": { | ||
"@fastify/pre-commit": "^2.1.0", | ||
"benchmark": "^2.1.4", | ||
"eslint": "^7.28.0", | ||
"eslint": "^9.6.0", | ||
"jsonic": "^1.0.1", | ||
"pre-commit": "^1.1.3", | ||
"safe-buffer": "^5.2.1", | ||
"standard": "^16.0.0", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^5.2.2" | ||
"neostandard": "^0.11.0" | ||
} | ||
} |
16
test.js
'use strict' | ||
const Buffer = require('safe-buffer').Buffer | ||
const test = require('tape') | ||
const test = require('node:test') | ||
const { deepEqual } = require('node:assert/strict') | ||
const tinysonic = require('./') | ||
function check (string, object) { | ||
test('check that ' + JSON.stringify(string) + ' is parsed to ' + JSON.stringify(object), function (t) { | ||
t.plan(1) | ||
t.deepEqual(tinysonic(string), object, 'matches') | ||
test('check that ' + JSON.stringify(string) + ' is parsed to ' + JSON.stringify(object), function () { | ||
deepEqual(tinysonic(string), object, 'matches') | ||
}) | ||
@@ -16,6 +14,4 @@ } | ||
function checkStringify (object, string) { | ||
test('check that ' + JSON.stringify(string) + ' is stringified to ' + JSON.stringify(object), function (t) { | ||
t.plan(1) | ||
t.deepEqual(tinysonic.stringify(object), string, 'matches') | ||
test('check that ' + JSON.stringify(string) + ' is stringified to ' + JSON.stringify(object), function () { | ||
deepEqual(tinysonic.stringify(object), string, 'matches') | ||
}) | ||
@@ -22,0 +18,0 @@ } |
@@ -78,11 +78,11 @@ 'use strict' | ||
if (!isNaN(str)) { | ||
const number = parseFloat(str) | ||
if (!isNaN(number)) { | ||
if (!Number.isNaN(Number(str))) { | ||
const number = Number.parseFloat(str) | ||
if (!Number.isNaN(number)) { | ||
return number | ||
} | ||
return str | ||
} else { | ||
return str | ||
} | ||
return str | ||
} | ||
@@ -89,0 +89,0 @@ |
Sorry, the diff of this file is not supported yet
5
-37.5%10
11.11%10477
-0.27%230
-0.43%