Comparing version 1.0.0 to 1.0.1
@@ -5,3 +5,3 @@ "use strict"; | ||
(function (LEVEL) { | ||
LEVEL[LEVEL["ss"] = 0] = "ss"; | ||
LEVEL[LEVEL["ms"] = 0] = "ms"; | ||
LEVEL[LEVEL["s"] = 1] = "s"; | ||
@@ -17,3 +17,3 @@ LEVEL[LEVEL["m"] = 2] = "m"; | ||
constructor(level) { | ||
this.level = LEVEL.ss; | ||
this.level = LEVEL.ms; | ||
if (level) { | ||
@@ -30,4 +30,4 @@ this.setLevel(level); | ||
} | ||
ss(time) { | ||
return time === 0 ? 0 : this.cal(time, LEVEL.ss); | ||
ms(time) { | ||
return time === 0 ? 0 : this.cal(time, LEVEL.ms); | ||
} | ||
@@ -91,3 +91,3 @@ s(time) { | ||
time *= 1000; | ||
case LEVEL.ss: | ||
case LEVEL.ms: | ||
time *= 1; | ||
@@ -101,4 +101,4 @@ break; | ||
exports.dtss = dtss; | ||
exports.ss = (time) => { | ||
return new dtss().ss(time); | ||
exports.ms = (time) => { | ||
return new dtss().ms(time); | ||
}; | ||
@@ -105,0 +105,0 @@ exports.s = (time) => { |
export enum LEVEL { | ||
ss, s, m, h, d, M, y | ||
ms, s, m, h, d, M, y | ||
} | ||
@@ -9,3 +9,3 @@ | ||
public static LEVEL = LEVEL; | ||
private level = LEVEL.ss; | ||
private level = LEVEL.ms; | ||
@@ -27,4 +27,4 @@ constructor(level?: LEVEL) { | ||
public ss(time: number) { | ||
return time === 0 ? 0 : this.cal(time, LEVEL.ss); | ||
public ms(time: number) { | ||
return time === 0 ? 0 : this.cal(time, LEVEL.ms); | ||
} | ||
@@ -95,3 +95,3 @@ | ||
time *= 1000; | ||
case LEVEL.ss: | ||
case LEVEL.ms: | ||
time *= 1; | ||
@@ -105,4 +105,4 @@ break; | ||
export const ss = (time: number) => { | ||
return new dtss().ss(time); | ||
export const ms = (time: number) => { | ||
return new dtss().ms(time); | ||
}; | ||
@@ -109,0 +109,0 @@ export const s = (time: number) => { |
{ | ||
"name": "dtss", | ||
"version": "1.0.0", | ||
"description": "The project is generated in [`arylo-init`](https://www.npmjs.com/package/arylo-init)", | ||
"version": "1.0.1", | ||
"description": "Set the delay time quickly.", | ||
"main": "dist/index.js", | ||
@@ -18,4 +18,8 @@ "types": "lib/index.ts", | ||
"keywords": [ | ||
"arylo" | ||
"arylo", | ||
"date" | ||
], | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"files": [ | ||
@@ -36,3 +40,3 @@ "dist", | ||
"devDependencies": { | ||
"@types/node": "^10.1.2", | ||
"@types/node": "^10.3.0", | ||
"ava": "^0.25.0", | ||
@@ -39,0 +43,0 @@ "eslint": "^4.19.1", |
# dtss | ||
The project is generated in [`arylo-init`](https://www.npmjs.com/package/arylo-init) | ||
Set the delay time quickly. | ||
@@ -13,2 +13,22 @@ [![node][NPM_URL]][NPM_HREF] | ||
## Usage | ||
typescript: | ||
```typescript | ||
import dtss = require('dtss'); | ||
dtss.s(58); // 58 * 1000 ms => 58s | ||
dtss.m(14); // 14 * 60 * 1000 ms => 14min | ||
dtss.h(7); // 7 * 60 * 60 * 1000 ms => 7hour | ||
``` | ||
javascript: | ||
```javascript | ||
const dtss = require('dtss'); | ||
dtss.s(58); // 58 * 1000 ms => 58s | ||
dtss.m(14); // 14 * 60 * 1000 ms => 14min | ||
dtss.h(7); // 7 * 60 * 60 * 1000 ms => 7hour | ||
``` | ||
[NPM_URL]: https://img.shields.io/node/v/dtss.svg?style=flat-square&maxAge=600 | ||
@@ -15,0 +35,0 @@ [NPM_HREF]: https://www.npmjs.com/package/dtss |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9818
46