@vitest/utils
Advanced tools
Comparing version 0.31.1 to 0.31.2
@@ -106,2 +106,4 @@ import { b as getColors } from './chunk-colors.js'; | ||
}); | ||
if (counts["+"] === 0 && counts["-"] === 0) | ||
return ""; | ||
let legend = ""; | ||
@@ -108,0 +110,0 @@ if (showLegend) { |
import { Nullable, Arrayable } from './types.js'; | ||
interface CloneOptions { | ||
forceWritable?: boolean; | ||
} | ||
declare function notNullish<T>(v: T | null | undefined): v is NonNullable<T>; | ||
@@ -12,4 +15,4 @@ declare function assertTypes(value: unknown, name: string, types: string[]): void; | ||
declare function getOwnProperties(obj: any): (string | symbol)[]; | ||
declare function deepClone<T>(val: T): T; | ||
declare function clone<T>(val: T, seen: WeakMap<any, any>): T; | ||
declare function deepClone<T>(val: T, options?: CloneOptions): T; | ||
declare function clone<T>(val: T, seen: WeakMap<any, any>, options?: CloneOptions): T; | ||
declare function noop(): void; | ||
@@ -16,0 +19,0 @@ declare function objectAttr(source: any, path: string, defaultValue?: undefined): any; |
@@ -52,7 +52,8 @@ function notNullish(v) { | ||
} | ||
function deepClone(val) { | ||
const defaultCloneOptions = { forceWritable: false }; | ||
function deepClone(val, options = defaultCloneOptions) { | ||
const seen = /* @__PURE__ */ new WeakMap(); | ||
return clone(val, seen); | ||
return clone(val, seen, options); | ||
} | ||
function clone(val, seen) { | ||
function clone(val, seen, options = defaultCloneOptions) { | ||
let k, out; | ||
@@ -87,2 +88,3 @@ if (seen.has(val)) | ||
...descriptor, | ||
writable: options.forceWritable ? true : descriptor.writable, | ||
value: cloned | ||
@@ -89,0 +91,0 @@ }); |
{ | ||
"name": "@vitest/utils", | ||
"type": "module", | ||
"version": "0.31.1", | ||
"version": "0.31.2", | ||
"description": "Shared Vitest utility functions", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42335
1190