@augment-vir/common
Advanced tools
Comparing version 9.3.2 to 10.0.0
@@ -0,1 +1,2 @@ | ||
import { Jsonifiable } from 'type-fest'; | ||
export type PartialWithNullable<T extends object> = { | ||
@@ -5,3 +6,3 @@ [Prop in keyof T]?: T[Prop] | null | undefined; | ||
export declare function isObject(input: any): input is NonNullable<object>; | ||
export declare function areJsonEqual(a: object, b: object): boolean; | ||
export declare function areJsonEqual(a: Jsonifiable, b: Jsonifiable): boolean; | ||
/** The input here must be serializable otherwise JSON parsing errors will be thrown */ | ||
@@ -8,0 +9,0 @@ export declare function copyThroughJson<T>(input: T): T; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.copyThroughJson = exports.areJsonEqual = exports.isObject = void 0; | ||
const error_1 = require("../error"); | ||
const object_entries_1 = require("./object-entries"); | ||
@@ -11,8 +12,16 @@ function isObject(input) { | ||
try { | ||
const sortedAEntries = (0, object_entries_1.getEntriesSortedByKey)(a); | ||
const sortedBEntries = (0, object_entries_1.getEntriesSortedByKey)(b); | ||
return JSON.stringify(sortedAEntries) === JSON.stringify(sortedBEntries); | ||
if (a === b) { | ||
return true; | ||
} | ||
if (isObject(a) && isObject(b)) { | ||
const sortedAEntries = (0, object_entries_1.getEntriesSortedByKey)(a); | ||
const sortedBEntries = (0, object_entries_1.getEntriesSortedByKey)(b); | ||
return JSON.stringify(sortedAEntries) === JSON.stringify(sortedBEntries); | ||
} | ||
else { | ||
return JSON.stringify(a) === JSON.stringify(b); | ||
} | ||
} | ||
catch (error) { | ||
console.error(`Failed to compare objects using JSON.stringify`); | ||
console.error(`Failed to compare objects using JSON.stringify: ${(0, error_1.extractErrorMessage)(error)}`); | ||
throw error; | ||
@@ -19,0 +28,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { Jsonifiable } from 'type-fest'; | ||
export type PartialWithNullable<T extends object> = { | ||
@@ -5,3 +6,3 @@ [Prop in keyof T]?: T[Prop] | null | undefined; | ||
export declare function isObject(input: any): input is NonNullable<object>; | ||
export declare function areJsonEqual(a: object, b: object): boolean; | ||
export declare function areJsonEqual(a: Jsonifiable, b: Jsonifiable): boolean; | ||
/** The input here must be serializable otherwise JSON parsing errors will be thrown */ | ||
@@ -8,0 +9,0 @@ export declare function copyThroughJson<T>(input: T): T; |
@@ -0,1 +1,2 @@ | ||
import { extractErrorMessage } from '../error'; | ||
import { getEntriesSortedByKey } from './object-entries'; | ||
@@ -7,8 +8,16 @@ export function isObject(input) { | ||
try { | ||
const sortedAEntries = getEntriesSortedByKey(a); | ||
const sortedBEntries = getEntriesSortedByKey(b); | ||
return JSON.stringify(sortedAEntries) === JSON.stringify(sortedBEntries); | ||
if (a === b) { | ||
return true; | ||
} | ||
if (isObject(a) && isObject(b)) { | ||
const sortedAEntries = getEntriesSortedByKey(a); | ||
const sortedBEntries = getEntriesSortedByKey(b); | ||
return JSON.stringify(sortedAEntries) === JSON.stringify(sortedBEntries); | ||
} | ||
else { | ||
return JSON.stringify(a) === JSON.stringify(b); | ||
} | ||
} | ||
catch (error) { | ||
console.error(`Failed to compare objects using JSON.stringify`); | ||
console.error(`Failed to compare objects using JSON.stringify: ${extractErrorMessage(error)}`); | ||
throw error; | ||
@@ -15,0 +24,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { Jsonifiable } from 'type-fest'; | ||
export type PartialWithNullable<T extends object> = { | ||
@@ -5,3 +6,3 @@ [Prop in keyof T]?: T[Prop] | null | undefined; | ||
export declare function isObject(input: any): input is NonNullable<object>; | ||
export declare function areJsonEqual(a: object, b: object): boolean; | ||
export declare function areJsonEqual(a: Jsonifiable, b: Jsonifiable): boolean; | ||
/** The input here must be serializable otherwise JSON parsing errors will be thrown */ | ||
@@ -8,0 +9,0 @@ export declare function copyThroughJson<T>(input: T): T; |
{ | ||
"name": "@augment-vir/common", | ||
"version": "9.3.2", | ||
"version": "10.0.0", | ||
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common", | ||
@@ -5,0 +5,0 @@ "bugs": { |
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
222860
4355