@meteor-it/utils
Advanced tools
Comparing version 1.3.3 to 1.3.4
55
index.js
@@ -9,2 +9,8 @@ "use strict"; | ||
exports.firstUppercase = firstUppercase; | ||
/** | ||
* | ||
* @deprecated Extremally slow on Proxy/getters | ||
* @param x | ||
* @param y | ||
*/ | ||
function objectEquals(x, y) { | ||
@@ -33,2 +39,7 @@ if (x === null || x === undefined || y === null || y === undefined) { | ||
exports.objectEquals = objectEquals; | ||
/** | ||
* Flattens array | ||
* @param array | ||
* @param result | ||
*/ | ||
function flatten(array, result = []) { | ||
@@ -47,2 +58,6 @@ for (let i = 0; i < array.length; i++) { | ||
exports.flatten = flatten; | ||
/** | ||
* @deprecated | ||
* @param array | ||
*/ | ||
function removeDuplicates(array) { | ||
@@ -52,2 +67,7 @@ return Array.from(new Set(array)); | ||
exports.removeDuplicates = removeDuplicates; | ||
/** | ||
* @deprecated | ||
* @param array1 | ||
* @param array2 | ||
*/ | ||
function mix(array1, array2) { | ||
@@ -76,2 +96,6 @@ let out; | ||
exports.mix = mix; | ||
/** | ||
* @deprecated | ||
* @param values | ||
*/ | ||
function createPrivateEnum(...values) { | ||
@@ -84,2 +108,10 @@ let returnObj = {}; | ||
exports.createPrivateEnum = createPrivateEnum; | ||
/** | ||
* @deprecated | ||
* @param string | ||
* @param length | ||
* @param insertPre | ||
* @param symbol | ||
*/ | ||
// noinspection JSUnusedGlobalSymbols | ||
function fixLength(string, length, insertPre = false, symbol = ' ') { | ||
@@ -89,2 +121,8 @@ 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) { | ||
@@ -99,2 +137,8 @@ let ret = []; | ||
exports.objectMap = objectMap; | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @deprecated Object.entrys | ||
* @param keys | ||
* @param values | ||
*/ | ||
function arrayKVObject(keys, values) { | ||
@@ -116,2 +160,3 @@ let len = keys.length; | ||
exports.sleep = sleep; | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
@@ -131,4 +176,6 @@ * Like iterable.map(cb), | ||
exports.asyncEach = asyncEach; | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* Convert callback function to async | ||
* @deprecated Existst in node utils | ||
* @param cbFunction Function to convert | ||
@@ -148,2 +195,3 @@ */ | ||
exports.cb2promise = cb2promise; | ||
// noinspection JSUnusedGlobalSymbols | ||
function hashCode(s) { | ||
@@ -161,2 +209,3 @@ let hash = 0; | ||
exports.hashCode = hashCode; | ||
// noinspection JSUnusedGlobalSymbols | ||
function djb2Code(str) { | ||
@@ -171,2 +220,3 @@ let hash = 5381; | ||
exports.djb2Code = djb2Code; | ||
// noinspection JSUnusedGlobalSymbols | ||
function sdbmCode(str) { | ||
@@ -181,2 +231,3 @@ let hash = 0; | ||
exports.sdbmCode = sdbmCode; | ||
// noinspection JSUnusedGlobalSymbols | ||
function loseCode(str) { | ||
@@ -190,2 +241,3 @@ let hash = 0; | ||
exports.loseCode = loseCode; | ||
// noinspection JSUnusedGlobalSymbols | ||
function encodeHtmlSpecials(str) { | ||
@@ -206,2 +258,3 @@ let i = str.length; | ||
exports.encodeHtmlSpecials = encodeHtmlSpecials; | ||
// noinspection JSUnusedGlobalSymbols | ||
function createReadStream(object, options = {}) { | ||
@@ -211,2 +264,3 @@ return new MultiStream(object, options); | ||
exports.createReadStream = createReadStream; | ||
// noinspection JSUnusedGlobalSymbols | ||
function readStreamToBuffer(stream, maxSize = 0) { | ||
@@ -239,2 +293,3 @@ return new Promise((res, rej) => { | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
_read() { | ||
@@ -241,0 +296,0 @@ this.push(this.object); |
65
index.ts
@@ -7,2 +7,9 @@ import {Readable} from 'stream'; | ||
} | ||
/** | ||
* | ||
* @deprecated Extremally slow on Proxy/getters | ||
* @param x | ||
* @param y | ||
*/ | ||
export function objectEquals(x:any, y:any):boolean { | ||
@@ -31,2 +38,8 @@ if (x === null || x === undefined || y === null || y === undefined) { | ||
} | ||
/** | ||
* Flattens array | ||
* @param array | ||
* @param result | ||
*/ | ||
export function flatten(array:any[], result:any[] = []):any[] { | ||
@@ -46,5 +59,16 @@ for (let i = 0; i < array.length; i++) { | ||
} | ||
/** | ||
* @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 { | ||
@@ -71,2 +95,7 @@ let out:any; | ||
} | ||
/** | ||
* @deprecated | ||
* @param values | ||
*/ | ||
export function createPrivateEnum(...values:string[]):{[key:string]:Symbol} { | ||
@@ -78,2 +107,11 @@ let returnObj:any = {}; | ||
} | ||
/** | ||
* @deprecated | ||
* @param string | ||
* @param length | ||
* @param insertPre | ||
* @param symbol | ||
*/ | ||
// noinspection JSUnusedGlobalSymbols | ||
export function fixLength(string:string, length:number, insertPre = false, symbol = ' ') { | ||
@@ -89,2 +127,9 @@ return insertPre?string.padStart(length,symbol):string.padEnd(length,symbol); | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @deprecated Object.entrys | ||
* @param object | ||
* @param cb | ||
*/ | ||
export function objectMap(object:any,cb:(a:any,b:any,c:any)=>any):any{ | ||
@@ -98,2 +143,9 @@ let ret = []; | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @deprecated Object.entrys | ||
* @param keys | ||
* @param values | ||
*/ | ||
export function arrayKVObject(keys:string[],values:any[]):any{ | ||
@@ -114,2 +166,3 @@ let len=keys.length; | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
@@ -129,4 +182,6 @@ * Like iterable.map(cb), | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* Convert callback function to async | ||
* @deprecated Existst in node utils | ||
* @param cbFunction Function to convert | ||
@@ -145,2 +200,3 @@ */ | ||
// noinspection JSUnusedGlobalSymbols | ||
export function hashCode(s:string){ | ||
@@ -156,2 +212,3 @@ let hash = 0; | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
export function djb2Code(str:string){ | ||
@@ -165,2 +222,3 @@ let hash = 5381; | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
export function sdbmCode(str:string){ | ||
@@ -174,2 +232,3 @@ let hash = 0; | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
export function loseCode(str:string){ | ||
@@ -183,2 +242,3 @@ let hash = 0; | ||
// noinspection JSUnusedGlobalSymbols | ||
export function encodeHtmlSpecials(str:string){ | ||
@@ -199,2 +259,3 @@ let i = str.length; | ||
// noinspection JSUnusedGlobalSymbols | ||
export function createReadStream(object:Buffer, options = {}):MultiStream { | ||
@@ -204,2 +265,3 @@ return new MultiStream(object, options); | ||
// noinspection JSUnusedGlobalSymbols | ||
export function readStreamToBuffer(stream:Readable,maxSize:number=0): Promise<Buffer> { | ||
@@ -230,3 +292,3 @@ return new Promise((res, rej) => { | ||
export class MultiStream extends Readable { | ||
private object:Buffer; | ||
private object:Buffer|null; | ||
constructor(object:Buffer, options:IMultiStreamOptions = {}) { | ||
@@ -240,2 +302,3 @@ super({ | ||
// noinspection JSUnusedGlobalSymbols | ||
_read() { | ||
@@ -242,0 +305,0 @@ this.push(this.object); |
{ | ||
"name": "@meteor-it/utils", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "Many useful utils", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "56ab0de7c3db60075719e4223e1f8fee31427a0a" | ||
"gitHead": "4c42fd3e8ab0dbba17ca3090f20bf46a1f2dd9e8" | ||
} |
Sorry, the diff of this file is not supported yet
25696
596