knex-utils
Advanced tools
Comparing version 5.3.2 to 5.4.0
export { checkHeartbeat, HEARTBEAT_QUERIES } from './lib/heartbeatUtils'; | ||
export { copyWithoutUndefined, pick, isEmptyObject, groupBy } from './lib/objectUtils'; | ||
export { copyWithoutUndefined, pick, pickWithoutUndefined, isEmptyObject, groupBy, } from './lib/objectUtils'; | ||
export { chunk } from './lib/chunkUtils'; | ||
export { updateJoinTable, calculateEntityListDiff } from './lib/diffUtils'; | ||
export type { UpdateJoinTableParams, EntityListDiff } from './lib/diffUtils'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.calculateEntityListDiff = exports.updateJoinTable = exports.chunk = exports.groupBy = exports.isEmptyObject = exports.pick = exports.copyWithoutUndefined = exports.HEARTBEAT_QUERIES = exports.checkHeartbeat = void 0; | ||
exports.calculateEntityListDiff = exports.updateJoinTable = exports.chunk = exports.groupBy = exports.isEmptyObject = exports.pickWithoutUndefined = exports.pick = exports.copyWithoutUndefined = exports.HEARTBEAT_QUERIES = exports.checkHeartbeat = void 0; | ||
var heartbeatUtils_1 = require("./lib/heartbeatUtils"); | ||
@@ -10,2 +10,3 @@ Object.defineProperty(exports, "checkHeartbeat", { enumerable: true, get: function () { return heartbeatUtils_1.checkHeartbeat; } }); | ||
Object.defineProperty(exports, "pick", { enumerable: true, get: function () { return objectUtils_1.pick; } }); | ||
Object.defineProperty(exports, "pickWithoutUndefined", { enumerable: true, get: function () { return objectUtils_1.pickWithoutUndefined; } }); | ||
Object.defineProperty(exports, "isEmptyObject", { enumerable: true, get: function () { return objectUtils_1.isEmptyObject; } }); | ||
@@ -12,0 +13,0 @@ Object.defineProperty(exports, "groupBy", { enumerable: true, get: function () { return objectUtils_1.groupBy; } }); |
export declare function copyWithoutUndefined<T extends Record<K, V>, K extends string | number | symbol, V>(originalValue: T): T; | ||
export declare function pick<T, K extends string | number | symbol>(source: T, propNames: readonly K[]): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>; | ||
export declare function pickWithoutUndefined<T, K extends string | number | symbol>(source: T, propNames: readonly K[]): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>; | ||
export declare function isEmptyObject(params: Record<string, any>): boolean; | ||
export declare function groupBy<T>(inputArray: T[], propName: string): Record<string, T[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.groupBy = exports.isEmptyObject = exports.pick = exports.copyWithoutUndefined = void 0; | ||
exports.groupBy = exports.isEmptyObject = exports.pickWithoutUndefined = exports.pick = exports.copyWithoutUndefined = void 0; | ||
function copyWithoutUndefined(originalValue) { | ||
@@ -28,2 +28,16 @@ return Object.keys(originalValue).reduce((acc, key) => { | ||
exports.pick = pick; | ||
function pickWithoutUndefined(source, propNames) { | ||
const result = {}; | ||
let idx = 0; | ||
while (idx < propNames.length) { | ||
// @ts-ignore | ||
if (propNames[idx] in source && source[propNames[idx]] !== undefined) { | ||
// @ts-ignore | ||
result[propNames[idx]] = source[propNames[idx]]; | ||
} | ||
idx += 1; | ||
} | ||
return result; | ||
} | ||
exports.pickWithoutUndefined = pickWithoutUndefined; | ||
function isEmptyObject(params) { | ||
@@ -30,0 +44,0 @@ for (const key in params) { |
{ | ||
"name": "knex-utils", | ||
"version": "5.3.2", | ||
"version": "5.4.0", | ||
"license": "MIT", | ||
@@ -30,19 +30,19 @@ "maintainers": [ | ||
"devDependencies": { | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.12.5", | ||
"@typescript-eslint/eslint-plugin": "^4.28.1", | ||
"@typescript-eslint/parser": "^4.28.1", | ||
"eslint": "^7.29.0", | ||
"@types/jest": "^27.0.1", | ||
"@types/node": "^16.7.1", | ||
"@typescript-eslint/eslint-plugin": "^4.29.2", | ||
"@typescript-eslint/parser": "^4.29.2", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-prettier": "^3.4.1", | ||
"jest": "^27.0.6", | ||
"knex": "^0.95.6", | ||
"knex": "^0.95.10", | ||
"mysql": "^2.18.1", | ||
"mysql2": "^2.2.5", | ||
"pg": "^8.6.0", | ||
"mysql2": "^2.3.0", | ||
"pg": "^8.7.1", | ||
"prettier": "^2.3.2", | ||
"sqlite3": "^5.0.2", | ||
"tedious": "^11.0.9", | ||
"ts-jest": "^27.0.3", | ||
"typescript": "4.3.4" | ||
"tedious": "^11.4.0", | ||
"ts-jest": "^27.0.5", | ||
"typescript": "4.3.5" | ||
}, | ||
@@ -49,0 +49,0 @@ "engines": { |
@@ -87,2 +87,4 @@ # knex-utils | ||
* `pickWithoutUndefined(source: T, propNames: K[]): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>` - same as `pick`, but skips properties with value `undefined`. | ||
### DB relation difference operations | ||
@@ -89,0 +91,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
30170
308
127