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.2.10 to 2.3.0

.github/dependabot.yml

30

index.js

@@ -105,4 +105,2 @@ 'use strict'

var hasSchemaSomeIf = hasIf(schema)
var main

@@ -145,3 +143,3 @@

var dependenciesName = []
if (hasOf(schema) || hasSchemaSomeIf) {
if (dependsOnAjv(schema)) {
dependencies.push(new Ajv(options.ajv))

@@ -217,20 +215,5 @@ dependenciesName.push('ajv')

function hasOf (schema) {
if (!schema) { return false }
if ('anyOf' in schema || 'oneOf' in schema) { return true }
var objectKeys = Object.keys(schema)
for (var i = 0; i < objectKeys.length; i++) {
var value = schema[objectKeys[i]]
if (typeof value === 'object') {
if (hasOf(value)) { return true }
}
}
return false
}
function hasIf (schema) {
function dependsOnAjv (schema) {
const str = JSON.stringify(schema)
return /"if":{/.test(str) && /"then":{/.test(str)
return (/"if":{.*"then":{|"(anyOf|oneOf)":\[|"const":/.test(str))
}

@@ -1193,2 +1176,9 @@

`
} else if ('const' in schema) {
code += `
if(ajv.validate(${require('util').inspect(schema, { depth: null })}, obj${accessor}))
json += '${JSON.stringify(schema.const)}'
else
throw new Error(\`Item $\{JSON.stringify(obj${accessor})} does not match schema definition.\`)
`
} else {

@@ -1195,0 +1185,0 @@ throw new Error(`${schema.type} unsupported`)

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

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

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