applying transfer to react app

This commit is contained in:
Tyler Koenig
2021-09-20 16:54:47 -04:00
parent 8819f31dd0
commit c612b7d702
37373 changed files with 3775588 additions and 2871 deletions
+585
View File
@@ -0,0 +1,585 @@
### Changelog
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [6.1.0](https://github.com/avoidwork/filesize.js/compare/6.0.1...6.1.0)
> 22 February 2020
- Adding `exponent` to `object` output, fixes #112 [`#113`](https://github.com/avoidwork/filesize.js/pull/113)
- Merge pull request #113 from avoidwork/exponents [`#112`](https://github.com/avoidwork/filesize.js/issues/112)
- Adding `exponent` to `object` output, fixes #112 [`#112`](https://github.com/avoidwork/filesize.js/issues/112)
- Using `auto-changelog` to generate a formatted changelog, fixes #110 [`#110`](https://github.com/avoidwork/filesize.js/issues/110)
- Updating CHANGELOG [`d1b726a`](https://github.com/avoidwork/filesize.js/commit/d1b726aba6b488c421cd92c04da61256b54d95a1)
- Updating LICENSE [`8acef4c`](https://github.com/avoidwork/filesize.js/commit/8acef4c68ee173ba1dc09cdaf41b014194da7610)
- Create FUNDING.yml [`6eb9744`](https://github.com/avoidwork/filesize.js/commit/6eb9744a6e3de44c450d2aa44b23ec35659a6356)
#### [6.0.1](https://github.com/avoidwork/filesize.js/compare/6.0.0...6.0.1)
> 8 November 2019
- Fixing a regression due to 5.x revert, fixes #111 [`#111`](https://github.com/avoidwork/filesize.js/issues/111)
- Updating CHANGELOG [`48b7e40`](https://github.com/avoidwork/filesize.js/commit/48b7e40aa0996eb863b6521b31b2141bd048b2fd)
### [6.0.0](https://github.com/avoidwork/filesize.js/compare/5.0.3...6.0.0)
> 31 October 2019
- This reverts commit 1263ce4990ea3219c4b14aa2a8e941869dd808fc, reversing [`#104`](https://github.com/avoidwork/filesize.js/pull/104)
- This reverts commit 3a088db57570ff352eb9a33ccdcb9d07c9fcb04d, reversing [`#106`](https://github.com/avoidwork/filesize.js/pull/106)
- Create FUNDING.yml [`#106`](https://github.com/avoidwork/filesize.js/pull/106)
- Revert "Fixing the hackish type definition, fixes #105" [`#105`](https://github.com/avoidwork/filesize.js/issues/105)
- Reverting modern build as it's too problematic at this time, major version bump to roll forward [`71a9ead`](https://github.com/avoidwork/filesize.js/commit/71a9ead9ed03e0701728cdf1007271502c442808)
- Updating `CHANGELOG` [`5b88732`](https://github.com/avoidwork/filesize.js/commit/5b88732fa45242413fc96dc14afdde8938251d54)
#### [5.0.3](https://github.com/avoidwork/filesize.js/compare/5.0.2...5.0.3)
> 8 October 2019
- Reformatting CHANGELOG [`fd76462`](https://github.com/avoidwork/filesize.js/commit/fd76462817b484f7a87cd1263a07e82d9e0f4400)
- Removing `.npmignore` [`7b15687`](https://github.com/avoidwork/filesize.js/commit/7b15687c0af9e716ab141e826fab16934f9b2c9e)
- Updating CHANGELOG [`72968fa`](https://github.com/avoidwork/filesize.js/commit/72968fa5fbcf87654b9bb6606870f1518c5f24e9)
#### [5.0.2](https://github.com/avoidwork/filesize.js/compare/5.0.1...5.0.2)
> 7 October 2019
- git-log based CHANGELOG via `npm run changelog` [`d8415f5`](https://github.com/avoidwork/filesize.js/commit/d8415f51e4432a9cec3ea6f95db5c4b1b813e1d6)
- Adding CHANGELOG to `.npmignore` with minor version bump to prep for changes [`2a9e78d`](https://github.com/avoidwork/filesize.js/commit/2a9e78dcc03c6f0fc42a6b80207686d73e5badcd)
#### [5.0.1](https://github.com/avoidwork/filesize.js/compare/5.0.0...5.0.1)
> 1 October 2019
- Fixing the hackish type definition, fixes #105 [`#105`](https://github.com/avoidwork/filesize.js/issues/105)
### [5.0.0](https://github.com/avoidwork/filesize.js/compare/4.2.1...5.0.0)
> 1 October 2019
- Modernizing build & outputs [`#104`](https://github.com/avoidwork/filesize.js/pull/104)
- Updating `.npmignore` [`5715622`](https://github.com/avoidwork/filesize.js/commit/5715622929108ec6534223ad579d21702a880efe)
- Updating typescript module definition [`2e3d1bb`](https://github.com/avoidwork/filesize.js/commit/2e3d1bb20751e3d25057bb6ef91f66a737057380)
#### [4.2.1](https://github.com/avoidwork/filesize.js/compare/4.2.0...4.2.1)
> 25 September 2019
- Fixing case where rounding results in the wrong exponent, fixes #103 [`#103`](https://github.com/avoidwork/filesize.js/issues/103)
- Updating travis-ci.org config [`5b362af`](https://github.com/avoidwork/filesize.js/commit/5b362afb7dbdc67bc39606b9ca4c5f7ca2bcdab4)
#### [4.2.0](https://github.com/avoidwork/filesize.js/compare/4.1.2...4.2.0)
> 11 September 2019
- Add support for localeOptions option: allow customization of i18n output [`#102`](https://github.com/avoidwork/filesize.js/pull/102)
- Bump mixin-deep from 1.3.1 to 1.3.2 [`#101`](https://github.com/avoidwork/filesize.js/pull/101)
- Bump eslint-utils from 1.3.1 to 1.4.2 [`#99`](https://github.com/avoidwork/filesize.js/pull/99)
- Updating dependencies, version bump to release #102 [`ab80f87`](https://github.com/avoidwork/filesize.js/commit/ab80f877f0ff98fec7bd31becbc23540ff7956ab)
- add support for localeOptions [`6505945`](https://github.com/avoidwork/filesize.js/commit/6505945d09c279cb05bca5a5698f55f1c7714eb5)
- build [`b9f7fb4`](https://github.com/avoidwork/filesize.js/commit/b9f7fb4c9a26c9098e18f8c0521d574e80b13327)
#### [4.1.2](https://github.com/avoidwork/filesize.js/compare/4.1.1...4.1.2)
> 15 February 2019
- Refactoring `locale` option to accept `String` or `Boolean` values, re-organizing code such that an `exponent` output skips unneeded ops [`dd8f754`](https://github.com/avoidwork/filesize.js/commit/dd8f7546dfe7d62977fdc184321e9413ab22a086)
#### [4.1.1](https://github.com/avoidwork/filesize.js/compare/4.1.0...4.1.1)
> 13 February 2019
- Fixing order of ops that could've impacted `object` output [`3b71615`](https://github.com/avoidwork/filesize.js/commit/3b71615b50e580a3c70a9419ad46b7d44ce63782)
#### [4.1.0](https://github.com/avoidwork/filesize.js/compare/4.0.0...4.1.0)
> 13 February 2019
- Adding `locale` option which overrides `separator`, fixes #96 [`#96`](https://github.com/avoidwork/filesize.js/issues/96)
### [4.0.0](https://github.com/avoidwork/filesize.js/compare/3.6.1...4.0.0)
> 12 January 2019
- Removing deprecated `suffixes` option with a major version bump, updating README & LICENSE copyrights, updating dev dependencies [`a0b268f`](https://github.com/avoidwork/filesize.js/commit/a0b268f8b127cfc9327de53a489aad2b2a01dcb1)
- Updating README [`81e5499`](https://github.com/avoidwork/filesize.js/commit/81e5499ba4d4e80c39d2d10d9fa88be1a410f1eb)
- Updating travis-ci.org configuration [`5bcc3c4`](https://github.com/avoidwork/filesize.js/commit/5bcc3c4a47b2dd73ace38488d39b7b2c0a9ef125)
#### [3.6.1](https://github.com/avoidwork/filesize.js/compare/3.6.0...3.6.1)
> 24 March 2018
- Including ES6 version with `npm install`, updating grunt build such that more files are linted [`fb9bd3e`](https://github.com/avoidwork/filesize.js/commit/fb9bd3e7e2964d056f6f3beee574053b2dbeb297)
- oops [`dc04050`](https://github.com/avoidwork/filesize.js/commit/dc040503091484272f182c97d1562188581b2b23)
#### [3.6.0](https://github.com/avoidwork/filesize.js/compare/3.5.11...3.6.0)
> 3 February 2018
- Adding `separator` option, fixes #93 [`#93`](https://github.com/avoidwork/filesize.js/issues/93)
#### [3.5.11](https://github.com/avoidwork/filesize.js/compare/3.5.10...3.5.11)
> 18 October 2017
- Add CDNJS version badge in README.md [`#90`](https://github.com/avoidwork/filesize.js/pull/90)
- Updating build dependencies, travis-ci.org config, fixing banner alignment in uglify output [`20baedd`](https://github.com/avoidwork/filesize.js/commit/20baeddd23b737ac87932484c0026a1e77c87fc8)
#### [3.5.10](https://github.com/avoidwork/filesize.js/compare/3.5.9...3.5.10)
> 19 May 2017
- Updating `uglify` dependency [`b93909e`](https://github.com/avoidwork/filesize.js/commit/b93909e5ae236d091f162b4ea77bc2e9805eec3a)
- Fucking webstorm!!!! [`7c172ea`](https://github.com/avoidwork/filesize.js/commit/7c172eac941e0dd460229ca769f121cfd75b86be)
#### [3.5.9](https://github.com/avoidwork/filesize.js/compare/3.5.8...3.5.9)
> 30 April 2017
- Removing loader script as it apparently breaks browserify/webpack loading (sigh) [`54d9770`](https://github.com/avoidwork/filesize.js/commit/54d977032d8332daac810332796e62898f360b5b)
#### [3.5.8](https://github.com/avoidwork/filesize.js/compare/3.5.7...3.5.8)
> 29 April 2017
- Adding `index.js` to load es5 or es6 depending on the test environment [`0e07bba`](https://github.com/avoidwork/filesize.js/commit/0e07bbae8ab619c071694ef9bf885c3c57be7521)
#### [3.5.7](https://github.com/avoidwork/filesize.js/compare/3.5.6...3.5.7)
> 29 April 2017
- Adding `babili` task to minify the es6 file, fixes #86 [`#86`](https://github.com/avoidwork/filesize.js/issues/86)
#### [3.5.6](https://github.com/avoidwork/filesize.js/compare/3.5.5...3.5.6)
> 7 March 2017
- Building missing files, updating README [`77db546`](https://github.com/avoidwork/filesize.js/commit/77db5467b33a5ae44d1dec83bcbbbd58732cd815)
#### [3.5.5](https://github.com/avoidwork/filesize.js/compare/3.5.4...3.5.5)
> 24 February 2017
- Changing things such that you can do `filesize(0, {exponent: n})` and get the correct result, adding a test, fixes #85 [`#85`](https://github.com/avoidwork/filesize.js/issues/85)
- Updating example in README [`7c75121`](https://github.com/avoidwork/filesize.js/commit/7c75121420abb6a3c855b96cb7552cda7ae7e1f4)
- Updating example in README [`1f6c51f`](https://github.com/avoidwork/filesize.js/commit/1f6c51f1e456a43a7f82fb15a4fe9aa919b34dfa)
#### [3.5.4](https://github.com/avoidwork/filesize.js/compare/3.5.3...3.5.4)
> 25 January 2017
- Adding `fullforms` for overriding full form [`727db07`](https://github.com/avoidwork/filesize.js/commit/727db07732c8803e89c874743cd3d5a6ba7f7d8e)
#### [3.5.3](https://github.com/avoidwork/filesize.js/compare/3.5.2...3.5.3)
> 25 January 2017
- Fixing `0 bytes` [`d957df3`](https://github.com/avoidwork/filesize.js/commit/d957df3e3484b28470b008da45f1a34d54b85c0d)
#### [3.5.2](https://github.com/avoidwork/filesize.js/compare/3.5.1...3.5.2)
> 25 January 2017
- Updating README [`7bc227e`](https://github.com/avoidwork/filesize.js/commit/7bc227ec811ade1a7e2c58e01546893a2ee42b4c)
#### [3.5.1](https://github.com/avoidwork/filesize.js/compare/3.5.0...3.5.1)
> 24 January 2017
- Correcting `longform` to `fullform` [`1dee34f`](https://github.com/avoidwork/filesize.js/commit/1dee34f85781ccb63691570214e5bd8f1f835871)
#### [3.5.0](https://github.com/avoidwork/filesize.js/compare/3.4.3...3.5.0)
> 24 January 2017
- Adding `longform` flag, fixing markdown in README [`7d8b650`](https://github.com/avoidwork/filesize.js/commit/7d8b65085d6e1436b34eebf6548702d136556d9a)
#### [3.4.3](https://github.com/avoidwork/filesize.js/compare/3.4.2...3.4.3)
> 23 January 2017
- Oops, fixes #84 [`#84`](https://github.com/avoidwork/filesize.js/issues/84)
#### [3.4.2](https://github.com/avoidwork/filesize.js/compare/3.4.1...3.4.2)
> 21 January 2017
- Simplifying `filesize.partial()` & adding a test [`4d1e9ea`](https://github.com/avoidwork/filesize.js/commit/4d1e9ea21b79ca0af901fcc13a3609a44e2ebcc9)
#### [3.4.1](https://github.com/avoidwork/filesize.js/compare/3.4.0...3.4.1)
> 20 January 2017
- Changing a statement to be a little easier to read, updating build status graphic to be SVG for better rendering on various devices [`de2e388`](https://github.com/avoidwork/filesize.js/commit/de2e38839d7e450b7492ecfb9ca5228c1bdbe0e9)
- Updating `travis-ci.org` config 'cause the eslint dep requires es6 engine without a `strictEngine` (so pro) [`c1d40b5`](https://github.com/avoidwork/filesize.js/commit/c1d40b5b38469f7f0cd7aab0ea7357398b323ead)
- Fixing alignment of the example in README [`245aa6d`](https://github.com/avoidwork/filesize.js/commit/245aa6db2e43fb72eb5cb56c24f7423aff531d8d)
#### [3.4.0](https://github.com/avoidwork/filesize.js/compare/3.3.0...3.4.0)
> 19 January 2017
- improve format [`#83`](https://github.com/avoidwork/filesize.js/pull/83)
- Creating `filesize.partial()` for creating a partial application / functional programming style, updating dependencies, fixing lint errors, updating README & LICENSE copyright year, updating README to cover `filesize.partial()` [`1ba7b0c`](https://github.com/avoidwork/filesize.js/commit/1ba7b0cf0ed083da3695c120016fced7ba3cdb97)
- Adding a downloads shield to the README ... 'cause why not [`81bc1d2`](https://github.com/avoidwork/filesize.js/commit/81bc1d239ebc292dfc2e4dfbd54b211566e94c3f)
#### [3.3.0](https://github.com/avoidwork/filesize.js/compare/3.2.1...3.3.0)
> 23 April 2016
- Adding support for IEC standard via new `standard` descriptor property (defaults to `jedec`), fixes #80 [`#80`](https://github.com/avoidwork/filesize.js/issues/80)
- Handling bits, and `base` collision [`70048cb`](https://github.com/avoidwork/filesize.js/commit/70048cbbfbf4b9bab922927b6ea558a081d898cc)
- Minor optimization by looking at the exponent vs the string length [`d795026`](https://github.com/avoidwork/filesize.js/commit/d79502646ea32a7ccbb2767c09b68ea7611df085)
- Updating a comment [`0521336`](https://github.com/avoidwork/filesize.js/commit/0521336aa3e6af6c48b2541b8798138069cb6af7)
#### [3.2.1](https://github.com/avoidwork/filesize.js/compare/3.2.0...3.2.1)
> 30 January 2016
- add test case for huge number [`#76`](https://github.com/avoidwork/filesize.js/pull/76)
- Fixing invalid results for small & large bit values, fixes #77 [`#77`](https://github.com/avoidwork/filesize.js/issues/77)
#### [3.2.0](https://github.com/avoidwork/filesize.js/compare/3.1.6...3.2.0)
> 22 January 2016
- Fixing a poor choice in wording by marking `suffixes` for deprecation & moving to `symbols`, updating README (fixes #72, #73) [`#72`](https://github.com/avoidwork/filesize.js/issues/72)
#### [3.1.6](https://github.com/avoidwork/filesize.js/compare/3.1.5...3.1.6)
> 19 January 2016
- Fixing kilobit & kilobyte symbols by ensuring JEDEC for base 2 & SI for base 10, fixes #69 [`#69`](https://github.com/avoidwork/filesize.js/issues/69)
- Removing `.idea` file from npm, fixes #71 [`#71`](https://github.com/avoidwork/filesize.js/issues/71)
- Updating travis-ci to test node 5.4.x [`df5d39d`](https://github.com/avoidwork/filesize.js/commit/df5d39d4633e4860b2d6f5552fb316f4f183918a)
#### [3.1.5](https://github.com/avoidwork/filesize.js/compare/3.1.4...3.1.5)
> 22 December 2015
- Add bower manifest [`#67`](https://github.com/avoidwork/filesize.js/pull/67)
- Fixing `bit` suffix & updating build to use latest version of babel, fixes #68 [`#68`](https://github.com/avoidwork/filesize.js/issues/68)
- Fixing package.json [`71cc5a5`](https://github.com/avoidwork/filesize.js/commit/71cc5a5314a2efc60590254c532334b7771b7ad6)
#### [3.1.4](https://github.com/avoidwork/filesize.js/compare/3.1.3...3.1.4)
> 13 November 2015
- Correctly check for AMD loader [`#66`](https://github.com/avoidwork/filesize.js/pull/66)
- Version bump [`d60a6e2`](https://github.com/avoidwork/filesize.js/commit/d60a6e280fd764b8ae7d64a064b949a234ddcff8)
#### [3.1.3](https://github.com/avoidwork/filesize.js/compare/3.1.2...3.1.3)
> 27 July 2015
- Update license attribute [`#63`](https://github.com/avoidwork/filesize.js/pull/63)
- Updating the package manifest for npm [`20b4ac4`](https://github.com/avoidwork/filesize.js/commit/20b4ac454f9c6236b6611ddd1b9cbe97d0efbbd2)
#### [3.1.2](https://github.com/avoidwork/filesize.js/compare/3.1.1...3.1.2)
> 28 February 2015
- Removing unneeded nesting of conditionals [`a4448cd`](https://github.com/avoidwork/filesize.js/commit/a4448cdb63d1828c07ae3d2f8e1385d31f693135)
#### [3.1.1](https://github.com/avoidwork/filesize.js/compare/3.1.0...3.1.1)
> 24 February 2015
- Updating to transpiler to `babel` 4.0.0, reformatting some statements for readability, moving `consts` to the top of the lib [`fc3714f`](https://github.com/avoidwork/filesize.js/commit/fc3714fe90a03d05962632b4e513f88e012c236d)
- Updating travis file [`4fd4373`](https://github.com/avoidwork/filesize.js/commit/4fd437335cc6a9750f60362778f30e7f359e3c2a)
#### [3.1.0](https://github.com/avoidwork/filesize.js/compare/3.0.2...3.1.0)
> 4 February 2015
- Add a Gitter chat badge to README.md [`#60`](https://github.com/avoidwork/filesize.js/pull/60)
- Refactored to ES6, with transpiling to ES5 [`f214346`](https://github.com/avoidwork/filesize.js/commit/f214346fb577cf81801a75f60424ba64398e0ad1)
- Update README.md [`db1df8e`](https://github.com/avoidwork/filesize.js/commit/db1df8e9005b29664cd41f48ec397b414bb1b78d)
- Added Gitter badge [`905c6b5`](https://github.com/avoidwork/filesize.js/commit/905c6b5ef804247497a90265b57f589894c17325)
#### [3.0.2](https://github.com/avoidwork/filesize.js/compare/3.0.1...3.0.2)
> 29 January 2015
- Fixing an error in exponent calculation such that `ceil` is utilized & added two tests, fixes #59 [`#59`](https://github.com/avoidwork/filesize.js/issues/59)
#### [3.0.1](https://github.com/avoidwork/filesize.js/compare/3.0.0...3.0.1)
> 12 January 2015
- Adding the ability to specify the `exponent` used for determining the file size, and adding `exponent` as an output value (feature request by email) [`0af5ea1`](https://github.com/avoidwork/filesize.js/commit/0af5ea1a69c97a46d12e24d27440b60f891ea87a)
### [3.0.0](https://github.com/avoidwork/filesize.js/compare/2.0.4...3.0.0)
> 4 January 2015
- Composer support [`#58`](https://github.com/avoidwork/filesize.js/pull/58)
- Refactoring `filesize()` to output `Array` & `Object` shapes, & changing default `base` to `2`, reformatting code based on IDE settings (not included) [`a7fe91b`](https://github.com/avoidwork/filesize.js/commit/a7fe91b78b3b97f08baf97ac52317be0ba2b247a)
- add composer.json [`f53152d`](https://github.com/avoidwork/filesize.js/commit/f53152d43f050e04ece413f59a7baa05f91116bf)
#### [2.0.4](https://github.com/avoidwork/filesize.js/compare/2.0.3...2.0.4)
> 2 October 2014
- Fixes #55 by avoiding type mutation, fixing CI tests by removing node 0.8.x [`#55`](https://github.com/avoidwork/filesize.js/issues/55)
#### [2.0.3](https://github.com/avoidwork/filesize.js/compare/2.0.2...2.0.3)
> 1 March 2014
- Minor change [`#53`](https://github.com/avoidwork/filesize.js/pull/53)
- Adding exabyte, zettabyte, yottabyte, exabit, zettabit, & yottabit sizes [`fd448ab`](https://github.com/avoidwork/filesize.js/commit/fd448abebef3f3e4cf182e316676375dc85d2098)
#### [2.0.2](https://github.com/avoidwork/filesize.js/compare/2.0.1...2.0.2)
> 1 March 2014
- Removing a file [`#52`](https://github.com/avoidwork/filesize.js/pull/52)
- Optimizations [`#51`](https://github.com/avoidwork/filesize.js/pull/51)
- Changing the method of generating `result` [`98f34a1`](https://github.com/avoidwork/filesize.js/commit/98f34a1ff51e35bc8a82aacbeedb0352913c8b49)
- Generating a String instead of an Array for 'unix mode' [`7e46fd9`](https://github.com/avoidwork/filesize.js/commit/7e46fd94b4f43c6d2f48ed7bdc2900cfe2eca8e0)
#### [2.0.1](https://github.com/avoidwork/filesize.js/compare/2.0.0...2.0.1)
> 25 February 2014
- Adding language overriding via optional `suffixes` dictionary [`#49`](https://github.com/avoidwork/filesize.js/pull/49)
### [2.0.0](https://github.com/avoidwork/filesize.js/compare/1.10.0...2.0.0)
> 12 October 2013
- Major refactoring, API change [`#47`](https://github.com/avoidwork/filesize.js/pull/47)
- Initial refactor for 2.0.0 [`c401052`](https://github.com/avoidwork/filesize.js/commit/c401052e10deb8ededcb9a96504444ae52ffd64b)
- Completing 2.0.0 [`09a7dbc`](https://github.com/avoidwork/filesize.js/commit/09a7dbc2caf9e686d0110f9d3ca3176b65ef99f5)
- Updating README [`d68c555`](https://github.com/avoidwork/filesize.js/commit/d68c555102f80586387d926c59b054bbf4f45f5f)
#### [1.10.0](https://github.com/avoidwork/filesize.js/compare/1.9.6...1.10.0)
> 19 July 2013
- Typo [`#42`](https://github.com/avoidwork/filesize.js/pull/42)
- Updating README [`#41`](https://github.com/avoidwork/filesize.js/pull/41)
- Switching to base 10 [`#40`](https://github.com/avoidwork/filesize.js/pull/40)
- Updating example in README [`c148806`](https://github.com/avoidwork/filesize.js/commit/c14880610b6a771bbc5c330400cf30f73c7d1242)
- Minor change [`49ecfc2`](https://github.com/avoidwork/filesize.js/commit/49ecfc2c5f3d70d27d7a818bd236260740240c1c)
#### [1.9.6](https://github.com/avoidwork/filesize.js/compare/1.9.5...1.9.6)
> 5 July 2013
- Minor fix [`#38`](https://github.com/avoidwork/filesize.js/pull/38)
- Correcting `kilobit` & `kilobyte` symbols [`223b8ea`](https://github.com/avoidwork/filesize.js/commit/223b8ea5dd0780baa978f7bc184ef9d8d910e2a7)
#### [1.9.5](https://github.com/avoidwork/filesize.js/compare/1.9.4...1.9.5)
> 18 June 2013
- Updating README [`#37`](https://github.com/avoidwork/filesize.js/pull/37)
- Updating `.npmignore` [`#36`](https://github.com/avoidwork/filesize.js/pull/36)
#### [1.9.4](https://github.com/avoidwork/filesize.js/compare/1.9.3...1.9.4)
> 13 June 2013
- Minor change [`#35`](https://github.com/avoidwork/filesize.js/pull/35)
- Updating `README.md` examples [`#34`](https://github.com/avoidwork/filesize.js/pull/34)
- Refactoring [`#33`](https://github.com/avoidwork/filesize.js/pull/33)
- Updated grunt build, implemented `jshint` for linting, fixes #32 [`#32`](https://github.com/avoidwork/filesize.js/issues/32)
- Removing unused grunt module [`11f0d72`](https://github.com/avoidwork/filesize.js/commit/11f0d72bc3502d3354adf827fd77e2eb26680d76)
- Returning `grunt-cli` to `package.json` [`191baa4`](https://github.com/avoidwork/filesize.js/commit/191baa4d23edc5360183b67320a471df02d6ede8)
#### [1.9.3](https://github.com/avoidwork/filesize.js/compare/1.9.2...1.9.3)
> 14 April 2013
- Minor change [`#31`](https://github.com/avoidwork/filesize.js/pull/31)
- Making `0` case faster [`642966b`](https://github.com/avoidwork/filesize.js/commit/642966b9cb9b487ee09a30dff785989950118654)
#### [1.9.2](https://github.com/avoidwork/filesize.js/compare/1.9.1...1.9.2)
> 11 April 2013
- Minor fix [`#30`](https://github.com/avoidwork/filesize.js/pull/30)
- Treating bytes as cardinal numbers [`fdf8b22`](https://github.com/avoidwork/filesize.js/commit/fdf8b222baf9068eb8879ffc5485294ed845a14c)
#### [1.9.1](https://github.com/avoidwork/filesize.js/compare/1.9.0...1.9.1)
> 7 April 2013
- Minor change [`#29`](https://github.com/avoidwork/filesize.js/pull/29)
- Updating README.md [`#27`](https://github.com/avoidwork/filesize.js/pull/27)
- Updating `.npmignore` to ignore unneeded files for distribution, fixes #28 [`#28`](https://github.com/avoidwork/filesize.js/issues/28)
#### [1.9.0](https://github.com/avoidwork/filesize.js/compare/1.8.0...1.9.0)
> 7 April 2013
- API change [`#26`](https://github.com/avoidwork/filesize.js/pull/26)
- Added a `third` optional boolean argument to disable `bit` sizes, fixes #25 [`#25`](https://github.com/avoidwork/filesize.js/issues/25)
#### [1.8.0](https://github.com/avoidwork/filesize.js/compare/1.7.9...1.8.0)
> 3 March 2013
- Optimizations [`#24`](https://github.com/avoidwork/filesize.js/pull/24)
- Caching variables in closure scope, upgraded to grunt 0.4.0, fixed license link in README.md [`7648fee`](https://github.com/avoidwork/filesize.js/commit/7648feeb075cb4319b0ed74b91a95c17116b941f)
#### [1.7.9](https://github.com/avoidwork/filesize.js/compare/1.7.8...1.7.9)
> 5 February 2013
- Minor change [`#20`](https://github.com/avoidwork/filesize.js/pull/20)
- Changing how 0 is handled (less wasted ops) [`d1428f6`](https://github.com/avoidwork/filesize.js/commit/d1428f635cde3d66d7e5d07cc5c5c7f4d85690e5)
#### [1.7.8](https://github.com/avoidwork/filesize.js/compare/1.7.7...1.7.8)
> 5 February 2013
- Minor refactoring [`#19`](https://github.com/avoidwork/filesize.js/pull/19)
- Adding support for zero as a parameter [`5075979`](https://github.com/avoidwork/filesize.js/commit/50759793476c40df017c3b36b5a28fbf7de69ce8)
#### [1.7.7](https://github.com/avoidwork/filesize.js/compare/1.7.6...1.7.7)
> 5 February 2013
- Optimizations [`#18`](https://github.com/avoidwork/filesize.js/pull/18)
- Optimizations; kudos to @marktucker for looking over the lib [`e5965f0`](https://github.com/avoidwork/filesize.js/commit/e5965f070e715dc4dd96bbc57fa8692e5ff5bfbb)
- :gem: Added travis.yml file :gem: [`785ae92`](https://github.com/avoidwork/filesize.js/commit/785ae92f4e1762c77ad1ce3cab445c9760e78374)
#### [1.7.6](https://github.com/avoidwork/filesize.js/compare/1.7.5...1.7.6)
> 5 February 2013
- Minor optimization [`#17`](https://github.com/avoidwork/filesize.js/pull/17)
- Optimizing the negative number flip using the simplest method (minus operator) [`0fb401c`](https://github.com/avoidwork/filesize.js/commit/0fb401c58ba35d54de6421ab44fd55089f069ead)
#### [1.7.5](https://github.com/avoidwork/filesize.js/compare/1.7.4...1.7.5)
> 2 February 2013
- Fixing license link in banner [`#16`](https://github.com/avoidwork/filesize.js/pull/16)
- One last change [`#15`](https://github.com/avoidwork/filesize.js/pull/15)
- Removing unnecessary `typeof` operators [`3f347fa`](https://github.com/avoidwork/filesize.js/commit/3f347fa0a9a8f130271c46a0afd7e5e6c78ad176)
#### [1.7.4](https://github.com/avoidwork/filesize.js/compare/1.7.3...1.7.4)
> 2 February 2013
- Minor changes [`#14`](https://github.com/avoidwork/filesize.js/pull/14)
- Utilizing Math.abs(), updating the banner [`fb27fd3`](https://github.com/avoidwork/filesize.js/commit/fb27fd38d637937e1f27b70cad76c50fcd0278d0)
#### [1.7.3](https://github.com/avoidwork/filesize.js/compare/1.7.2...1.7.3)
> 2 February 2013
- Minor refactoring [`#13`](https://github.com/avoidwork/filesize.js/pull/13)
- Adding support for negative sizes, fixes #12 [`#12`](https://github.com/avoidwork/filesize.js/issues/12)
- Adding license for proper attribution in a retail product [`e1a3ea5`](https://github.com/avoidwork/filesize.js/commit/e1a3ea58cd208403ca14bf4d2e45b26d39f44c1d)
- Adding license for proper attribution in a retail product [`4a167c2`](https://github.com/avoidwork/filesize.js/commit/4a167c20d273c0d4ffb507772ce2c9ca0fdeab65)
#### [1.7.2](https://github.com/avoidwork/filesize.js/compare/1.7.1...1.7.2)
> 3 November 2012
- Minor changes [`#11`](https://github.com/avoidwork/filesize.js/pull/11)
- Refactored to utilize regex tests instead of string comparisons, minor version bump [`bfa1398`](https://github.com/avoidwork/filesize.js/commit/bfa1398ffee5a0c697fa6c8c58ecf5a40df28f25)
#### [1.7.1](https://github.com/avoidwork/filesize.js/compare/1.7.0...1.7.1)
> 3 November 2012
- Minor changes [`#10`](https://github.com/avoidwork/filesize.js/pull/10)
- Fixing shorthand for `bit` suffixes [`2222c6e`](https://github.com/avoidwork/filesize.js/commit/2222c6ed03b3c936a3bdc76a474d1c4475821d4a)
- Updated README [`1d0eb61`](https://github.com/avoidwork/filesize.js/commit/1d0eb618bb7ee92aaa09c0fc582733ed6ecf824f)
- Updated README [`5ffc824`](https://github.com/avoidwork/filesize.js/commit/5ffc82440d8319be4023d379d57907307af4023e)
#### [1.7.0](https://github.com/avoidwork/filesize.js/compare/1.6.7...1.7.0)
> 2 November 2012
- Refactored [`#9`](https://github.com/avoidwork/filesize.js/pull/9)
- Extended size ranges to support Byte - PetaByte based on the new standard definitions [`97a497c`](https://github.com/avoidwork/filesize.js/commit/97a497cfed5b1a7a1aee250b92ea8103e8c4d12f)
- Version bump [`5341f0b`](https://github.com/avoidwork/filesize.js/commit/5341f0b8c7f529cb15b86bc035c066a3cb3ea83c)
#### [1.6.7](https://github.com/avoidwork/filesize.js/compare/1.6.6...1.6.7)
> 2 November 2012
- Minor refactoring [`#8`](https://github.com/avoidwork/filesize.js/pull/8)
- The repo your repo could be like! [`#7`](https://github.com/avoidwork/filesize.js/pull/7)
- Specified the base/radix for parseInt() & simplified the number cast [`8315027`](https://github.com/avoidwork/filesize.js/commit/83150274fc76a724ea4287a200dc20dac211af0d)
- Fixing a test [`f487a26`](https://github.com/avoidwork/filesize.js/commit/f487a26251c4f1912d3b4909d66b630ed796ec7a)
- :gem: Added travis.yml file :gem: [`497a6f9`](https://github.com/avoidwork/filesize.js/commit/497a6f95d125a4b1d66e30f2edbf8b087775e68f)
#### [1.6.6](https://github.com/avoidwork/filesize.js/compare/1.6.5...1.6.6)
> 15 August 2012
- Shouldn't have been in the commit [`#6`](https://github.com/avoidwork/filesize.js/pull/6)
- Correcting dir structure [`#5`](https://github.com/avoidwork/filesize.js/pull/5)
- Implemented a grunt build process & unit tests [`#4`](https://github.com/avoidwork/filesize.js/pull/4)
- Removing deprecated variables, moving tag [`6cfdca0`](https://github.com/avoidwork/filesize.js/commit/6cfdca0adce2474dde103768322c4eab89ce5248)
- Fixing npm path [`cc36eac`](https://github.com/avoidwork/filesize.js/commit/cc36eac57f8fea5c978b03a0c0e51b1962e41c0c)
- Updating npm package.json, moving tag [`ce70843`](https://github.com/avoidwork/filesize.js/commit/ce70843863f52ecd1a2b75adb69fbf1b05120f1d)
#### [1.6.5](https://github.com/avoidwork/filesize.js/compare/1.6.0...1.6.5)
> 22 June 2012
- Add a jam ignore to reduce packaged size [`#3`](https://github.com/avoidwork/filesize.js/pull/3)
- Made it faster [`f2126d0`](https://github.com/avoidwork/filesize.js/commit/f2126d053c52dbbed7917c4976bab3382e73f377)
- Removing unnecessary ops, making the AMD loading anonymous, updated docblock [`cf2c698`](https://github.com/avoidwork/filesize.js/commit/cf2c6981181ca7c1a3f4d477c489e76b8280a55a)
- Generated a proper package.json [`59d04ab`](https://github.com/avoidwork/filesize.js/commit/59d04ab5fc00b6b909fbddeca59e97b8984e520d)
#### [1.6.0](https://github.com/avoidwork/filesize.js/compare/1.5.0...1.6.0)
> 2 May 2012
- Added support for node.js [`2b14b66`](https://github.com/avoidwork/filesize.js/commit/2b14b664351f1f41a50e95e126d1813c77e6fa62)
- Updated read me [`f3e8803`](https://github.com/avoidwork/filesize.js/commit/f3e88030486d1ad58a5231cfaf4bef6debfc2785)
- Updated read me [`4165623`](https://github.com/avoidwork/filesize.js/commit/41656233df59d19549648247a9bf37eeda2be33e)
#### [1.5.0](https://github.com/avoidwork/filesize.js/compare/1.4.0...1.5.0)
> 30 April 2012
- Added an optional third boolean parameter to emulate "ls -lh" output, which overrides "pos" parameter [`33b074c`](https://github.com/avoidwork/filesize.js/commit/33b074c62b2ae618678731e835114a78f721a5bb)
#### [1.4.0](https://github.com/avoidwork/filesize.js/compare/1.3.0...1.4.0)
> 16 March 2012
- Add parameter validation, fixed byte output, updated docblock [`329e874`](https://github.com/avoidwork/filesize.js/commit/329e874c8e9293e656f3383fc555c0babf5f3125)
- Removing window references [`1375bdc`](https://github.com/avoidwork/filesize.js/commit/1375bdc95af858fab34ca79d5c38d12fb8ef84a4)
- Fixing AMD loading [`21e2aa7`](https://github.com/avoidwork/filesize.js/commit/21e2aa77faca310c15e242a962d8ba96dd4c01b4)
#### [1.3.0](https://github.com/avoidwork/filesize.js/compare/1.2.0...1.3.0)
> 8 March 2012
- Really, this time... [`326e4f4`](https://github.com/avoidwork/filesize.js/commit/326e4f43547a816a6b73c8e5e5a5c4c8219ffd57)
- Fixing AMD loading (for real) [`41901ec`](https://github.com/avoidwork/filesize.js/commit/41901eca89b93c4741f6850222377f4ac2cb5952)
#### [1.2.0](https://github.com/avoidwork/filesize.js/compare/1.1.0...1.2.0)
> 4 March 2012
- Fixing AMD loading [`5c177a9`](https://github.com/avoidwork/filesize.js/commit/5c177a9806b62371efdd7d1380bba813156d0390)
- Updated README [`38de690`](https://github.com/avoidwork/filesize.js/commit/38de69077225692f2d8a77381b8c2d0fd429a923)
- Updated README [`319e420`](https://github.com/avoidwork/filesize.js/commit/319e420d31022a62db87e6ea2512d0b07dc3df9a)
#### [1.1.0](https://github.com/avoidwork/filesize.js/compare/1.0.0...1.1.0)
> 2 March 2012
- Added 'byte' as the smallest size, fixes S3 file size computing, etc. [`829b250`](https://github.com/avoidwork/filesize.js/commit/829b2504e37031bb5aca7bdab57f348f5fc37e92)
- Updated README [`11f5015`](https://github.com/avoidwork/filesize.js/commit/11f5015344da58a174131a81e72180e59f354b9a)
#### 1.0.0
> 2 March 2012
- Initial code commit [`c1f49eb`](https://github.com/avoidwork/filesize.js/commit/c1f49eb4765dd635a646e9477e7836d4d779dbc4)
- Initial commit [`7078c4f`](https://github.com/avoidwork/filesize.js/commit/7078c4fb825a9d3de8bb79f22ec6aa5d3dbadfdd)
+28
View File
@@ -0,0 +1,28 @@
Copyright (c) 2020, Jason Mulligan
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of filesize nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+92
View File
@@ -0,0 +1,92 @@
# filesize.js
[![build status](https://secure.travis-ci.org/avoidwork/filesize.js.svg)](http://travis-ci.org/avoidwork/filesize.js) [![downloads](https://img.shields.io/npm/dt/filesize.svg)](https://www.npmjs.com/package/filesize) [![CDNJS version](https://img.shields.io/cdnjs/v/filesize.svg)](https://cdnjs.com/libraries/filesize)
filesize.js provides a simple way to get a human readable file size string from a number (float or integer) or string.
## Optional settings
`filesize()` accepts an optional descriptor Object as a second argument, so you can customize the output.
### base
_*(number)*_ Number base, default is `2`
### bits
_*(boolean)*_ Enables `bit` sizes, default is `false`
### exponent
_*(number)*_ Specifies the symbol via exponent, e.g. `2` is `MB` for base 2, default is `-1`
### fullform
_*(boolean)*_ Enables full form of unit of measure, default is `false`
### fullforms
_*(array)*_ Array of full form overrides, default is `[]`
### locale (overrides 'separator')
_*(string || boolean)*_ BCP 47 language tag to specify a locale, or `true` to use default locale, default is `""`
### localeOptions (overrides 'separator', requires string for 'locale' option)
_*(object)*_ Dictionary of options defined by ECMA-402 ([Number.prototype.toLocaleString](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString)). Requires locale option to be explicitly passed as a string, otherwise is ignored.
### output
_*(string)*_ Output of function (`array`, `exponent`, `object`, or `string`), default is `string`
### round
_*(number)*_ Decimal place, default is `2`
### separator
_*(string)*_ Decimal separator character, default is `.`
### spacer
_*(string)*_ Character between the `result` and `symbol`, default is `" "`
### standard
_*(string)*_ Standard unit of measure, can be `iec` or `jedec`, default is `jedec`; can be overruled by `base`
### symbols
_*(object)*_ Dictionary of SI/JEDEC/IEC symbols to replace for localization, defaults to english if no match is found
### unix
_*(boolean)*_ Enables unix style human readable output, e.g `ls -lh`, default is `false`
## Examples
```javascript
filesize(500); // "500 B"
filesize(500, {bits: true}); // "4 Kb"
filesize(265318, {base: 10}); // "265.32 kB"
filesize(265318); // "259.1 KB"
filesize(265318, {round: 0}); // "259 KB"
filesize(265318, {output: "array"}); // [259.1, "KB"]
filesize(265318, {output: "object"}); // {value: 259.1, symbol: "KB", exponent: 1}
filesize(1, {symbols: {B: "Б"}}); // "1 Б"
filesize(1024); // "1 KB"
filesize(1024, {exponent: 0}); // "1024 B"
filesize(1024, {output: "exponent"}); // 1
filesize(265318, {standard: "iec"}); // "259.1 KiB"
filesize(265318, {standard: "iec", fullform: true}); // "259.1 kibibytes"
filesize(12, {fullform: true, fullforms: ["байтов"]}); // "12 байтов"
filesize(265318, {separator: ","}); // "259,1 KB"
filesize(265318, {locale: "de"}); // "259,1 KB"
```
## Partial Application
`filesize.partial()` takes the second parameter of `filesize()` and returns a new function with the configuration applied
upon execution. This can be used to reduce `Object` creation if you call `filesize()` without caching the `descriptor`
in lexical scope.
```javascript
const size = filesize.partial({standard: "iec"});
size(265318); // "259.1 KiB"
```
## How can I load filesize.js?
filesize.js supports AMD loaders (require.js, curl.js, etc.), node.js & npm (```npm install filesize```), or using a script tag.
An ES6 version is bundled with an npm install, but requires you load it with the full path, e.g. `require(path.join(__dirname, 'node_modules', 'filesize', 'lib', 'filesize.es6.js'))`.
## License
Copyright (c) 2019 Jason Mulligan
Licensed under the BSD-3 license.
+103
View File
@@ -0,0 +1,103 @@
// Type definitions for filesize 6.0.1
// Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Renaud Chaput <https://github.com/renchap>
// Roman Nuritdinov <https://github.com/Ky6uk>
// Sam Hulick <https://github.com/ffxsam>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var fileSize: Filesize.Filesize;
export = fileSize;
export as namespace filesize;
declare namespace Filesize {
interface SiJedecBits {
b?: string;
Kb?: string;
Mb?: string;
Gb?: string;
Tb?: string;
Pb?: string;
Eb?: string;
Zb?: string;
Yb?: string;
}
interface SiJedecBytes {
B?: string;
KB?: string;
MB?: string;
GB?: string;
TB?: string;
PB?: string;
EB?: string;
ZB?: string;
YB?: string;
}
type SiJedec = SiJedecBits & SiJedecBytes & { [name: string]: string };
interface Options {
/**
* Number base, default is 2
*/
base?: number;
/**
* Enables bit sizes, default is false
*/
bits?: boolean;
/**
* Specifies the SI suffix via exponent, e.g. 2 is MB for bytes, default is -1
*/
exponent?: number;
/**
* Enables full form of unit of measure, default is false
*/
fullform?: boolean;
/**
* Array of full form overrides, default is []
*/
fullforms?: string[];
/**
* BCP 47 language tag to specify a locale, or true to use default locale, default is ""
*/
locale?: string | boolean;
/**
* ECMA-402 number format option overrides, default is "{}"
*/
localeOptions?: Intl.NumberFormatOptions;
/**
* Output of function (array, exponent, object, or string), default is string
*/
output?: "array" | "exponent" | "object" | "string";
/**
* Decimal place, default is 2
*/
round?: number;
/**
* Decimal separator character, default is `.`
*/
separator?: string;
/**
* Character between the result and suffix, default is ` `
*/
spacer?: string;
/**
* Standard unit of measure, can be iec or jedec, default is jedec; can be overruled by base
*/
standard?: "iec" | "jedec";
/**
* Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found
*/
symbols?: SiJedec;
/**
* Enables unix style human readable output, e.g ls -lh, default is false
*/
unix?: boolean;
}
interface Filesize {
(bytes: number, options?: Options): string;
partial: (options: Options) => ((bytes: number) => string);
}
}
+161
View File
@@ -0,0 +1,161 @@
/**
* filesize
*
* @copyright 2020 Jason Mulligan <jason.mulligan@avoidwork.com>
* @license BSD-3-Clause
* @version 6.1.0
*/
(function (global) {
const b = /^(b|B)$/,
symbol = {
iec: {
bits: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"],
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
},
jedec: {
bits: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
}
},
fullform = {
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
};
/**
* filesize
*
* @method filesize
* @param {Mixed} arg String, Int or Float to transform
* @param {Object} descriptor [Optional] Flags
* @return {String} Readable file size String
*/
function filesize (arg, descriptor = {}) {
let result = [],
val = 0,
e, base, bits, ceil, full, fullforms, locale, localeOptions, neg, num, output, round, unix, separator, spacer, standard, symbols;
if (isNaN(arg)) {
throw new TypeError("Invalid number");
}
bits = descriptor.bits === true;
unix = descriptor.unix === true;
base = descriptor.base || 2;
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
locale = descriptor.locale !== void 0 ? descriptor.locale : "";
localeOptions = descriptor.localeOptions || {};
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
symbols = descriptor.symbols || {};
standard = base === 2 ? descriptor.standard || "jedec" : "jedec";
output = descriptor.output || "string";
full = descriptor.fullform === true;
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
e = descriptor.exponent !== void 0 ? descriptor.exponent : -1;
num = Number(arg);
neg = num < 0;
ceil = base > 2 ? 1000 : 1024;
// Flipping a negative number to determine the size
if (neg) {
num = -num;
}
// Determining the exponent
if (e === -1 || isNaN(e)) {
e = Math.floor(Math.log(num) / Math.log(ceil));
if (e < 0) {
e = 0;
}
}
// Exceeding supported length, time to reduce & multiply
if (e > 8) {
e = 8;
}
if (output === "exponent") {
return e;
}
// Zero is now a special case because bytes divide by 1
if (num === 0) {
result[0] = 0;
result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
} else {
val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
if (bits) {
val = val * 8;
if (val >= ceil && e < 8) {
val = val / ceil;
e++;
}
}
result[0] = Number(val.toFixed(e > 0 ? round : 0));
if (result[0] === ceil && e < 8 && descriptor.exponent === void 0) {
result[0] = 1;
e++;
}
result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
if (unix) {
result[1] = standard === "jedec" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, "") : result[1];
if (b.test(result[1])) {
result[0] = Math.floor(result[0]);
result[1] = "";
}
}
}
// Decorating a 'diff'
if (neg) {
result[0] = -result[0];
}
// Applying custom symbol
result[1] = symbols[result[1]] || result[1];
if (locale === true) {
result[0] = result[0].toLocaleString();
} else if (locale.length > 0) {
result[0] = result[0].toLocaleString(locale, localeOptions);
} else if (separator.length > 0) {
result[0] = result[0].toString().replace(".", separator);
}
// Returning Array, Object, or String (default)
if (output === "array") {
return result;
}
if (full) {
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
}
if (output === "object") {
return {value: result[0], symbol: result[1], exponent: e};
}
return result.join(spacer);
}
// Partial application for functional programming
filesize.partial = opt => arg => filesize(arg, opt);
// CommonJS, AMD, script tag
if (typeof exports !== "undefined") {
module.exports = filesize;
} else if (typeof define === "function" && define.amd !== void 0) {
define(() => filesize);
} else {
global.filesize = filesize;
}
}(typeof window !== "undefined" ? window : global));
+22
View File
@@ -0,0 +1,22 @@
/*
2020 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 6.1.0
*/
"use strict";/**
* filesize
*
* @copyright 2020 Jason Mulligan <jason.mulligan@avoidwork.com>
* @license BSD-3-Clause
* @version 6.1.0
*/(function(a){/**
* filesize
*
* @method filesize
* @param {Mixed} arg String, Int or Float to transform
* @param {Object} descriptor [Optional] Flags
* @return {String} Readable file size String
*/function c(a,c={}){var g=Math.pow,h=Math.floor,i=Math.log;let j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A=[],B=0;if(isNaN(a))throw new TypeError("Invalid number");return(l=!0===c.bits,v=!0===c.unix,k=c.base||2,u=void 0===c.round?v?1:2:c.round,p=void 0===c.locale?"":c.locale,q=c.localeOptions||{},w=void 0===c.separator?"":c.separator,x=void 0===c.spacer?v?"":" ":c.spacer,z=c.symbols||{},y=2===k?c.standard||"jedec":"jedec",t=c.output||"string",n=!0===c.fullform,o=c.fullforms instanceof Array?c.fullforms:[],j=void 0===c.exponent?-1:c.exponent,s=+a,r=0>s,m=2<k?1e3:1024,r&&(s=-s),(-1===j||isNaN(j))&&(j=h(i(s)/i(m)),0>j&&(j=0)),8<j&&(j=8),"exponent"===t)?j:(0===s?(A[0]=0,A[1]=v?"":b[y][l?"bits":"bytes"][j]):(B=s/(2===k?g(2,10*j):g(1e3,j)),l&&(B*=8,B>=m&&8>j&&(B/=m,j++)),A[0]=+B.toFixed(0<j?u:0),A[0]===m&&8>j&&void 0===c.exponent&&(A[0]=1,j++),A[1]=10===k&&1===j?l?"kb":"kB":b[y][l?"bits":"bytes"][j],v&&(A[1]="jedec"===y?A[1].charAt(0):0<j?A[1].replace(/B$/,""):A[1],d.test(A[1])&&(A[0]=h(A[0]),A[1]=""))),r&&(A[0]=-A[0]),A[1]=z[A[1]]||A[1],!0===p?A[0]=A[0].toLocaleString():0<p.length?A[0]=A[0].toLocaleString(p,q):0<w.length&&(A[0]=A[0].toString().replace(".",w)),"array"===t)?A:(n&&(A[1]=o[j]?o[j]:f[y][j]+(l?"bit":"byte")+(1===A[0]?"":"s")),"object"===t?{value:A[0],symbol:A[1],exponent:j}:A.join(x));// Zero is now a special case because bytes divide by 1
// Returning Array, Object, or String (default)
}// Partial application for functional programming
const d=/^(b|B)$/,b={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},f={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};c.partial=a=>b=>c(b,a),"undefined"==typeof exports?"function"==typeof define&&void 0!==define.amd?define(()=>c):a.filesize=c:module.exports=c})("undefined"==typeof window?global:window);
//# sourceMappingURL=filesize.es6.min.js.map
File diff suppressed because one or more lines are too long
+189
View File
@@ -0,0 +1,189 @@
"use strict";
/**
* filesize
*
* @copyright 2020 Jason Mulligan <jason.mulligan@avoidwork.com>
* @license BSD-3-Clause
* @version 6.1.0
*/
(function (global) {
var b = /^(b|B)$/,
symbol = {
iec: {
bits: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"],
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
},
jedec: {
bits: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
}
},
fullform = {
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
};
/**
* filesize
*
* @method filesize
* @param {Mixed} arg String, Int or Float to transform
* @param {Object} descriptor [Optional] Flags
* @return {String} Readable file size String
*/
function filesize(arg) {
var descriptor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var result = [],
val = 0,
e = void 0,
base = void 0,
bits = void 0,
ceil = void 0,
full = void 0,
fullforms = void 0,
locale = void 0,
localeOptions = void 0,
neg = void 0,
num = void 0,
output = void 0,
round = void 0,
unix = void 0,
separator = void 0,
spacer = void 0,
standard = void 0,
symbols = void 0;
if (isNaN(arg)) {
throw new TypeError("Invalid number");
}
bits = descriptor.bits === true;
unix = descriptor.unix === true;
base = descriptor.base || 2;
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
locale = descriptor.locale !== void 0 ? descriptor.locale : "";
localeOptions = descriptor.localeOptions || {};
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
symbols = descriptor.symbols || {};
standard = base === 2 ? descriptor.standard || "jedec" : "jedec";
output = descriptor.output || "string";
full = descriptor.fullform === true;
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
e = descriptor.exponent !== void 0 ? descriptor.exponent : -1;
num = Number(arg);
neg = num < 0;
ceil = base > 2 ? 1000 : 1024; // Flipping a negative number to determine the size
if (neg) {
num = -num;
} // Determining the exponent
if (e === -1 || isNaN(e)) {
e = Math.floor(Math.log(num) / Math.log(ceil));
if (e < 0) {
e = 0;
}
} // Exceeding supported length, time to reduce & multiply
if (e > 8) {
e = 8;
}
if (output === "exponent") {
return e;
} // Zero is now a special case because bytes divide by 1
if (num === 0) {
result[0] = 0;
result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
} else {
val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
if (bits) {
val = val * 8;
if (val >= ceil && e < 8) {
val = val / ceil;
e++;
}
}
result[0] = Number(val.toFixed(e > 0 ? round : 0));
if (result[0] === ceil && e < 8 && descriptor.exponent === void 0) {
result[0] = 1;
e++;
}
result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
if (unix) {
result[1] = standard === "jedec" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, "") : result[1];
if (b.test(result[1])) {
result[0] = Math.floor(result[0]);
result[1] = "";
}
}
} // Decorating a 'diff'
if (neg) {
result[0] = -result[0];
} // Applying custom symbol
result[1] = symbols[result[1]] || result[1];
if (locale === true) {
result[0] = result[0].toLocaleString();
} else if (locale.length > 0) {
result[0] = result[0].toLocaleString(locale, localeOptions);
} else if (separator.length > 0) {
result[0] = result[0].toString().replace(".", separator);
} // Returning Array, Object, or String (default)
if (output === "array") {
return result;
}
if (full) {
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
}
if (output === "object") {
return {
value: result[0],
symbol: result[1],
exponent: e
};
}
return result.join(spacer);
} // Partial application for functional programming
filesize.partial = function (opt) {
return function (arg) {
return filesize(arg, opt);
};
}; // CommonJS, AMD, script tag
if (typeof exports !== "undefined") {
module.exports = filesize;
} else if (typeof define === "function" && define.amd !== void 0) {
define(function () {
return filesize;
});
} else {
global.filesize = filesize;
}
})(typeof window !== "undefined" ? window : global);
+6
View File
@@ -0,0 +1,6 @@
/*
2020 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 6.1.0
*/
"use strict";!function(e){var x=/^(b|B)$/,M={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},w={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function t(e){var i,t,o,n,b,r,a,l,s,d,u,c,f,p,B,y=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},g=[],v=0,m=void 0,h=void 0;if(isNaN(e))throw new TypeError("Invalid number");return t=!0===y.bits,u=!0===y.unix,i=y.base||2,d=void 0!==y.round?y.round:u?1:2,r=void 0!==y.locale?y.locale:"",a=y.localeOptions||{},c=void 0!==y.separator?y.separator:"",f=void 0!==y.spacer?y.spacer:u?"":" ",B=y.symbols||{},p=2===i&&y.standard||"jedec",s=y.output||"string",n=!0===y.fullform,b=y.fullforms instanceof Array?y.fullforms:[],m=void 0!==y.exponent?y.exponent:-1,o=2<i?1e3:1024,(l=(h=Number(e))<0)&&(h=-h),(-1===m||isNaN(m))&&(m=Math.floor(Math.log(h)/Math.log(o)))<0&&(m=0),8<m&&(m=8),"exponent"===s?m:(0===h?(g[0]=0,g[1]=u?"":M[p][t?"bits":"bytes"][m]):(v=h/(2===i?Math.pow(2,10*m):Math.pow(1e3,m)),t&&o<=(v*=8)&&m<8&&(v/=o,m++),g[0]=Number(v.toFixed(0<m?d:0)),g[0]===o&&m<8&&void 0===y.exponent&&(g[0]=1,m++),g[1]=10===i&&1===m?t?"kb":"kB":M[p][t?"bits":"bytes"][m],u&&(g[1]="jedec"===p?g[1].charAt(0):0<m?g[1].replace(/B$/,""):g[1],x.test(g[1])&&(g[0]=Math.floor(g[0]),g[1]=""))),l&&(g[0]=-g[0]),g[1]=B[g[1]]||g[1],!0===r?g[0]=g[0].toLocaleString():0<r.length?g[0]=g[0].toLocaleString(r,a):0<c.length&&(g[0]=g[0].toString().replace(".",c)),"array"===s?g:(n&&(g[1]=b[m]?b[m]:w[p][m]+(t?"bit":"byte")+(1===g[0]?"":"s")),"object"===s?{value:g[0],symbol:g[1],exponent:m}:g.join(f)))}t.partial=function(i){return function(e){return t(e,i)}},"undefined"!=typeof exports?module.exports=t:"function"==typeof define&&void 0!==define.amd?define(function(){return t}):e.filesize=t}("undefined"!=typeof window?window:global);
//# sourceMappingURL=filesize.min.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["filesize.js"],"names":["global","b","symbol","iec","bits","bytes","jedec","fullform","filesize","arg","base","ceil","full","fullforms","locale","localeOptions","neg","output","round","unix","separator","spacer","standard","symbols","descriptor","arguments","length","undefined","result","val","e","num","isNaN","TypeError","Array","exponent","Number","Math","floor","log","pow","toFixed","charAt","replace","test","toLocaleString","toString","value","join","partial","opt","exports","module","define","amd","window"],"mappings":"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","file":"filesize.min.js"}
+80
View File
@@ -0,0 +1,80 @@
{
"_from": "filesize@6.1.0",
"_id": "filesize@6.1.0",
"_inBundle": false,
"_integrity": "sha512-LpCHtPQ3sFx67z+uh2HnSyWSLLu5Jxo21795uRDuar/EOuYWXib5EmPaGIBuSnRqH2IODiKA2k5re/K9OnN/Yg==",
"_location": "/filesize",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "filesize@6.1.0",
"name": "filesize",
"escapedName": "filesize",
"rawSpec": "6.1.0",
"saveSpec": null,
"fetchSpec": "6.1.0"
},
"_requiredBy": [
"/react-dev-utils"
],
"_resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz",
"_shasum": "e81bdaa780e2451d714d71c0d7a4f3238d37ad00",
"_spec": "filesize@6.1.0",
"_where": "/Users/tylerkoenig/Code/personal/react-scss2/node_modules/react-dev-utils",
"author": {
"name": "Jason Mulligan",
"email": "jason.mulligan@avoidwork.com"
},
"browser": "lib/filesize.min.js",
"bugs": {
"url": "https://github.com/avoidwork/filesize.js/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "JavaScript library to generate a human readable String describing the file size",
"devDependencies": {
"auto-changelog": "^1.16.2",
"babel-core": "^6.26.3",
"babel-minify": "^0.5.1",
"babel-preset-env": "^1.7.0",
"grunt": "^1.0.4",
"grunt-babel": "^8.0.0",
"grunt-cli": "^1.3.2",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-nodeunit": "^2.1.0",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^22.0.0"
},
"engines": {
"node": ">= 0.4.0"
},
"files": [
"lib",
"*.d.ts"
],
"homepage": "https://filesizejs.com",
"keywords": [
"file",
"filesize",
"size",
"readable",
"file system",
"bytes",
"diff"
],
"license": "BSD-3-Clause",
"main": "lib/filesize.js",
"name": "filesize",
"repository": {
"type": "git",
"url": "git://github.com/avoidwork/filesize.js.git"
},
"scripts": {
"changelog": "auto-changelog -p",
"test": "grunt test"
},
"types": "filesize.d.ts",
"version": "6.1.0"
}