@azury/byte
Advanced tools
Comparing version 3.2.0-dev.0 to 3.2.0
@@ -1,1 +0,89 @@ | ||
var byte=(()=>{var g=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var f=(B,b)=>{for(var r in b)g(B,r,{get:b[r],enumerable:!0})},Z=(B,b,r,a)=>{if(b&&typeof b=="object"||typeof b=="function")for(let i of T(b))!P.call(B,i)&&i!==r&&g(B,i,{get:()=>b[i],enumerable:!(a=K(b,i))||a.enumerable});return B};var Y=B=>Z(g({},"__esModule",{value:!0}),B);var c={};f(c,{default:()=>$});var l=11805916207174113e5,E=l*1024,s=[["B","Byte",1],["KB","Kilobyte",1e3],["MB","Megabyte",1e6],["GB","Gigabyte",1e9],["TB","Terabyte",1e12],["PB","Petabyte",1e15],["EB","Exabyte",1e18],["ZB","Zettabyte",1e21],["YB","Yottabyte",1e24],["KiB","Kibibyte",1024],["MiB","Mebibyte",1048576],["GiB","Gibibyte",1073741824],["TiB","Tebibyte",1099511627776],["PiB","Pebibyte",0x4000000000000],["EiB","Exbibyte",1152921504606847e3],["ZiB","Zebibyte",l],["YiB","Yobibyte",E]];function x(B,b){let r=b?.long??!1,a=b?.format==="array",i=b?.prefix==="binary";if(typeof B=="number"){let y=B.toString(),t=y.length,n=(u,o)=>+(Math.round(+(u+"e"+o))+"e"+-o),e=(u,o,G)=>{let m=n(B/u,2),M=r?`${o}${m>1?"s":""}`:G;return a?[m,M]:`${m} ${M}`};return t>=4&&t<7?i?e(1024,"Kibibyte","KiB"):e(1e3,"Kilobyte","KB"):t>=7&&t<10?i?e(1048576,"Mebibyte","MiB"):e(1e6,"Megabyte","MB"):t>=10&&t<13?i?e(1073741824,"Gibibyte","GiB"):e(1e9,"Gigabyte","GB"):t>=13&&t<16?i?e(1099511627776,"Tebibyte","TiB"):e(1e12,"Terabyte","TB"):t>=16&&t<19?i?e(0x4000000000000,"Pebibyte","PiB"):e(1e15,"Petabyte","PB"):t>=19&&t<22?i?e(1152921504606847e3,"Exbibyte","EiB"):e(1e18,"Exabyte","EB"):t>=22&&t<25?i?e(l,"Zebibyte","ZiB"):e(1e21,"Zettabyte","ZB"):t>=25?i?e(E,"Yobibyte","YiB"):e(1e24,"Yottabyte","YB"):e(1,"Byte","B")}else{let y=B.split(" ");if(y.length!==2)return-1;y[1].endsWith("s")&&(y[1]=y[1].slice(0,-1));let t=s.length,n=0,e=-1;for(;n<t;)(y[1]===s[n][0]||y[1]===s[n][1])&&(e=parseInt(y[0])*s[n][2]),n++;return e}}var $=x;return Y(c);})().default; | ||
var byte = (() => { | ||
var g = Object.defineProperty | ||
var K = Object.getOwnPropertyDescriptor | ||
var T = Object.getOwnPropertyNames | ||
var P = Object.prototype.hasOwnProperty | ||
var f = (B, b) => { | ||
for (var r in b) g(B, r, { get: b[r], enumerable: !0 }) | ||
}, | ||
Z = (B, b, r, a) => { | ||
if (b && typeof b == 'object' || typeof b == 'function') { | ||
for (let i of T(b)) { | ||
!P.call(B, i) && i !== r && | ||
g(B, i, { | ||
get: () => b[i], | ||
enumerable: !(a = K(b, i)) || a.enumerable, | ||
}) | ||
} | ||
} | ||
return B | ||
} | ||
var Y = (B) => Z(g({}, '__esModule', { value: !0 }), B) | ||
var c = {} | ||
f(c, { default: () => $ }) | ||
var l = 11805916207174113e5, | ||
E = l * 1024, | ||
s = [ | ||
['B', 'Byte', 1], | ||
['KB', 'Kilobyte', 1e3], | ||
['MB', 'Megabyte', 1e6], | ||
['GB', 'Gigabyte', 1e9], | ||
['TB', 'Terabyte', 1e12], | ||
['PB', 'Petabyte', 1e15], | ||
['EB', 'Exabyte', 1e18], | ||
['ZB', 'Zettabyte', 1e21], | ||
['YB', 'Yottabyte', 1e24], | ||
['KiB', 'Kibibyte', 1024], | ||
['MiB', 'Mebibyte', 1048576], | ||
['GiB', 'Gibibyte', 1073741824], | ||
['TiB', 'Tebibyte', 1099511627776], | ||
['PiB', 'Pebibyte', 0x4000000000000], | ||
['EiB', 'Exbibyte', 1152921504606847e3], | ||
['ZiB', 'Zebibyte', l], | ||
['YiB', 'Yobibyte', E], | ||
] | ||
function x(B, b) { | ||
let r = b?.long ?? !1, a = b?.format === 'array', i = b?.prefix === 'binary' | ||
if (typeof B == 'number') { | ||
let y = B.toString(), | ||
t = y.length, | ||
n = (u, o) => +(Math.round(+(u + 'e' + o)) + 'e' + -o), | ||
e = (u, o, G) => { | ||
let m = n(B / u, 2), M = r ? `${o}${m > 1 ? 's' : ''}` : G | ||
return a ? [m, M] : `${m} ${M}` | ||
} | ||
return t >= 4 && t < 7 | ||
? i ? e(1024, 'Kibibyte', 'KiB') : e(1e3, 'Kilobyte', 'KB') | ||
: t >= 7 && t < 10 | ||
? i ? e(1048576, 'Mebibyte', 'MiB') : e(1e6, 'Megabyte', 'MB') | ||
: t >= 10 && t < 13 | ||
? i ? e(1073741824, 'Gibibyte', 'GiB') : e(1e9, 'Gigabyte', 'GB') | ||
: t >= 13 && t < 16 | ||
? i ? e(1099511627776, 'Tebibyte', 'TiB') : e(1e12, 'Terabyte', 'TB') | ||
: t >= 16 && t < 19 | ||
? i ? e(0x4000000000000, 'Pebibyte', 'PiB') : e(1e15, 'Petabyte', 'PB') | ||
: t >= 19 && t < 22 | ||
? i | ||
? e(1152921504606847e3, 'Exbibyte', 'EiB') | ||
: e(1e18, 'Exabyte', 'EB') | ||
: t >= 22 && t < 25 | ||
? i ? e(l, 'Zebibyte', 'ZiB') : e(1e21, 'Zettabyte', 'ZB') | ||
: t >= 25 | ||
? i ? e(E, 'Yobibyte', 'YiB') : e(1e24, 'Yottabyte', 'YB') | ||
: e(1, 'Byte', 'B') | ||
} else { | ||
let y = B.split(' ') | ||
if (y.length !== 2) return -1 | ||
y[1].endsWith('s') && (y[1] = y[1].slice(0, -1)) | ||
let t = s.length, n = 0, e = -1 | ||
for (; n < t;) { | ||
;(y[1] === s[n][0] || y[1] === s[n][1]) && | ||
(e = parseInt(y[0]) * s[n][2]), | ||
n++ | ||
} | ||
return e | ||
} | ||
} | ||
var $ = x | ||
return Y(c) | ||
})().default |
{ | ||
"name": "@azury/byte", | ||
"version": "3.2.0-dev.0", | ||
"version": "3.2.0", | ||
"author": "Samuel Kopp (https://samuelkopp.de)", | ||
@@ -10,17 +10,4 @@ "license": "Apache-2.0", | ||
"types": "byte.d.ts", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"default": "./byte.js", | ||
"types": "./byte.d.ts" | ||
}, | ||
"require": { | ||
"default": "./byte.cjs", | ||
"types": "./byte.d.ts" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
"byte.js", | ||
"byte.cjs", | ||
"byte.iife.js", | ||
@@ -27,0 +14,0 @@ "byte.d.ts" |
@@ -8,3 +8,3 @@ ## byte | ||
```ts | ||
import byte from 'https://deno.land/x/byte@v3.1.0/byte.ts' | ||
import byte from 'https://deno.land/x/byte@v3.2.0/byte.ts' | ||
``` | ||
@@ -11,0 +11,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
162
1
0
18225
6