@appolo/utils
Advanced tools
Comparing version 8.0.28 to 8.0.29
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Url = exports.Ip = exports.Crypto = exports.Errors = exports.Functions = exports.Reflector = exports.Deferred = exports.Enums = exports.Files = exports.Util = exports.Time = exports.Promises = exports.Guid = exports.Classes = exports.Arrays = exports.Objects = exports.Hash = exports.Strings = exports.Numbers = exports._ = exports.date = void 0; | ||
const tslib_1 = require("tslib"); | ||
const numbers_1 = require("./lib/numbers"); | ||
@@ -47,2 +48,3 @@ Object.defineProperty(exports, "Numbers", { enumerable: true, get: function () { return numbers_1.Numbers; } }); | ||
exports.default = util_1.Util; | ||
tslib_1.__exportStar(require("./lib/types/types"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -25,2 +25,4 @@ import {Numbers} from "./lib/numbers" | ||
export * from "./lib/types/types" | ||
export { | ||
@@ -27,0 +29,0 @@ date, |
@@ -39,3 +39,3 @@ "use strict"; | ||
static random(arr) { | ||
if (!arr) { | ||
if (!arr || !arr.length) { | ||
return null; | ||
@@ -48,2 +48,8 @@ } | ||
} | ||
static randomItems(arr, n) { | ||
if (!arr || !arr.length) { | ||
return []; | ||
} | ||
return Arrays.sortBy(arr, () => 0.5 - Math.random()).slice(0, n); | ||
} | ||
static removeBy(list, criteria) { | ||
@@ -50,0 +56,0 @@ if (!list || !list.length) { |
@@ -48,3 +48,3 @@ import {Classes} from "./classes"; | ||
if (!arr) { | ||
if (!arr || !arr.length) { | ||
return null; | ||
@@ -59,3 +59,11 @@ } | ||
public static randomItems<T>(arr: T[], n: number): T[] { | ||
if (!arr || !arr.length) { | ||
return []; | ||
} | ||
return Arrays.sortBy(arr, () => 0.5 - Math.random()).slice(0, n) | ||
} | ||
public static removeBy<T>(list: T[], criteria: (value: T, i?: number) => boolean): void { | ||
@@ -62,0 +70,0 @@ if (!list || !list.length) { |
@@ -20,3 +20,3 @@ { | ||
"main": "./index.js", | ||
"version": "8.0.28", | ||
"version": "8.0.29", | ||
"license": "MIT", | ||
@@ -23,0 +23,0 @@ "repository": { |
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
223696
98
4064