Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 2.5.1 to 2.5.2

8

index.js

@@ -960,3 +960,3 @@ 'use strict'

function buildArray (location, code, name, key = null) {
const schema = location.schema
let schema = location.schema
code += `

@@ -983,2 +983,6 @@ function ${name} (obj) {

if (schema.items.$ref) {
if (!schema[fjsCloned]) {
schema = clone(location.schema)
schema[fjsCloned] = true
}
location = refFinder(schema.items.$ref, location)

@@ -1220,3 +1224,3 @@ schema.items = location.schema

code += `
if(ajv.validate(${require('util').inspect(schema, { depth: null, showHidden: false })}, obj${accessor}))
if(ajv.validate(${JSON.stringify(schema)}, obj${accessor}))
json += '${JSON.stringify(schema.const)}'

@@ -1223,0 +1227,0 @@ else

{
"name": "fast-json-stringify",
"version": "2.5.1",
"version": "2.5.2",
"description": "Stringify your JSON at max speed",

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

@@ -124,1 +124,35 @@ 'use strict'

})
test('must not mutate items $ref', t => {
t.plan(2)
const referenceSchema = {
$id: 'ShowSchema',
$schema: 'http://json-schema.org/draft-07/schema#',
type: 'object',
properties: {
name: {
type: 'string'
}
}
}
const schema = {
$id: 'ListSchema',
$schema: 'http://json-schema.org/draft-07/schema#',
type: 'array',
items: {
$ref: 'ShowSchema#'
}
}
const clonedSchema = clone(schema)
const stringify = build(schema, {
schema: {
[referenceSchema.$id]: referenceSchema
}
})
const value = stringify([{ name: 'foo' }])
t.is(value, '[{"name":"foo"}]')
t.deepEqual(schema, clonedSchema)
})
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