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blxuLyoqXG4gKiBAZGVwcmVjYXRlZFxuICogQHBhcmFtIGFycmF5MVxuICogQHBhcmFtIGFycmF5MlxuICovXG5leHBvcnQgZnVuY3Rpb24gbWl4KGFycmF5MTphbnlbXXxPYmplY3QsIGFycmF5MjphbnlbXXxPYmplY3QpOmFueSB7XG4gICAgbGV0IG91dDphbnk7XG4gICAgaWYgKGFycmF5MSBpbnN0YW5jZW9mIEFycmF5KSB7XG4gICAgICAgIG91dCA9IFtdO1xuICAgICAgICBmb3IgKGxldCBpbmRleCBpbiBhcnJheTEpIHtcbiAgICAgICAgICAgIG91dC5wdXNoKFthcnJheTFbaW5kZXhdLCAoYXJyYXkyIGFzIGFueSlbaW5kZXhdXSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG91dDtcbiAgICB9ZWxzZSB7XG4gICAgICAgIG91dD17fTtcbiAgICAgICAgZm9yKGxldCBrZXkgaW4gYXJyYXkxKXtcbiAgICAgICAgICAgIC8vIG5vaW5zcGVjdGlvbiBKU1VuZmlsdGVyZWRGb3JJbkxvb3BcbiAgICAgICAgICAgIG91dFtrZXldPShhcnJheTEgYXMgYW55KVtrZXldO1xuICAgICAgICB9XG4gICAgICAgIGZvcihsZXQga2V5IGluIGFycmF5Mil7XG4gICAgICAgICAgICAvLyBub2luc3BlY3Rpb24gSlNVbmZpbHRlcmVkRm9ySW5Mb29wXG4gICAgICAgICAgICBvdXRba2V5XT0oYXJyYXkyIGFzIGFueSlba2V5XTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gb3V0O1xuICAgIH1cbn1cblxuLyoqXG4gKiBAZGVwcmVjYXRlZFxuICogQHBhcmFtIHZhbHVlc1xuICovXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlUHJpdmF0ZUVudW0oLi4udmFsdWVzOnN0cmluZ1tdKTp7W2tleTpzdHJpbmddOlN5bWJvbH0ge1xuICAgIGxldCByZXR1cm5PYmo6YW55ID0ge307XG4gICAgdmFsdWVzLm1hcCh2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y8gbm9pbnNwZWN0aW9uIEpTVW51c2VkR2xvYmFsU3ltYm9sc1xuZXhwb3J0IGZ1bmN0aW9uIGVuY29kZUh0bWxTcGVjaWFscyhzdHI6IHN0cmluZykge1xuICAgIGxldCBpID0gc3RyLmxlbmd0aDtcbiAgICBsZXQgYVJldCA9IFtdO1xuXG4gICAgd2hpbGUgKGktLSkge1xuICAgICAgICBsZXQgaUMgPSBzdHJbaV0uY2hhckNvZGVBdCgwKTtcbiAgICAgICAgaWYgKGlDIDwgNjUgfHwgaUMgPiAxMjcgfHwgKGlDID4gOTAgJiYgaUMgPCA5NykpIHtcbiAgICAgICAgICAgIGFSZXRbaV0gPSAnJiMnICsgaUMgKyAnOyc7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBhUmV0W2ldID0gc3RyW2ldO1xuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiBhUmV0LmpvaW4oJycpO1xufSJdfQ== |
112
index.ts
// hello, world => Hello, world! | ||
export function firstUppercase(str:string):string { | ||
return str.substr(0,1).toUpperCase()+str.substr(1); | ||
export function firstUppercase(str: string): string { | ||
return str.substr(0, 1).toUpperCase() + str.substr(1); | ||
} | ||
@@ -12,3 +12,3 @@ | ||
*/ | ||
export function objectEquals(x:any, y:any):boolean { | ||
export function objectEquals(x: any, y: any): boolean { | ||
if (x === null || x === undefined || y === null || y === undefined) { | ||
@@ -42,3 +42,3 @@ return x === y; | ||
*/ | ||
export function flatten(array:any[], result:any[] = []):any[] { | ||
export function flatten(array: any[], result: any[] = []): any[] { | ||
for (let i = 0; i < array.length; i++) { | ||
@@ -62,3 +62,3 @@ const value = array[i]; | ||
*/ | ||
export function removeDuplicates<T>(array:T[]):T[] { | ||
export function removeDuplicates<T>(array: T[]): T[] { | ||
return Array.from(new Set(array)); | ||
@@ -72,4 +72,4 @@ } | ||
*/ | ||
export function mix(array1:any[]|Object, array2:any[]|Object):any { | ||
let out:any; | ||
export function mix(array1: any[] | Object, array2: any[] | Object): any { | ||
let out: any; | ||
if (array1 instanceof Array) { | ||
@@ -81,11 +81,11 @@ out = []; | ||
return out; | ||
}else { | ||
out={}; | ||
for(let key in array1){ | ||
} else { | ||
out = {}; | ||
for (let key in array1) { | ||
// noinspection JSUnfilteredForInLoop | ||
out[key]=(array1 as any)[key]; | ||
out[key] = (array1 as any)[key]; | ||
} | ||
for(let key in array2){ | ||
for (let key in array2) { | ||
// noinspection JSUnfilteredForInLoop | ||
out[key]=(array2 as any)[key]; | ||
out[key] = (array2 as any)[key]; | ||
} | ||
@@ -100,4 +100,4 @@ return out; | ||
*/ | ||
export function createPrivateEnum(...values:string[]):{[key:string]:Symbol} { | ||
let returnObj:any = {}; | ||
export function createPrivateEnum(...values: string[]): { [key: string]: Symbol } { | ||
let returnObj: any = {}; | ||
values.map(value => value.toUpperCase()); | ||
@@ -116,4 +116,4 @@ values.forEach(value => returnObj[value] = Symbol(value)); | ||
// noinspection JSUnusedGlobalSymbols | ||
export function fixLength(string:string, length:number, insertPre = false, symbol = ' ') { | ||
return insertPre?string.padStart(length,symbol):string.padEnd(length,symbol); | ||
export function fixLength(string: string, length: number, insertPre = false, symbol = ' ') { | ||
return insertPre ? string.padStart(length, symbol) : string.padEnd(length, symbol); | ||
} | ||
@@ -124,3 +124,3 @@ | ||
interface ObjectConstructor { | ||
values(object:any):any; | ||
values(object: any): any; | ||
} | ||
@@ -135,8 +135,8 @@ } | ||
*/ | ||
export function objectMap(object:any,cb:(a:any,b:any,c:any)=>any):any{ | ||
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)); | ||
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; | ||
@@ -151,15 +151,15 @@ } | ||
*/ | ||
export function arrayKVObject(keys:string[],values:any[]):any{ | ||
let len=keys.length; | ||
if(len!==values.length) | ||
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]; | ||
let result: any = {}; | ||
for (let i = 0; i < len; i++) | ||
result[keys[i]] = values[i]; | ||
return result; | ||
} | ||
export function sleep (time:number):Promise<void> { | ||
return new Promise((res) => { | ||
setTimeout(res, time); | ||
}); | ||
export function sleep(time: number): Promise<void> { | ||
return new Promise((res) => { | ||
setTimeout(res, time); | ||
}); | ||
} | ||
@@ -174,8 +174,8 @@ | ||
*/ | ||
export function asyncEach<T,R>(iterable:T[], cb:(v:T)=>Promise<R>):R[] { | ||
let waitings:any = []; | ||
iterable.forEach(iter => { | ||
waitings.push(cb(iter)); | ||
}); | ||
return <any>Promise.all(waitings); | ||
export function asyncEach<T, R>(iterable: T[], cb: (v: T) => Promise<R>): R[] { | ||
let waitings: any = []; | ||
iterable.forEach(iter => { | ||
waitings.push(cb(iter)); | ||
}); | ||
return <any>Promise.all(waitings); | ||
} | ||
@@ -189,15 +189,15 @@ | ||
*/ | ||
export function cb2promise (cbFunction:any):(...d:any[])=>Promise<any> { | ||
return (...args) => { | ||
return new Promise((res, rej) => { | ||
cbFunction(...args, (err:Error, result:any) => { | ||
if (err) return rej(err); | ||
res(result); | ||
}); | ||
}); | ||
}; | ||
export function cb2promise(cbFunction: any): (...d: any[]) => Promise<any> { | ||
return (...args) => { | ||
return new Promise((res, rej) => { | ||
cbFunction(...args, (err: Error, result: any) => { | ||
if (err) return rej(err); | ||
res(result); | ||
}); | ||
}); | ||
}; | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
export function hashCode(s:string){ | ||
export function hashCode(s: string) { | ||
let hash = 0; | ||
@@ -207,3 +207,3 @@ if (s.length === 0) return hash; | ||
let character = s.charCodeAt(i); | ||
hash = ((hash<<5)-hash)+character; | ||
hash = ((hash << 5) - hash) + character; | ||
hash = hash & hash; | ||
@@ -214,3 +214,3 @@ } | ||
// noinspection JSUnusedGlobalSymbols | ||
export function djb2Code(str:string){ | ||
export function djb2Code(str: string) { | ||
let hash = 5381; | ||
@@ -224,3 +224,3 @@ for (let i = 0; i < str.length; i++) { | ||
// noinspection JSUnusedGlobalSymbols | ||
export function sdbmCode(str:string){ | ||
export function sdbmCode(str: string) { | ||
let hash = 0; | ||
@@ -234,3 +234,3 @@ for (let i = 0; i < str.length; i++) { | ||
// noinspection JSUnusedGlobalSymbols | ||
export function loseCode(str:string){ | ||
export function loseCode(str: string) { | ||
let hash = 0; | ||
@@ -244,3 +244,3 @@ for (let i = 0; i < str.length; i++) { | ||
// noinspection JSUnusedGlobalSymbols | ||
export function encodeHtmlSpecials(str:string){ | ||
export function encodeHtmlSpecials(str: string) { | ||
let i = str.length; | ||
@@ -251,4 +251,4 @@ let aRet = []; | ||
let iC = str[i].charCodeAt(0); | ||
if (iC < 65 || iC > 127 || (iC>90 && iC<97)) { | ||
aRet[i] = '&#'+iC+';'; | ||
if (iC < 65 || iC > 127 || (iC > 90 && iC < 97)) { | ||
aRet[i] = '&#' + iC + ';'; | ||
} else { | ||
@@ -255,0 +255,0 @@ aRet[i] = str[i]; |
{ | ||
"name": "@meteor-it/utils", | ||
"version": "1.3.12", | ||
"version": "1.3.13", | ||
"description": "Many useful utils", | ||
@@ -17,3 +17,3 @@ "module": "index.mjs", | ||
}, | ||
"gitHead": "888982e812786093e95b2103f646c34fdd32abc5" | ||
"gitHead": "13a378ab6afab3cac18cd00dd670900bf81d4a3e" | ||
} |
@@ -45,2 +45,2 @@ "use strict"; | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInhib3Qvbm9kZV9tb2R1bGVzL0BtZXRlb3ItaXQvdXRpbHMvc3RyZWFtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUN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dWx0aVN0cmVhbSBleHRlbmRzIFJlYWRhYmxlIHtcbiAgICBwcml2YXRlIG9iamVjdDogQnVmZmVyIHwgbnVsbDtcbiAgICBjb25zdHJ1Y3RvcihvYmplY3Q6IEJ1ZmZlciwgb3B0aW9uczogSU11bHRpU3RyZWFtT3B0aW9ucyA9IHt9KSB7XG4gICAgICAgIHN1cGVyKHtcbiAgICAgICAgICAgIGhpZ2hXYXRlck1hcms6IG9wdGlvbnMuaGlnaFdhdGVyTWFyayxcbiAgICAgICAgICAgIGVuY29kaW5nOiBvcHRpb25zLmVuY29kaW5nXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLm9iamVjdCA9IG9iamVjdDtcbiAgICB9XG5cbiAgICAvLyBub2luc3BlY3Rpb24gSlNVbnVzZWRHbG9iYWxTeW1ib2xzXG4gICAgX3JlYWQoKSB7XG4gICAgICAgIHRoaXMucHVzaCh0aGlzLm9iamVjdCk7XG4gICAgICAgIHRoaXMub2JqZWN0ID0gbnVsbDtcbiAgICB9XG59XG4iXX0= |
@@ -1,5 +0,5 @@ | ||
import {Readable} from 'stream'; | ||
import { Readable } from 'stream'; | ||
// noinspection JSUnusedGlobalSymbols | ||
export function createReadStream(object:Buffer, options = {}):MultiStream { | ||
export function createReadStream(object: Buffer, options = {}): MultiStream { | ||
return new MultiStream(object, options); | ||
@@ -9,8 +9,8 @@ } | ||
// noinspection JSUnusedGlobalSymbols | ||
export function readStreamToBuffer(stream:Readable,maxSize:number=0): Promise<Buffer> { | ||
export function readStreamToBuffer(stream: Readable, maxSize: number = 0): Promise<Buffer> { | ||
return new Promise((res, rej) => { | ||
const bufs:any = []; | ||
const bufs: any = []; | ||
let size = 0; | ||
stream.on('data', d => { | ||
if(size+d.length>maxSize){ | ||
if (size + d.length > maxSize) { | ||
rej(new Error('Max buffer size exceeded')); | ||
@@ -20,3 +20,3 @@ return; | ||
bufs.push(d); | ||
size+=d.length; | ||
size += d.length; | ||
}); | ||
@@ -26,3 +26,3 @@ stream.on('end', () => { | ||
}); | ||
stream.on('error',rej); | ||
stream.on('error', rej); | ||
}); | ||
@@ -37,4 +37,4 @@ } | ||
export class MultiStream extends Readable { | ||
private object:Buffer|null; | ||
constructor(object:Buffer, options:IMultiStreamOptions = {}) { | ||
private object: Buffer | null; | ||
constructor(object: Buffer, options: IMultiStreamOptions = {}) { | ||
super({ | ||
@@ -41,0 +41,0 @@ highWaterMark: options.highWaterMark, |
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
66591
1062