Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use object destructuring #103

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function filter (obj, { protoAction = 'error', constructorAction = 'error', safe
}

function parse (text, reviver, options) {
const stackTraceLimit = Error.stackTraceLimit
const { stackTraceLimit } = Error
Comment on lines 100 to +101
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this I want to see benchmarks proving we dont have perf degredations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Uzlopak

Before:

image

After:

image

Error.stackTraceLimit = 0
try {
return _parse(text, reviver, options)
Expand All @@ -108,7 +108,7 @@ function parse (text, reviver, options) {
}

function safeParse (text, reviver) {
const stackTraceLimit = Error.stackTraceLimit
const { stackTraceLimit } = Error
Error.stackTraceLimit = 0
try {
return _parse(text, reviver, { safe: true })
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const test = require('tape').test
const { test } = require('tape')
const j = require('..')

test('parse', t => {
Expand Down
Loading