mirror of
https://github.com/bcomnes/deploy-to-neocities.git
synced 2026-03-29 17:31:36 +00:00
0.0.1
This commit is contained in:
21
node_modules/pretty-time/LICENSE
generated
vendored
Normal file
21
node_modules/pretty-time/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-present, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
169
node_modules/pretty-time/README.md
generated
vendored
Normal file
169
node_modules/pretty-time/README.md
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
# pretty-time [](https://www.npmjs.com/package/pretty-time) [](https://npmjs.org/package/pretty-time) [](https://npmjs.org/package/pretty-time) [](https://travis-ci.org/jonschlinkert/pretty-time)
|
||||
|
||||
> Easily format the time from node.js `process.hrtime`. Works with timescales ranging from weeks to nanoseconds.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save pretty-time
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var pretty = require('pretty-time');
|
||||
|
||||
var start = process.hrtime();
|
||||
var time = process.hrtime(start);
|
||||
console.log(pretty(time));
|
||||
//=> 3μs
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
By default, when no time increment is given as the second argument, the closest timescale is used (e.g. _most granular without being less than zero_).
|
||||
|
||||
**Examples:**
|
||||
|
||||
```js
|
||||
pretty([1200708, 795428088]);
|
||||
//=> '2w'
|
||||
|
||||
pretty([800708, 795428088]);
|
||||
//=> '1w'
|
||||
|
||||
pretty([400708, 795428088]);
|
||||
//=> '5d'
|
||||
|
||||
pretty([70708, 795428088]);
|
||||
//=> '20h'
|
||||
|
||||
pretty([12708, 795428088]);
|
||||
//=> '4h'
|
||||
|
||||
pretty([3708, 795428088]);
|
||||
//=> '1h'
|
||||
|
||||
pretty([208, 795428088]);
|
||||
//=> '3m'
|
||||
|
||||
pretty([20, 795428088]);
|
||||
//=> '21s'
|
||||
|
||||
pretty([0, 795428088]);
|
||||
//=> '795ms'
|
||||
|
||||
pretty([0, 000428088]);
|
||||
//=> '428μs'
|
||||
|
||||
pretty([0, 000000088]);
|
||||
//=> '88ns'
|
||||
|
||||
pretty([0, 000000018]);
|
||||
//=> '18ns'
|
||||
```
|
||||
|
||||
### Minimum time increment
|
||||
|
||||
_(All of the following examples use `[6740, 795428088]` as the hrtime array.)_
|
||||
|
||||
This value is passed as the second argument and determines how granular to make the time.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
pretty(time, 'h');
|
||||
//=> '2h'
|
||||
|
||||
pretty(time, 'm');
|
||||
//=> '1h 52m'
|
||||
|
||||
pretty(time, 's');
|
||||
//=> '1h 52m 21s'
|
||||
```
|
||||
|
||||
**Valid time increments**
|
||||
|
||||
Any of the following may be used:
|
||||
|
||||
* `ns` | `nano` | `nanosecond` | `nanoseconds`
|
||||
* `μs` | `micro` | `microsecond` | `microseconds`
|
||||
* `ms` | `milli` | `millisecond` | `milliseconds`
|
||||
* `s` | `sec` | `second` | `seconds`
|
||||
* `m` | `min` | `minute` | `minutes`
|
||||
* `h` | `hr` | `hour` | `hours`
|
||||
* `d` | `day` | `days`
|
||||
* `w` | `wk` | `week` | `weeks`
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [o-clock](https://www.npmjs.com/package/o-clock): Simple javascript utility for displaying the time in 12-hour clock format. | [homepage](https://github.com/jonschlinkert/o-clock "Simple javascript utility for displaying the time in 12-hour clock format.")
|
||||
* [seconds](https://www.npmjs.com/package/seconds): Get the number of seconds for a minute, hour, day and week. | [homepage](https://github.com/jonschlinkert/seconds "Get the number of seconds for a minute, hour, day and week.")
|
||||
* [time-stamp](https://www.npmjs.com/package/time-stamp): Get a formatted timestamp. | [homepage](https://github.com/jonschlinkert/time-stamp "Get a formatted timestamp.")
|
||||
* [timescale](https://www.npmjs.com/package/timescale): Convert from one time scale to another. Nanosecond is the most atomic unit, week is… [more](https://github.com/jonschlinkert/timescale) | [homepage](https://github.com/jonschlinkert/timescale "Convert from one time scale to another. Nanosecond is the most atomic unit, week is the largest unit.")
|
||||
* [week](https://www.npmjs.com/package/week): Get the current week number. | [homepage](https://github.com/datetime/week "Get the current week number.")
|
||||
* [weekday](https://www.npmjs.com/package/weekday): Get the name and number of the current weekday. Or get the name of the… [more](https://github.com/datetime/weekday) | [homepage](https://github.com/datetime/weekday "Get the name and number of the current weekday. Or get the name of the weekday for a given number.")
|
||||
* [year](https://www.npmjs.com/package/year): Simple utility to get the current year with 2 or 4 digits. | [homepage](https://github.com/jonschlinkert/year "Simple utility to get the current year with 2 or 4 digits.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 14 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 5 | [doowb](https://github.com/doowb) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 12, 2018._
|
||||
56
node_modules/pretty-time/index.js
generated
vendored
Normal file
56
node_modules/pretty-time/index.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*!
|
||||
* pretty-time <https://github.com/jonschlinkert/pretty-time>
|
||||
*
|
||||
* Copyright (c) 2015-2018, present, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = (time, smallest, digits) => {
|
||||
const isNumber = /^[0-9]+$/.test(time);
|
||||
if (!isNumber && !Array.isArray(time)) {
|
||||
throw new TypeError('expected an array or number in nanoseconds');
|
||||
}
|
||||
if (Array.isArray(time) && time.length !== 2) {
|
||||
throw new TypeError('expected an array from process.hrtime()');
|
||||
}
|
||||
|
||||
if (/^[0-9]+$/.test(smallest)) {
|
||||
digits = smallest;
|
||||
smallest = null;
|
||||
}
|
||||
|
||||
let num = isNumber ? time : utils.nano(time);
|
||||
let res = '';
|
||||
let prev;
|
||||
|
||||
for (const uom of Object.keys(utils.scale)) {
|
||||
const step = utils.scale[uom];
|
||||
let inc = num / step;
|
||||
|
||||
if (smallest && utils.isSmallest(uom, smallest)) {
|
||||
inc = utils.round(inc, digits);
|
||||
if (prev && (inc === (prev / step))) --inc;
|
||||
res += inc + uom;
|
||||
return res.trim();
|
||||
}
|
||||
|
||||
if (inc < 1) continue;
|
||||
if (!smallest) {
|
||||
inc = utils.round(inc, digits);
|
||||
res += inc + uom;
|
||||
return res;
|
||||
}
|
||||
|
||||
prev = step;
|
||||
|
||||
inc = Math.floor(inc);
|
||||
num -= (inc * step);
|
||||
res += inc + uom + ' ';
|
||||
}
|
||||
|
||||
return res.trim();
|
||||
};
|
||||
99
node_modules/pretty-time/package.json
generated
vendored
Normal file
99
node_modules/pretty-time/package.json
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"_from": "pretty-time@^1.1.0",
|
||||
"_id": "pretty-time@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-28iF6xPQrP8Oa6uxE6a1biz+lWeTOAPKggvjB8HAs6nVMKZwf5bG++632Dx614hIWgUPkgivRfG+a8uAXGTIbA==",
|
||||
"_location": "/pretty-time",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "pretty-time@^1.1.0",
|
||||
"name": "pretty-time",
|
||||
"escapedName": "pretty-time",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/pretty-time/-/pretty-time-1.1.0.tgz",
|
||||
"_shasum": "ffb7429afabb8535c346a34e41873adf3d74dd0e",
|
||||
"_spec": "pretty-time@^1.1.0",
|
||||
"_where": "/Users/bret/repos/deploy-to-neocities",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/pretty-time/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Easily format the time from node.js `process.hrtime`. Works with timescales ranging from weeks to nanoseconds.",
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"mocha": "^3.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"utils.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/pretty-time",
|
||||
"keywords": [
|
||||
"convert",
|
||||
"date",
|
||||
"format",
|
||||
"formatting",
|
||||
"hour",
|
||||
"hrtime",
|
||||
"micro",
|
||||
"milli",
|
||||
"minute",
|
||||
"nano",
|
||||
"nanosecond",
|
||||
"pretty",
|
||||
"second",
|
||||
"time",
|
||||
"week"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "pretty-time",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/pretty-time.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"o-clock",
|
||||
"seconds",
|
||||
"time-stamp",
|
||||
"timescale",
|
||||
"week",
|
||||
"weekday",
|
||||
"year"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
32
node_modules/pretty-time/utils.js
generated
vendored
Normal file
32
node_modules/pretty-time/utils.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
exports.nano = time => +time[0] * 1e9 + +time[1];
|
||||
|
||||
exports.scale = {
|
||||
'w': 6048e11,
|
||||
'd': 864e11,
|
||||
'h': 36e11,
|
||||
'm': 6e10,
|
||||
's': 1e9,
|
||||
'ms': 1e6,
|
||||
'μs': 1e3,
|
||||
'ns': 1,
|
||||
};
|
||||
|
||||
exports.regex = {
|
||||
'w': /^(w((ee)?k)?s?)$/,
|
||||
'd': /^(d(ay)?s?)$/,
|
||||
'h': /^(h((ou)?r)?s?)$/,
|
||||
'm': /^(min(ute)?s?|m)$/,
|
||||
's': /^((sec(ond)?)s?|s)$/,
|
||||
'ms': /^(milli(second)?s?|ms)$/,
|
||||
'μs': /^(micro(second)?s?|μs)$/,
|
||||
'ns': /^(nano(second)?s?|ns?)$/,
|
||||
};
|
||||
|
||||
exports.isSmallest = function(uom, unit) {
|
||||
return exports.regex[uom].test(unit);
|
||||
};
|
||||
|
||||
exports.round = function(num, digits) {
|
||||
const n = Math.abs(num);
|
||||
return /[0-9]/.test(digits) ? n.toFixed(digits) : Math.round(n);
|
||||
};
|
||||
Reference in New Issue
Block a user