Comparing version 0.0.50 to 0.0.51
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.differ = exports.Transaction = exports.DB = exports.Table = exports.Attribute = exports.Type = exports.EntryBase = exports.transaction = exports.size = exports.loaded = exports.base = exports.actions = void 0; | ||
exports.deepDiff = exports.deepCopy = exports.Transaction = exports.DB = exports.Table = exports.Attribute = exports.Type = exports.EntryBase = exports.transaction = exports.size = exports.loaded = exports.base = exports.actions = void 0; | ||
exports.actions = Symbol("actions"); | ||
@@ -140,3 +140,13 @@ exports.base = Symbol("base"); | ||
const sortedEntries = (obj) => Object.entries(obj).sort((entryA, entryB) => (entryA[0] > entryB[0] ? -1 : 1)); | ||
function differ(a, b) { | ||
function deepCopy(o) { | ||
if (!o || typeof o !== "object") | ||
return o; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const [ret, entries] = o instanceof Array ? [new Array(o.length), o.entries()] : [{}, Object.entries(o)]; | ||
for (const [k, v] of entries) | ||
ret[k] = deepCopy(v); | ||
return ret; | ||
} | ||
exports.deepCopy = deepCopy; | ||
function deepDiff(a, b) { | ||
if (typeof a !== "object") | ||
@@ -154,3 +164,3 @@ return a !== b; | ||
for (const [i, value] of a.entries()) | ||
if (differ(value, b[i])) | ||
if (deepDiff(value, b[i])) | ||
return true; | ||
@@ -164,6 +174,6 @@ return false; | ||
for (const [i, [key, value]] of entriesA.entries()) | ||
if (key !== entriesB[i][0] || differ(value, entriesB[i][1])) | ||
if (key !== entriesB[i][0] || deepDiff(value, entriesB[i][1])) | ||
return true; | ||
return false; | ||
} | ||
exports.differ = differ; | ||
exports.deepDiff = deepDiff; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Sedentary = exports.Type = exports.transaction = exports.Transaction = exports.Table = exports.size = exports.loaded = exports.EntryBase = exports.differ = exports.DB = exports.base = exports.Attribute = void 0; | ||
exports.Sedentary = exports.Type = exports.transaction = exports.Transaction = exports.Table = exports.size = exports.loaded = exports.EntryBase = exports.deepDiff = exports.deepCopy = exports.DB = exports.base = exports.Attribute = void 0; | ||
const db_1 = require("./db"); | ||
@@ -9,3 +9,4 @@ var db_2 = require("./db"); | ||
Object.defineProperty(exports, "DB", { enumerable: true, get: function () { return db_2.DB; } }); | ||
Object.defineProperty(exports, "differ", { enumerable: true, get: function () { return db_2.differ; } }); | ||
Object.defineProperty(exports, "deepCopy", { enumerable: true, get: function () { return db_2.deepCopy; } }); | ||
Object.defineProperty(exports, "deepDiff", { enumerable: true, get: function () { return db_2.deepDiff; } }); | ||
Object.defineProperty(exports, "EntryBase", { enumerable: true, get: function () { return db_2.EntryBase; } }); | ||
@@ -12,0 +13,0 @@ Object.defineProperty(exports, "loaded", { enumerable: true, get: function () { return db_2.loaded; } }); |
@@ -135,3 +135,12 @@ export const actions = Symbol("actions"); | ||
const sortedEntries = (obj) => Object.entries(obj).sort((entryA, entryB) => (entryA[0] > entryB[0] ? -1 : 1)); | ||
export function differ(a, b) { | ||
export function deepCopy(o) { | ||
if (!o || typeof o !== "object") | ||
return o; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const [ret, entries] = o instanceof Array ? [new Array(o.length), o.entries()] : [{}, Object.entries(o)]; | ||
for (const [k, v] of entries) | ||
ret[k] = deepCopy(v); | ||
return ret; | ||
} | ||
export function deepDiff(a, b) { | ||
if (typeof a !== "object") | ||
@@ -149,3 +158,3 @@ return a !== b; | ||
for (const [i, value] of a.entries()) | ||
if (differ(value, b[i])) | ||
if (deepDiff(value, b[i])) | ||
return true; | ||
@@ -159,5 +168,5 @@ return false; | ||
for (const [i, [key, value]] of entriesA.entries()) | ||
if (key !== entriesB[i][0] || differ(value, entriesB[i][1])) | ||
if (key !== entriesB[i][0] || deepDiff(value, entriesB[i][1])) | ||
return true; | ||
return false; | ||
} |
import { actions, Attribute, base, EntryBase, loaded, size, Table, Transaction, transaction, Type } from "./db"; | ||
export { Attribute, base, DB, differ, EntryBase, loaded, size, Table, Transaction, transaction, Type } from "./db"; | ||
export { Attribute, base, DB, deepCopy, deepDiff, EntryBase, loaded, size, Table, Transaction, transaction, Type } from "./db"; | ||
const attributes = Symbol("attributes"); | ||
@@ -4,0 +4,0 @@ const methods = Symbol("methods"); |
@@ -123,3 +123,4 @@ export declare const actions: unique symbol; | ||
} | ||
export declare function differ(a: unknown, b: unknown): boolean; | ||
export declare function deepCopy(o: unknown): any; | ||
export declare function deepDiff(a: unknown, b: unknown): boolean; | ||
export {}; |
import { Attribute, DB, EntryBase, ForeignKeyOptions, Transaction, Type } from "./db"; | ||
export { Action, Attribute, base, DB, differ, EntryBase, ForeignKeyActions, ForeignKeyOptions, Index, loaded, size, Table, Transaction, transaction, Type } from "./db"; | ||
export { Action, Attribute, base, DB, deepCopy, deepDiff, EntryBase, ForeignKeyActions, ForeignKeyOptions, Index, loaded, size, Table, Transaction, transaction, Type } from "./db"; | ||
export declare type TypeDefinition<T, E> = (() => Type<T, E>) | Type<T, E>; | ||
@@ -4,0 +4,0 @@ export interface AttributeOptions<T, E> { |
@@ -61,3 +61,3 @@ { | ||
"types": "./dist/types/index.d.ts", | ||
"version": "0.0.50" | ||
"version": "0.0.51" | ||
} |
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
92463
1684