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 0.10.2 to 0.10.3

32

index.js

@@ -18,2 +18,3 @@ 'use strict'

${$asString.toString()}
${$asStringSmall.toString()}
${$asNumber.toString()}

@@ -87,5 +88,34 @@ ${$asNull.toString()}

return JSON.stringify(str)
if (str.length < 42) {
return $asStringSmall(str)
} else {
return JSON.stringify(str)
}
}
// magically escape strings for json
// relying on their charCodeAt
// everything below 32 needs JSON.stringify()
// 34 and 92 happens all the time, so we
// have a fast case for them
function $asStringSmall (str) {
var result = ''
var last = 0
var l = str.length
var point = 255
for (var i = 0; i < l && point >= 32; i++) {
point = str.charCodeAt(i)
if (point === 34 || point === 92) {
result += str.slice(last, i) + '\\' + str[i]
last = i + 1
}
}
if (last === 0) {
result = str
} else {
result += str.slice(last)
}
return point < 32 ? JSON.stringify(str) : '"' + result + '"'
}
function addPatternProperties (schema, externalSchema) {

@@ -92,0 +122,0 @@ var pp = schema.patternProperties

2

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

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

@@ -1,2 +0,2 @@

# fast-json-stringify&nbsp;&nbsp;[![Build Status](https://travis-ci.org/mcollina/fast-json-stringify.svg)](https://travis-ci.org/mcollina/fast-json-stringify)
# fast-json-stringify&nbsp;&nbsp;[![Build Status](https://travis-ci.org/fastify/fast-json-stringify.svg?branch=master)](https://travis-ci.org/fastify/fast-json-stringify)

@@ -3,0 +3,0 @@ __fast-json-stringify__ is x1-4 times faster than `JSON.stringify()`.

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