Socket
Socket
Sign inDemoInstall

@poppinss/utils

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@poppinss/utils - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

2

build/src/lodash/index.d.ts

@@ -7,3 +7,3 @@ export declare const pick: (source: any, ...keys: (string | string[])[]) => any;

export declare const unset: (source: any, key: string | string[]) => boolean;
export declare const mergeWith: (source: any) => any;
export declare const mergeWith: (source: any, ...otherArgs: any[]) => any;
export declare const merge: (source: any, ...rest: any[]) => any;

@@ -10,0 +10,0 @@ export declare const size: (source: any) => number;

@@ -0,4 +1,6 @@

declare type ReplacerFn = (this: any, key: string, value: any) => any;
/**
* Safely stringifies a Javascript native value
*/
export declare function safeStringify(value: any): string;
export declare function safeStringify(value: any, replacer?: ReplacerFn, space?: string | number): string;
export {};

@@ -17,9 +17,15 @@ "use strict";

/**
* Replacer to remove Circular values all together
* Replacer to handle bigints and remove Circular values all together
*/
function replacer(_, value) {
if (value === '[Circular]') {
return;
}
return value;
function jsonStringifyReplacer(replacer, removeCircular) {
return function (key, value) {
if (removeCircular && value === '[Circular]') {
return;
}
const val = replacer ? replacer.call(this, key, value) : value;
if (typeof val === 'bigint') {
return val.toString();
}
return val;
};
}

@@ -29,10 +35,10 @@ /**

*/
function safeStringify(value) {
function safeStringify(value, replacer, space) {
try {
return JSON.stringify(value);
return JSON.stringify(value, jsonStringifyReplacer(replacer, false), space);
}
catch {
return fast_safe_stringify_1.default(value, replacer);
return fast_safe_stringify_1.default(value, jsonStringifyReplacer(replacer, true), space);
}
}
exports.safeStringify = safeStringify;
{
"name": "@poppinss/utils",
"version": "3.0.1",
"version": "3.0.2",
"description": "Handy utilities for repetitive work",

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

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