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

edtf

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edtf - npm Package Compare versions

Comparing version 2.7.2 to 2.8.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

2.8.0 / 2020-06-08
==================
* Interpret single integer input as Unix timestamp (like native Date)
* Interpret 5+ digit strings as Unix timestamp
2.6.0 / 2019-03-15

@@ -2,0 +7,0 @@ ==================

17

index.js

@@ -12,2 +12,4 @@ 'use strict'

const UNIX_TIME = /^\d{5,}$/
function edtf(...args) {

@@ -17,6 +19,15 @@ if (!args.length)

if (args.length === 1 && typeof args[0] === 'object')
return new (edtf[args[0].type] || edtf.Date)(args[0])
if (args.length === 1) {
switch (typeof args[0]) {
case 'object':
return new (edtf[args[0].type] || edtf.Date)(args[0])
case 'number':
return new edtf.Date(args[0])
case 'string':
if ((UNIX_TIME).test(args[0]))
return new edtf.Date(Number(args[0]))
}
}
const res = parse(...args)
let res = parse(...args)
return new edtf[res.type](res)

@@ -23,0 +34,0 @@ }

6

package.json
{
"name": "edtf",
"version": "2.7.2",
"version": "2.8.0",
"description": "Extended Date Time Format (EDTF) / ISO 8601-2 Parser and Library",

@@ -42,6 +42,6 @@ "main": "index.js",

"chai": "^4.2.0",
"eslint": "^7.0.0",
"eslint": "^7.2.0",
"istanbul": "^0.4.3",
"mocha": "^7.1.2"
"mocha": "^7.2.0"
}
}
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