first commit
This commit is contained in:
24
build/node_modules/pretty-bytes/index.js
generated
vendored
Normal file
24
build/node_modules/pretty-bytes/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
const UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
|
||||
module.exports = num => {
|
||||
if (!Number.isFinite(num)) {
|
||||
throw new TypeError(`Expected a finite number, got ${typeof num}: ${num}`);
|
||||
}
|
||||
|
||||
const neg = num < 0;
|
||||
|
||||
if (neg) {
|
||||
num = -num;
|
||||
}
|
||||
|
||||
if (num < 1) {
|
||||
return (neg ? '-' : '') + num + ' B';
|
||||
}
|
||||
|
||||
const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), UNITS.length - 1);
|
||||
const numStr = Number((num / Math.pow(1000, exponent)).toPrecision(3));
|
||||
const unit = UNITS[exponent];
|
||||
|
||||
return (neg ? '-' : '') + numStr + ' ' + unit;
|
||||
};
|
||||
21
build/node_modules/pretty-bytes/license
generated
vendored
Normal file
21
build/node_modules/pretty-bytes/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
70
build/node_modules/pretty-bytes/package.json
generated
vendored
Normal file
70
build/node_modules/pretty-bytes/package.json
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"_from": "pretty-bytes@^4.0.2",
|
||||
"_id": "pretty-bytes@4.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=",
|
||||
"_location": "/pretty-bytes",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "pretty-bytes@^4.0.2",
|
||||
"name": "pretty-bytes",
|
||||
"escapedName": "pretty-bytes",
|
||||
"rawSpec": "^4.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sw-precache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
|
||||
"_shasum": "b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9",
|
||||
"_spec": "pretty-bytes@^4.0.2",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/sw-precache",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/pretty-bytes/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Convert bytes to a human readable string: 1337 → 1.34 kB",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/pretty-bytes#readme",
|
||||
"keywords": [
|
||||
"pretty",
|
||||
"bytes",
|
||||
"byte",
|
||||
"filesize",
|
||||
"size",
|
||||
"file",
|
||||
"human",
|
||||
"humanized",
|
||||
"readable",
|
||||
"si",
|
||||
"data"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "pretty-bytes",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/pretty-bytes.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "4.0.2"
|
||||
}
|
||||
40
build/node_modules/pretty-bytes/readme.md
generated
vendored
Normal file
40
build/node_modules/pretty-bytes/readme.md
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# pretty-bytes [](https://travis-ci.org/sindresorhus/pretty-bytes)
|
||||
|
||||
> Convert bytes to a human readable string: `1337` → `1.34 kB`
|
||||
|
||||
Useful for displaying file sizes for humans.
|
||||
|
||||
-
|
||||
|
||||
*Note that it uses base-10 (e.g. kilobyte).
|
||||
[Read about the difference between kilobyte and kibibyte.](http://pacoup.com/2009/05/26/kb-kb-kib-whats-up-with-that/)*
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save pretty-bytes
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const prettyBytes = require('pretty-bytes');
|
||||
|
||||
prettyBytes(1337);
|
||||
//=> '1.34 kB'
|
||||
|
||||
prettyBytes(100);
|
||||
//=> '100 B'
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [pretty-bytes-cli](https://github.com/sindresorhus/pretty-bytes-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user