@brillout/json-serializer
Advanced tools
Comparing version 0.5.9 to 0.5.10
export { parse }; | ||
export { parseTransform }; | ||
declare function parse(str: string): unknown; | ||
declare function parseTransform(value: unknown): unknown; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parse = void 0; | ||
exports.parseTransform = exports.parse = void 0; | ||
const types_1 = require("./types"); | ||
@@ -8,6 +8,6 @@ function parse(str) { | ||
const value = JSON.parse(str); | ||
return modifier(value); | ||
return parseTransform(value); | ||
} | ||
exports.parse = parse; | ||
function modifier(value) { | ||
function parseTransform(value) { | ||
if (typeof value === 'string') { | ||
@@ -22,3 +22,3 @@ return reviver(value); | ||
; | ||
value[key] = modifier(val); | ||
value[key] = parseTransform(val); | ||
}); | ||
@@ -28,2 +28,3 @@ } | ||
} | ||
exports.parseTransform = parseTransform; | ||
function reviver(value) { | ||
@@ -30,0 +31,0 @@ for (const { match, deserialize } of types_1.types) { |
export { parse }; | ||
export { parseTransform }; | ||
declare function parse(str: string): unknown; | ||
declare function parseTransform(value: unknown): unknown; |
export { parse }; | ||
export { parseTransform }; | ||
import { types } from './types'; | ||
@@ -6,5 +7,5 @@ function parse(str) { | ||
const value = JSON.parse(str); | ||
return modifier(value); | ||
return parseTransform(value); | ||
} | ||
function modifier(value) { | ||
function parseTransform(value) { | ||
if (typeof value === 'string') { | ||
@@ -19,3 +20,3 @@ return reviver(value); | ||
; | ||
value[key] = modifier(val); | ||
value[key] = parseTransform(val); | ||
}); | ||
@@ -22,0 +23,0 @@ } |
{ | ||
"name": "@brillout/json-serializer", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"description": "Same as JSON but with added support for `Date`, `undefined`, `Map`, `Set`, and more.", | ||
@@ -5,0 +5,0 @@ "main": "./index.mjs", |
@@ -11,1 +11,2 @@ // Some tools don't support `package.json#exports`, such as: | ||
exports.parse = require('./dist/cjs/parse.js').parse; | ||
exports.parseTransform = require('./dist/cjs/parse.js').parseTransform; |
33118
601