Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
iCrawl committed Jan 26, 2020
0 parents commit 6711eaf
Show file tree
Hide file tree
Showing 17 changed files with 4,927 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: [icrawl] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: iCrawl
open_collective: # Replace with a single Open Collective username
ko_fi: crawltogo
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint
on: [push, pull_request]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Node v12
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install pnpm
run: curl -L https://unpkg.com/@pnpm/self-installer | node

- name: Install dependencies
run: pnpm i

- name: Run Lint
uses: icrawl/action-eslint@v1
23 changes: 23 additions & 0 deletions .github/workflows/tsc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: TSC
on: [push, pull_request]
jobs:
tsc:
name: TSC
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Node v12
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install pnpm
run: curl -L https://unpkg.com/@pnpm/self-installer | node

- name: Install dependencies
run: pnpm i

- name: Run TSC
uses: icrawl/action-tsc@v1
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Packages
node_modules/

# Log files
logs/
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Miscellaneous
.tmp/
dist/
typings/
20 changes: 20 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Packages
node_modules/

# Log files
logs/
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Test files
test/

# Miscellaneous
.tmp/
.gitignore
.gitattributes
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2018-2020 iCrawl
Copyright (c) 2016 Zeit, Inc.

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.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# @naval-base/ms
> Millisecond conversion utility
## Features

- Simply works.

## Install

```bash
pnpm install @naval-base/ms
```

## Usage

```js
ms('2 days') // 172800000
ms('1d') // 86400000
ms('10h') // 36000000
ms('2.5 hrs') // 9000000
ms('2h') // 7200000
ms('1m') // 60000
ms('5s') // 5000
ms('1y') // 31557600000
ms('100') // 100
ms('-3 days') // -259200000
ms('-1h') // -3600000
ms('-200') // -200
```

### From ms

```js
ms(60000) // "1m"
ms(2 * 60000) // "2m"
ms(-3 * 60000) // "-3m"
ms(ms('10 hours')) // "10h"
```

### Long format

```js
ms(60000, true) // "1 minute"
ms(2 * 60000, true) // "2 minutes"
ms(-3 * 60000, true) // "-3 minutes"
ms(ms('10 hours'), true) // "10 hours"
```

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

**@naval-base/ms** © [iCrawl](https://github.com/iCrawl), Released under the [MIT](https://github.com/iCrawl/kaori/blob/master/LICENSE) License.
Authored and maintained by iCrawl.

> GitHub [@iCrawl](https://github.com/iCrawl) · Twitter [@iCrawlToGo](https://twitter.com/iCrawlToGo)
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "@naval-base/ms",
"version": "3.0.0",
"description": "Millisecond conversion utility",
"main": "dist/index.js",
"typings": "typings/index.d.ts",
"author": "iCrawl <[email protected]>",
"license": "MIT",
"scripts": {
"prebuild": "pnpm run lint",
"build": "tsc",
"lint": "eslint src --ext .ts",
"pretest": "pnpm run lint",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Naval-Base/ms.git"
},
"bugs": {
"url": "https://github.com/Naval-Base/ms/issues"
},
"homepage": "https://github.com/Naval-Base/ms#readme",
"devDependencies": {
"@types/jest": "^24.9.1",
"@types/node": "^13.5.0",
"@typescript-eslint/eslint-plugin": "^2.17.0",
"@typescript-eslint/parser": "^2.17.0",
"eslint": "^6.8.0",
"eslint-config-marine": "^6.0.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-prettier": "^3.1.2",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"ts-jest": "^25.0.0",
"typescript": "^3.7.5"
},
"eslintConfig": {
"extends": "marine/prettier/node",
"parserOptions": {
"project": "tsconfig.eslint.json"
},
"env": {
"jest": true
}
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"globals": {
"ts-jest": {
"tsConfig": "tsconfig.jest.json"
}
}
}
}
Loading

0 comments on commit 6711eaf

Please sign in to comment.