date-duration
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -49,6 +49,18 @@ 'use strict'; | ||
function createDuration(iso) { | ||
var _iso$match = iso.match(parser), | ||
_iso$match2 = (0, _toArray3.default)(_iso$match), | ||
parts = _iso$match2.slice(1); | ||
iso = iso || ''; | ||
if (iso && iso.length > 0 && iso[0] !== 'P') { | ||
throw new Error('Invalid duration: ' + iso + ' (invalid format)'); | ||
} | ||
var _ref = iso.match(parser) || [0, 0, 0, 0, 0, 0, 0, 0], | ||
_ref2 = (0, _toArray3.default)(_ref), | ||
parts = _ref2.slice(1); | ||
if (parts.every(function (part) { | ||
return typeof part === 'undefined'; | ||
})) { | ||
throw new Error('Invalid duration: ' + iso + ' (no date or time elements specified)'); | ||
} | ||
var _parts$map = parts.map(toInt), | ||
@@ -55,0 +67,0 @@ _parts$map2 = (0, _slicedToArray3.default)(_parts$map, 7), |
{ | ||
"name": "date-duration", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Manipulate Date objects with ISO 8601-formatted durations", | ||
@@ -38,7 +38,7 @@ "main": "dist/duration.js", | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-cli": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-register": "^6.24.1", | ||
"eslint": "^4.4.1", | ||
"babel-register": "^6.26.0", | ||
"eslint": "^4.7.2", | ||
"eslint-config-standard": "^10.2.1", | ||
@@ -49,7 +49,7 @@ "eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"mocha": "^3.5.0" | ||
"mocha": "^3.5.3" | ||
}, | ||
"dependencies": { | ||
"babel-runtime": "^6.25.0" | ||
"babel-runtime": "^6.26.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
13501
130
7
Updatedbabel-runtime@^6.26.0