Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dafo

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dafo - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2-majon.0

toSeconds.js

1

index.js

@@ -19,2 +19,3 @@ 'use strict';

parse : require('./parse'),
toSeconds : require('./toSeconds'),
};

2

package.json

@@ -14,3 +14,3 @@ {

"name": "dafo",
"version": "0.1.1",
"version": "0.1.2-majon.0",
"main": "index.js",

@@ -17,0 +17,0 @@ "keywords": [

@@ -21,2 +21,3 @@ # dafo

* [dafo.parse](#dafoparse)
* [dafo.toSeconds](#dafotoseconds)
* [Others](#others)

@@ -198,2 +199,22 @@ * [Why dafo](#why-dafo)

### dafo.toSeconds
```javascript
const dafo = require('dafo');
let secondCount = dafo.toSeconds('1d2h');
```
* Date __dafo.toSeconds__(string *age*)
Argument *age* is an expression used to describe age, generally that of HTTP cache.
| Unit | Meaning |
| :---- | :------------------------------------------ |
| __s__ | second(s) |
| __m__ | minute(s) |
| __h__ | hour(s) |
| __d__ | day(s) |
| __M__ | month(es) |
| __Y__ | year(s) |
### Others

@@ -200,0 +221,0 @@

@@ -0,1 +1,5 @@

/**
* 本例中,部分测试用例依赖的占位符尚未实现。
*/
'use strict';

@@ -164,3 +168,3 @@

it('Y/m/d/H\\H/is', () => {
console.log(date_format(d1, 'Y/m/d/H\\H/is'));
assert.strictEqual(date_format(d1, 'Y/m/d/H\\H/is'), '2000/01/01/13H/1406');
});

@@ -167,0 +171,0 @@

@@ -118,2 +118,12 @@ 'use strict';

it.only('toSeconds()', () => {
assert.equal(dafo.toSeconds( '30s'), 30);
assert.equal(dafo.toSeconds( '1m'), 60);
assert.equal(dafo.toSeconds( '1h'), 3600);
assert.equal(dafo.toSeconds( '1d'), 86400);
assert.equal(dafo.toSeconds( '1d1m'), 86400 + 60);
assert.equal(dafo.toSeconds( ' 1M'), 86400 * 30);
assert.equal(dafo.toSeconds( ' 1y'), 86400 * 365);
assert.equal(dafo.toSeconds( ' 1Q'), 86400 * 90);
})
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc