Comparing version 1.0.4 to 1.0.5
class Wrapp { | ||
strE = s => new Uint8Array([...s].map(e => e.charCodeAt())) | ||
StrE = s => [...s].map(e => e.charCodeAt()) | ||
ItB = n => n.toString(2) | ||
BtI = n => +('0b' + n) | ||
Check = a => a.pop ? true : console.error(new Error('Argument must be array')) | ||
Check = a => a.pop ? true : console.error(new Error `Argument must be array`) | ||
Rand(i = 1) { | ||
@@ -17,13 +17,9 @@ let arr = [], | ||
} | ||
/*-----------------------------------------------------------------------------------*/ | ||
decodeArr(Arr) { | ||
return [...Arr].map(e => e.pop ? this.decodeArr(e) : String.fromCharCode(e)) | ||
Pr = e => { | ||
let x = e >> 8, | ||
y = this.ItB(x).length - 8 | ||
return x ^ x >> y << y | ||
} | ||
smartCheck(Arr) { | ||
return [...Arr].map(e => e.pop ? e.every(t => typeof t == 'string') ? e.join('') : this.smartCheck(e) : e) | ||
} | ||
decodeArr = Arr => [...Arr].map(e => e.pop ? this.decodeArr(e) : String.fromCharCode(e)) | ||
smartCheck = Arr => [...Arr].map(e => e.pop ? e.every(t => typeof t == 'string') ? e.join `` : this.smartCheck(e) : e) | ||
arrayWrap(Arr) { | ||
@@ -43,18 +39,8 @@ this.Check(Arr) | ||
} | ||
stringWrap(str) { | ||
return this.arrayWrap([...this.strE(str)]) | ||
} | ||
unWrap(Arr) { | ||
return [...Arr].map(e => e.pop ? this.unWrap(e) : this.BtI((e >> 8).toString(2).slice(8))) | ||
} | ||
unWrapString(Arr) { | ||
return this.smartCheck([this.decodeArr(this.unWrap(Arr))]) | ||
} | ||
stringWrap = str => this.arrayWrap(this.StrE(str)) | ||
unWrap = Arr => [...Arr].map(e => e.pop ? this.unWrap(e) : this.Pr(e)) | ||
unWrapString = Arr => this.smartCheck([this.decodeArr(this.unWrap(Arr))]) | ||
smartWrap(Arr) { | ||
this.Check(Arr) | ||
let tarr = [...Arr].map(e => { | ||
return [...Arr].map(e => { | ||
switch (typeof e) { | ||
@@ -70,3 +56,3 @@ case 'object': | ||
case 'number': | ||
return this.BtI(this.ItB(e) + this.ItB(this.Rand()[0]).padEnd(16, '0')) | ||
return [...this.arrayWrap([e])][0] | ||
default: | ||
@@ -76,3 +62,2 @@ return 0; | ||
}) | ||
return tarr | ||
} | ||
@@ -79,0 +64,0 @@ } |
{ | ||
"name": "bitwrap", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A lightweight steganographic npm library.", | ||
@@ -5,0 +5,0 @@ "main": "bitwrap.js", |
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
3827
60