Files
klz-cables.com/.pnpm-store/v10/files/9f/51461275de219c5e895b2d99ba04012354ff8c3efa0c4f1b76fe3963ce9d9db2bbd0ea69262dd32097900800b5d44bc973ae21c072eff65a704c14d772083f-exec
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

50 lines
1.2 KiB
Plaintext
Executable File

'use strict'
const Benchmark = require('benchmark')
const sjson = require('..')
const internals = {
text: '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } }',
invalid: '{ "a": 5, "b": 6, "__proto__": { "x": 7 }, "c": { "d": 0, "e": "text", "__proto__": { "y": 8 }, "f": { "g": 2 } } } }'
}
const suite = new Benchmark.Suite()
suite
.add('JSON.parse valid', () => {
JSON.parse(internals.text)
})
.add('JSON.parse error', () => {
try {
JSON.parse(internals.invalid)
} catch { }
})
.add('secure-json-parse parse', () => {
try {
sjson.parse(internals.invalid)
} catch { }
})
.add('secure-json-parse safeParse', () => {
sjson.safeParse(internals.invalid)
})
.add('reviver', () => {
try {
JSON.parse(internals.invalid, internals.reviver)
} catch { }
})
.on('cycle', (event) => {
console.log(String(event.target))
})
.on('complete', function () {
console.log('Fastest is ' + this.filter('fastest').map('name'))
})
.run({ async: true })
internals.reviver = function (key, value) {
if (key === '__proto__') {
throw new Error('kaboom')
}
return value
}