Socket
Socket
Sign inDemoInstall

fast-json-stringify

Package Overview
Dependencies
Maintainers
2
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-json-stringify - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

16

index.js

@@ -673,8 +673,18 @@ 'use strict'

var nestedResult = nested(laterCode, name, key, tempSchema, externalSchema, fullSchema, subKey)
code += `
${index === 0 ? 'if' : 'else if'}(ajv.validate(${require('util').inspect(tempSchema, {depth: null})}, obj${accessor}))
if (type === 'string') {
code += `
${index === 0 ? 'if' : 'else if'}(obj${accessor} instanceof Date || ajv.validate(${require('util').inspect(tempSchema, {depth: null})}, obj${accessor}))
${nestedResult.code}
`
} else {
code += `
${index === 0 ? 'if' : 'else if'}(ajv.validate(${require('util').inspect(tempSchema, {depth: null})}, obj${accessor}))
${nestedResult.code}
`
`
}
laterCode = nestedResult.laterCode
})
code += `
else json+= null
`
} else {

@@ -681,0 +691,0 @@ throw new Error(`${type} unsupported`)

2

package.json
{
"name": "fast-json-stringify",
"version": "1.2.1",
"version": "1.3.0",
"description": "Stringify your JSON at max speed",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -185,1 +185,20 @@ 'use strict'

})
test('string type array can handle dates', (t) => {
t.plan(1)
const schema = {
type: 'object',
properties: {
date: { type: ['string'] }
}
}
const stringify = build(schema)
try {
const value = stringify({
date: new Date('2018-04-20T07:52:31.017Z')
})
t.is(value, '{"date":"2018-04-20T07:52:31.017Z"}')
} catch (e) {
t.fail()
}
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc