appolo-utils
Advanced tools
Comparing version 0.0.43 to 0.0.44
@@ -83,2 +83,5 @@ "use strict"; | ||
} | ||
static zip(arr, ...args) { | ||
return arr.map((value, idx) => [value, ...args.map(arr => arr[idx])]); | ||
} | ||
static sort(arr) { | ||
@@ -85,0 +88,0 @@ let criteria = ((value) => value); |
@@ -122,2 +122,8 @@ import {Classes} from "./classes"; | ||
public static zip<T>(arr: T[], ...args: Array<T>): Array<Array<T | undefined>> { | ||
return arr.map((value, idx) => [value, ...args.map(arr => arr[idx])]) | ||
} | ||
public static sort<T>(arr: T[]): T[] { | ||
@@ -124,0 +130,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const arrays_1 = require("./arrays"); | ||
class Objects { | ||
@@ -82,4 +83,22 @@ static isPlain(obj) { | ||
} | ||
static pick(obj, pick) { | ||
let out = {}; | ||
for (let i = 0; i < pick.length; i++) { | ||
let key = pick[i]; | ||
out[key] = obj[key]; | ||
} | ||
return out; | ||
} | ||
static omit(obj, omit) { | ||
let out = {}, keys = Object.keys(obj || {}), omitIndex = arrays_1.Arrays.keyBy(omit); | ||
for (let i = 0; i < keys.length; i++) { | ||
let key = keys[i]; | ||
if (!omitIndex[key]) { | ||
out[key] = obj[key]; | ||
} | ||
} | ||
return out; | ||
} | ||
} | ||
exports.Objects = Objects; | ||
//# sourceMappingURL=objects.js.map |
@@ -0,1 +1,3 @@ | ||
import {Arrays} from "./arrays"; | ||
export class Objects { | ||
@@ -111,2 +113,26 @@ public static isPlain(obj: any): boolean { | ||
} | ||
public static pick<T extends object, U extends keyof T>(obj: T, pick: U[]): Pick<T, U> { | ||
let out: any = {}; | ||
for (let i = 0; i < pick.length; i++) { | ||
let key = pick[i]; | ||
out[key] = obj[key]; | ||
} | ||
return out | ||
} | ||
public static omit<T extends object, U extends keyof T>(obj: T, omit: U[]): Omit<T, U> { | ||
let out: any = {}, keys = Object.keys(obj || {}), omitIndex = Arrays.keyBy(omit); | ||
for (let i = 0; i < keys.length; i++) { | ||
let key = keys[i]; | ||
if (!omitIndex[key]) { | ||
out[key] = obj[key]; | ||
} | ||
} | ||
return out | ||
} | ||
} |
@@ -40,3 +40,3 @@ "use strict"; | ||
if (result !== undefined) { | ||
return Object.assign({}, exported[i], { metaData: result }); | ||
return Object.assign(Object.assign({}, exported[i]), { metaData: result }); | ||
} | ||
@@ -51,3 +51,3 @@ } | ||
if (result !== undefined) { | ||
results.push(Object.assign({}, exported[i], { metaData: result })); | ||
results.push(Object.assign(Object.assign({}, exported[i]), { metaData: result })); | ||
} | ||
@@ -54,0 +54,0 @@ } |
@@ -32,2 +32,3 @@ "use strict"; | ||
} | ||
exports.Time = Time; | ||
Time.Second = 1000; | ||
@@ -40,3 +41,2 @@ Time.Minute = Time.Second * 60; | ||
Time.Year = Time.Day * 365.25; | ||
exports.Time = Time; | ||
//# sourceMappingURL=time.js.map |
@@ -17,3 +17,3 @@ { | ||
"main": "./index.js", | ||
"version": "0.0.43", | ||
"version": "0.0.44", | ||
"license": "MIT", | ||
@@ -32,16 +32,16 @@ "repository": { | ||
"@types/bluebird": "^3.5.27", | ||
"@types/chai": "^4.1.6", | ||
"@types/lodash": "^4.14.116", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^13.7.6", | ||
"@types/chai": "^4.2.11", | ||
"@types/lodash": "^4.14.149", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^13.9.1", | ||
"aes256": "^1.0.4", | ||
"benchmark": "^2.1.4", | ||
"bluebird": "^3.5.5", | ||
"bluebird": "^3.7.2", | ||
"chai": "^4.2.0", | ||
"crypto-js": "^3.1.9-1", | ||
"lodash": "^4.17.14", | ||
"mocha": "^5.2.0", | ||
"tslib": "^1.9.3", | ||
"typescript": "^3.1.1" | ||
"crypto-js": "^4.0.0", | ||
"lodash": "^4.17.15", | ||
"mocha": "^7.1.1", | ||
"tslib": "^1.11.1", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
101838
1837