@meteor-it/utils
Advanced tools
Comparing version 1.3.33 to 2.1.0
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Readable } from 'stream'; | ||
@@ -7,3 +8,3 @@ export declare function createReadStream(object: Buffer, options?: {}): MultiStream; | ||
highWaterMark?: number; | ||
encoding?: string; | ||
encoding?: BufferEncoding; | ||
} | ||
@@ -21,51 +22,2 @@ export declare class MultiStream extends Readable { | ||
export declare function objectEquals(x: any, y: any): boolean; | ||
/** | ||
* Flattens array | ||
* @param array | ||
* @param result | ||
*/ | ||
export declare function flatten(array: any[], result?: any[]): any[]; | ||
/** | ||
* @deprecated | ||
* @param array | ||
*/ | ||
export declare function removeDuplicates<T>(array: T[]): T[]; | ||
/** | ||
* @deprecated | ||
* @param array1 | ||
* @param array2 | ||
*/ | ||
export declare function mix(array1: any[] | Object, array2: any[] | Object): any; | ||
/** | ||
* @deprecated | ||
* @param values | ||
*/ | ||
export declare function createPrivateEnum(...values: string[]): { | ||
[key: string]: Symbol; | ||
}; | ||
/** | ||
* @deprecated | ||
* @param string | ||
* @param length | ||
* @param insertPre | ||
* @param symbol | ||
*/ | ||
export declare function fixLength(string: string, length: number, insertPre?: boolean, symbol?: string): string; | ||
declare global { | ||
interface ObjectConstructor { | ||
values(object: any): any; | ||
} | ||
} | ||
/** | ||
* @deprecated Object.entrys | ||
* @param object | ||
* @param cb | ||
*/ | ||
export declare function objectMap(object: any, cb: (a: any, b: any, c: any) => any): any; | ||
/** | ||
* @deprecated Object.entrys | ||
* @param keys | ||
* @param values | ||
*/ | ||
export declare function arrayKVObject(keys: string[], values: any[]): any; | ||
export declare function sleep(time: number): Promise<void>; | ||
@@ -124,3 +76,3 @@ /** | ||
} | ||
export declare type MaybePromise<T> = Promise<T> | T; | ||
export type MaybePromise<T> = Promise<T> | T; | ||
export declare function isPromise<T>(val: MaybePromise<T>): val is Promise<T>; | ||
@@ -127,0 +79,0 @@ /** |
211
index.js
@@ -1,11 +0,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const stream_1 = require("stream"); | ||
import { Readable } from 'stream'; | ||
// noinspection JSUnusedGlobalSymbols | ||
function createReadStream(object, options = {}) { | ||
export function createReadStream(object, options = {}) { | ||
return new MultiStream(object, options); | ||
} | ||
exports.createReadStream = createReadStream; | ||
// noinspection JSUnusedGlobalSymbols | ||
function readStreamToBuffer(stream, maxSize = 0) { | ||
export function readStreamToBuffer(stream, maxSize = 0) { | ||
return new Promise((res, rej) => { | ||
@@ -28,4 +25,4 @@ const bufs = []; | ||
} | ||
exports.readStreamToBuffer = readStreamToBuffer; | ||
class MultiStream extends stream_1.Readable { | ||
export class MultiStream extends Readable { | ||
object; | ||
constructor(object, options = {}) { | ||
@@ -44,8 +41,6 @@ super({ | ||
} | ||
exports.MultiStream = MultiStream; | ||
// hello, world => Hello, world! | ||
function firstUppercase(str) { | ||
export function firstUppercase(str) { | ||
return str.substr(0, 1).toUpperCase() + str.substr(1); | ||
} | ||
exports.firstUppercase = firstUppercase; | ||
/** | ||
@@ -55,3 +50,3 @@ * @param x | ||
*/ | ||
function objectEquals(x, y) { | ||
export function objectEquals(x, y) { | ||
if (x === null || x === undefined || y === null || y === undefined) { | ||
@@ -94,112 +89,3 @@ return x === y; | ||
} | ||
exports.objectEquals = objectEquals; | ||
/** | ||
* Flattens array | ||
* @param array | ||
* @param result | ||
*/ | ||
function flatten(array, result = []) { | ||
for (let i = 0; i < array.length; i++) { | ||
const value = array[i]; | ||
if (Array.isArray(value)) { | ||
flatten(value, result); | ||
} | ||
else { | ||
result.push(value); | ||
} | ||
} | ||
return result; | ||
} | ||
exports.flatten = flatten; | ||
/** | ||
* @deprecated | ||
* @param array | ||
*/ | ||
function removeDuplicates(array) { | ||
return Array.from(new Set(array)); | ||
} | ||
exports.removeDuplicates = removeDuplicates; | ||
/** | ||
* @deprecated | ||
* @param array1 | ||
* @param array2 | ||
*/ | ||
function mix(array1, array2) { | ||
let out; | ||
if (array1 instanceof Array) { | ||
out = []; | ||
for (let index in array1) { | ||
out.push([array1[index], array2[index]]); | ||
} | ||
return out; | ||
} | ||
else { | ||
out = {}; | ||
for (let key in array1) { | ||
// noinspection JSUnfilteredForInLoop | ||
out[key] = array1[key]; | ||
} | ||
for (let key in array2) { | ||
// noinspection JSUnfilteredForInLoop | ||
out[key] = array2[key]; | ||
} | ||
return out; | ||
} | ||
} | ||
exports.mix = mix; | ||
/** | ||
* @deprecated | ||
* @param values | ||
*/ | ||
function createPrivateEnum(...values) { | ||
let returnObj = {}; | ||
values.map(value => value.toUpperCase()); | ||
values.forEach(value => returnObj[value] = Symbol(value)); | ||
return returnObj; | ||
} | ||
exports.createPrivateEnum = createPrivateEnum; | ||
/** | ||
* @deprecated | ||
* @param string | ||
* @param length | ||
* @param insertPre | ||
* @param symbol | ||
*/ | ||
// noinspection JSUnusedGlobalSymbols | ||
function fixLength(string, length, insertPre = false, symbol = ' ') { | ||
return insertPre ? string.padStart(length, symbol) : string.padEnd(length, symbol); | ||
} | ||
exports.fixLength = fixLength; | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @deprecated Object.entrys | ||
* @param object | ||
* @param cb | ||
*/ | ||
function objectMap(object, cb) { | ||
let ret = []; | ||
let keys = Object.keys(object); | ||
let values = Object.values(object); | ||
for (let i = 0; i < keys.length; i++) | ||
ret.push(cb(values[i], keys[i], object)); | ||
return ret; | ||
} | ||
exports.objectMap = objectMap; | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @deprecated Object.entrys | ||
* @param keys | ||
* @param values | ||
*/ | ||
function arrayKVObject(keys, values) { | ||
let len = keys.length; | ||
if (len !== values.length) | ||
throw new Error('Both arrays must have same length!'); | ||
let result = {}; | ||
for (let i = 0; i < len; i++) | ||
result[keys[i]] = values[i]; | ||
return result; | ||
} | ||
exports.arrayKVObject = arrayKVObject; | ||
function sleep(time) { | ||
export function sleep(time) { | ||
return new Promise((res) => { | ||
@@ -209,3 +95,2 @@ setTimeout(res, time); | ||
} | ||
exports.sleep = sleep; | ||
// noinspection JSUnusedGlobalSymbols | ||
@@ -218,3 +103,3 @@ /** | ||
*/ | ||
function asyncEach(iterable, cb) { | ||
export function asyncEach(iterable, cb) { | ||
let waitings = []; | ||
@@ -226,5 +111,4 @@ iterable.forEach(iter => { | ||
} | ||
exports.asyncEach = asyncEach; | ||
// noinspection JSUnusedGlobalSymbols | ||
function hashCode(s) { | ||
export function hashCode(s) { | ||
let hash = 0; | ||
@@ -240,5 +124,4 @@ if (s.length === 0) | ||
} | ||
exports.hashCode = hashCode; | ||
// noinspection JSUnusedGlobalSymbols | ||
function djb2Code(str) { | ||
export function djb2Code(str) { | ||
let hash = 5381; | ||
@@ -251,5 +134,4 @@ for (let i = 0; i < str.length; i++) { | ||
} | ||
exports.djb2Code = djb2Code; | ||
// noinspection JSUnusedGlobalSymbols | ||
function sdbmCode(str) { | ||
export function sdbmCode(str) { | ||
let hash = 0; | ||
@@ -262,5 +144,4 @@ for (let i = 0; i < str.length; i++) { | ||
} | ||
exports.sdbmCode = sdbmCode; | ||
// noinspection JSUnusedGlobalSymbols | ||
function loseCode(str) { | ||
export function loseCode(str) { | ||
let hash = 0; | ||
@@ -272,3 +153,2 @@ for (let i = 0; i < str.length; i++) { | ||
} | ||
exports.loseCode = loseCode; | ||
/** | ||
@@ -280,3 +160,3 @@ * Encodes bad html characters in string to codepoint format | ||
// noinspection JSUnusedGlobalSymbols | ||
function encodeHtmlSpecials(str) { | ||
export function encodeHtmlSpecials(str) { | ||
let ret = ''; | ||
@@ -291,3 +171,2 @@ for (let i = 0; i < str.length; i++) { | ||
} | ||
exports.encodeHtmlSpecials = encodeHtmlSpecials; | ||
function _getGlobal() { | ||
@@ -309,3 +188,3 @@ if (typeof window !== "undefined") { | ||
*/ | ||
function getGlobal() { | ||
export function getGlobal() { | ||
if (cachedGlobal !== null) | ||
@@ -315,3 +194,2 @@ return cachedGlobal; | ||
} | ||
exports.getGlobal = getGlobal; | ||
/** | ||
@@ -322,3 +200,3 @@ * Calls __non_webpack_require__ or plain require to work around webpack, | ||
*/ | ||
function externalRequire(module) { | ||
export function externalRequire(module) { | ||
const global = getGlobal(); | ||
@@ -336,5 +214,3 @@ if (typeof __non_webpack_require__ !== 'undefined') { | ||
} | ||
exports.externalRequire = externalRequire; | ||
function _isNodeEnvironment() { | ||
var _a, _b; | ||
if (typeof __webpack_require__ === 'function') { | ||
@@ -348,3 +224,3 @@ try { | ||
} | ||
return (typeof process !== 'undefined') && (!!((_b = (_a = process) === null || _a === void 0 ? void 0 : _a.versions) === null || _b === void 0 ? void 0 : _b.node)); | ||
return (typeof process !== 'undefined') && (!!process?.versions?.node); | ||
} | ||
@@ -355,3 +231,3 @@ let isNodeEnvironmentCache = null; | ||
*/ | ||
function isNodeEnvironment() { | ||
export function isNodeEnvironment() { | ||
if (isNodeEnvironmentCache !== null) | ||
@@ -361,3 +237,2 @@ return isNodeEnvironmentCache; | ||
} | ||
exports.isNodeEnvironment = isNodeEnvironment; | ||
function _isBrowserEnvironment() { | ||
@@ -380,3 +255,3 @@ if (typeof __webpack_require__ === 'function') { | ||
*/ | ||
function isBrowserEnvironment() { | ||
export function isBrowserEnvironment() { | ||
if (isBrowserEnvironmentCache !== null) | ||
@@ -386,4 +261,3 @@ return isBrowserEnvironmentCache; | ||
} | ||
exports.isBrowserEnvironment = isBrowserEnvironment; | ||
async function collectCallbacks(cbProvider) { | ||
export async function collectCallbacks(cbProvider) { | ||
const output = []; | ||
@@ -394,4 +268,3 @@ const collector = (v) => output.push(v); | ||
} | ||
exports.collectCallbacks = collectCallbacks; | ||
async function repeatBeforeSucceed(fn, maxRepeats, repeatIn, timeMultiplier = 1, maxTime) { | ||
export async function repeatBeforeSucceed(fn, maxRepeats, repeatIn, timeMultiplier = 1, maxTime) { | ||
let repeat = 0; | ||
@@ -408,3 +281,3 @@ if (timeMultiplier < 1) | ||
if (repeat !== 0 && timeMultiplier != 1) { | ||
repeatIn = Math.min(repeatIn * timeMultiplier, (maxTime !== null && maxTime !== void 0 ? maxTime : Infinity)); | ||
repeatIn = Math.min(repeatIn * timeMultiplier, maxTime ?? Infinity); | ||
} | ||
@@ -416,8 +289,5 @@ await sleep(repeatIn); | ||
} | ||
exports.repeatBeforeSucceed = repeatBeforeSucceed; | ||
class TypedEvent { | ||
constructor() { | ||
this.listeners = []; | ||
this.listenersOncer = []; | ||
} | ||
export class TypedEvent { | ||
listeners = []; | ||
listenersOncer = []; | ||
on(listener) { | ||
@@ -449,26 +319,19 @@ this.listeners.push(listener); | ||
} | ||
exports.TypedEvent = TypedEvent; | ||
function isPromise(val) { | ||
export function isPromise(val) { | ||
return val instanceof Promise; | ||
} | ||
exports.isPromise = isPromise; | ||
/** | ||
* Simple, never expiring in-memory cache | ||
*/ | ||
class PromiseMap { | ||
constructor() { | ||
this.flushEvent = new TypedEvent(); | ||
this.populateEvent = new TypedEvent(); | ||
this.normalizeKey = null; | ||
this.normalizeValue = null; | ||
this.map = new Map(); | ||
this.resolvedMap = new Map(); | ||
this.getAll = this._getAll; | ||
this.get = this._get; | ||
} | ||
export class PromiseMap { | ||
flushEvent = new TypedEvent(); | ||
populateEvent = new TypedEvent(); | ||
normalizeKey = null; | ||
normalizeValue = null; | ||
map = new Map(); | ||
resolvedMap = new Map(); | ||
getIfResolvedPresent(key) { | ||
var _a; | ||
if (this.normalizeKey) | ||
key = this.normalizeKey(key); | ||
return _a = this.resolvedMap.get(key), (_a !== null && _a !== void 0 ? _a : null); | ||
return this.resolvedMap.get(key) ?? null; | ||
} | ||
@@ -499,2 +362,3 @@ getIfResolvingOrResolvedPresent(key) { | ||
} | ||
getAll = this._getAll; | ||
/** | ||
@@ -523,2 +387,3 @@ * Works great with collapsing queue | ||
} | ||
get = this._get; | ||
_get(key) { | ||
@@ -544,4 +409,2 @@ if (this.normalizeKey) | ||
} | ||
exports.PromiseMap = PromiseMap; | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInhyZXN0L25vZ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DogYW55W10gPSBbXSk6IGFueVtdIHtcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFycmF5Lmxlbmd0aDsgaSsrKSB7XG4gICAgICAgIGNvbnN0IHZhbHVlID0gYXJyYXlbaV07XG5cbiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkodmFsdWUpKSB7XG4gICAgICAgICAgICBmbGF0dGVuKHZhbHVlLCByZXN1bHQpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgcmVzdWx0LnB1c2godmFsdWUpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIHJlc3VsdDtcbn1cblxuLyoqXG4gKiBAZGVwcmVjYXRlZFxuICogQHBhcmFtIGFycmF5XG4gKi9cbmV4cG9ydCBmdW5jdGlvbiByZW1vdmVEdXBsaWNhdGVzPFQ+KGFycmF5OiBUW10pOiBUW10ge1xuICAgIHJldHVybiBBcnJheS5mcm9tKG5ldyBTZXQoYXJyYXkpKTtcbn1cblxuLyoqXG4gKiBAZGVwcmVjYXRlZFxuICogQHBhcmFtIGFycmF5MVxuICogQHBhcmFtIGFycmF5MlxuICovXG5leHBvcnQgZnVuY3Rpb24gbWl4KGFycmF5MTogYW55W10gfCBPYmplY3QsIGFycmF5MjogYW55W10gfCBPYmplY3QpOiBhbnkge1xuICAgIGxldCBvdXQ6IGFueTtcbiAgICBpZiAoYXJyYXkxIGluc3RhbmNlb2YgQXJyYXkpIHtcbiAgICAgICAgb3V0ID0gW107XG4gICAgICAgIGZvciAobGV0IGluZGV4IGluIGFycmF5MSkge1xuICAgICAgICAgICAgb3V0LnB1c2goW2FycmF5MVtpbmRleF0sIChhcnJheTIgYXMgYW55KVtpbmRleF1dKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gb3V0O1xuICAgIH0gZWxzZSB7XG4gICAgICAgIG91dCA9IHt9O1xuICAgICAgICBmb3IgKGxldCBrZXkgaW4gYXJyYXkxKSB7XG4gICAgICAgICAgIC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bXT4ge1xuICAgIGNvbnN0IG91dHB1dDogVFtdID0gW107XG4gICAgY29uc3QgY29sbGVjdG9yID0gKHY6IFQpID0+IG91dHB1dC5wdXNoKHYpO1xuICAgIGF3YWl0IGNiUHJvdmlkZXIoY29sbGVjdG9yKTtcbiAgICByZXR1cm4gb3V0cHV0O1xufVxuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gcmVwZWF0QmVmb3JlU3VjY2VlZDxWPihmbjogKCkgPT4gUHJvbWlzZTxWPiwgbWF4UmVwZWF0czogbnVtYmVyLCByZXBlYXRJbjogbnVtYmVyLCB0aW1lTXVsdGlwbGllcjogbnVtYmVyID0gMSwgbWF4VGltZT86IG51bWJlcik6IFByb21pc2U8Vj4ge1xuICAgIGxldCByZXBlYXQgPSAwO1xuICAgIGlmICh0aW1lTXVsdGlwbGllciA8IDEpIHRocm93IG5ldyBFcnJvcihgdGltZU11bHRpcGxpZXIgKD0gJHt0aW1lTXVsdGlwbGllcn0pIDwgMSBtYWtlcyBubyBzZW5zZWApO1xuICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gYXdhaXQgZm4oKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgaWYgKHJlcGVhdCA+PSBtYXhSZXBlYXRzKVxuICAgICAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgICAgICBpZiAocmVwZWF0ICE9PSAwICYmIHRpbWVNdWx0aXBsaWVyICE9IDEpIHtcbiAgICAgICAgICAgICAgICByZXBlYXRJbiA9IE1hdGgubWluKHJlcGVhdEluICogdGltZU11bHRpcGxpZXIsIG1heFRpbWUgPz8gSW5maW5pdHkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYXdhaXQgc2xlZXAocmVwZWF0SW4pO1xuICAgICAgICB9XG4gICAgICAgIHJlcGVhdCsrO1xuICAgIH1cbn1cblxuZXhwb3J0IGludGVyZmFjZSBMaXN0ZW5l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lzZXMucHVzaCgodGhpcy5nZXQoa2V5KSBhcyBQcm9taXNlPFYgfCBudWxsPikudGhlbih2ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0c1tpXSA9IHY7XG4gICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChwcm9taXNlcy5sZW5ndGggPT09IDApXG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0cyBhcyAoViB8IG51bGwpW107XG4gICAgICAgIHJldHVybiBQcm9taXNlLmFsbChwcm9taXNlcykudGhlbigoKSA9PiByZXN1bHRzIGFzIChWIHwgbnVsbClbXSk7XG4gICAgfVxuXG4gICAgZ2V0OiAoa2V5OiBLKSA9PiBNYXliZVByb21pc2U8ViB8IG51bGw+ID0gdGhpcy5fZ2V0O1xuXG4gICAgcHJvdGVjdGVkIF9nZXQoa2V5OiBLKTogTWF5YmVQcm9taXNlPFYgfCBudWxsPiB7XG4gICAgICAgIGlmICh0aGlzLm5vcm1hbGl6ZUtleSkga2V5ID0gdGhpcy5ub3JtYWxpemVLZXkoa2V5KTtcbiAgICAgICAgaWYgKHRoaXMucmVzb2x2ZWRNYXAuaGFzKGtleSkpXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlZE1hcC5nZXQoa2V5KSE7XG4gICAgICAgIGlmICghdGhpcy5tYXAuaGFzKGtleSkpIHtcbiAgICAgICAgICAgIGNvbnN0IHByb21pc2UgPSB0aGlzLmdldFByb21pc2Uoa2V5KS50aGVuKHYgPT4gKHYgIT09IG51bGwgJiYgdGhpcy5ub3JtYWxpemVWYWx1ZSkgPyB0aGlzLm5vcm1hbGl6ZVZhbHVlKHYpIDogdik7XG4gICAgICAgICAgICB0aGlzLm1hcC5zZXQoa2V5LCBwcm9taXNlKTtcbiAgICAgICAgICAgIHByb21pc2UudGhlbih2ID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLm1hcC5kZWxldGUoa2V5KTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlc29sdmVkTWFwLnNldChrZXksIHYpO1xuICAgICAgICAgICAgICAgIHRoaXMucG9wdWxhdGVFdmVudC5lbWl0KFtrZXksIHZdKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcHJvbWlzZS5jYXRjaChfZSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5tYXAuZGVsZXRlKGtleSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcy5tYXAuZ2V0KGtleSkhO1xuICAgIH1cbn1cbiJdfQ== | ||
//# sourceMappingURL=index.js.map |
127
index.ts
@@ -30,3 +30,3 @@ import { Readable } from 'stream'; | ||
highWaterMark?: number; | ||
encoding?: string; | ||
encoding?: BufferEncoding; | ||
} | ||
@@ -101,117 +101,2 @@ | ||
/** | ||
* Flattens array | ||
* @param array | ||
* @param result | ||
*/ | ||
export function flatten(array: any[], result: any[] = []): any[] { | ||
for (let i = 0; i < array.length; i++) { | ||
const value = array[i]; | ||
if (Array.isArray(value)) { | ||
flatten(value, result); | ||
} | ||
else { | ||
result.push(value); | ||
} | ||
} | ||
return result; | ||
} | ||
/** | ||
* @deprecated | ||
* @param array | ||
*/ | ||
export function removeDuplicates<T>(array: T[]): T[] { | ||
return Array.from(new Set(array)); | ||
} | ||
/** | ||
* @deprecated | ||
* @param array1 | ||
* @param array2 | ||
*/ | ||
export function mix(array1: any[] | Object, array2: any[] | Object): any { | ||
let out: any; | ||
if (array1 instanceof Array) { | ||
out = []; | ||
for (let index in array1) { | ||
out.push([array1[index], (array2 as any)[index]]); | ||
} | ||
return out; | ||
} else { | ||
out = {}; | ||
for (let key in array1) { | ||
// noinspection JSUnfilteredForInLoop | ||
out[key] = (array1 as any)[key]; | ||
} | ||
for (let key in array2) { | ||
// noinspection JSUnfilteredForInLoop | ||
out[key] = (array2 as any)[key]; | ||
} | ||
return out; | ||
} | ||
} | ||
/** | ||
* @deprecated | ||
* @param values | ||
*/ | ||
export function createPrivateEnum(...values: string[]): { [key: string]: Symbol } { | ||
let returnObj: any = {}; | ||
values.map(value => value.toUpperCase()); | ||
values.forEach(value => returnObj[value] = Symbol(value)); | ||
return returnObj; | ||
} | ||
/** | ||
* @deprecated | ||
* @param string | ||
* @param length | ||
* @param insertPre | ||
* @param symbol | ||
*/ | ||
// noinspection JSUnusedGlobalSymbols | ||
export function fixLength(string: string, length: number, insertPre = false, symbol = ' ') { | ||
return insertPre ? string.padStart(length, symbol) : string.padEnd(length, symbol); | ||
} | ||
declare global { | ||
// noinspection JSUnusedGlobalSymbols | ||
interface ObjectConstructor { | ||
values(object: any): any; | ||
} | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @deprecated Object.entrys | ||
* @param object | ||
* @param cb | ||
*/ | ||
export function objectMap(object: any, cb: (a: any, b: any, c: any) => any): any { | ||
let ret = []; | ||
let keys = Object.keys(object); | ||
let values = Object.values(object); | ||
for (let i = 0; i < keys.length; i++) | ||
ret.push(cb(values[i], keys[i], object)); | ||
return ret; | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @deprecated Object.entrys | ||
* @param keys | ||
* @param values | ||
*/ | ||
export function arrayKVObject(keys: string[], values: any[]): any { | ||
let len = keys.length; | ||
if (len !== values.length) | ||
throw new Error('Both arrays must have same length!'); | ||
let result: any = {}; | ||
for (let i = 0; i < len; i++) | ||
result[keys[i]] = values[i]; | ||
return result; | ||
} | ||
export function sleep(time: number): Promise<void> { | ||
@@ -488,7 +373,7 @@ return new Promise((res) => { | ||
/** | ||
* Works great with collapsing queue | ||
* | ||
* @param keys | ||
*/ | ||
/** | ||
* Works great with collapsing queue | ||
* | ||
* @param keys | ||
*/ | ||
protected _getAll(keys: K[]): MaybePromise<(V | null)[]> { | ||
@@ -495,0 +380,0 @@ const promises: Promise<void>[] = []; |
{ | ||
"name": "@meteor-it/utils", | ||
"version": "1.3.33", | ||
"description": "Many useful utils", | ||
"module": "index.mjs", | ||
"main": "index.js", | ||
"keywords": [ | ||
"meteor-it", | ||
"utils" | ||
], | ||
"author": "CertainLach <iam@lach.pw>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "8f833b33d2b2da88753640cf0bc9d2bca3b23fde" | ||
} | ||
"name": "@meteor-it/utils", | ||
"version": "2.1.0", | ||
"description": "Many useful utils", | ||
"main": "index.js", | ||
"type": "module", | ||
"keywords": [ | ||
"meteor-it", | ||
"utils" | ||
], | ||
"author": "CertainLach <iam@lach.pw>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "cb3baad75ddedd6d3f188a796f7e3a2f5ccaa043" | ||
} |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
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
3
Yes
39090
5
855
2
0