date-duration
Advanced tools
Comparing version 0.3.0 to 1.0.0
'use strict'; | ||
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })(); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
exports.default = createDuration; | ||
@@ -12,4 +15,2 @@ | ||
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } | ||
var toInt = function toInt(value) { | ||
@@ -24,8 +25,6 @@ return parseInt(value || '0', 10); | ||
return new Date(+value); | ||
}; | ||
}, | ||
parser = /P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?/, | ||
dateMethods = new Map([['year', 'FullYear'], ['month', 'Month'], ['week', 'Date'], ['day', 'Date'], ['hour', 'UTCHours'], ['minute', 'UTCMinutes'], ['second', 'UTCSeconds']]); | ||
var parser = /P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?/; | ||
var dateMethods = new Map([['year', 'UTCFullYear'], ['month', 'UTCMonth'], ['week', 'UTCDate'], ['day', 'UTCDate'], ['hour', 'UTCHours'], ['minute', 'UTCMinutes'], ['second', 'UTCSeconds']]); | ||
function createDuration(iso) { | ||
@@ -50,2 +49,3 @@ var _iso$match = iso.match(parser); | ||
if (week) { | ||
@@ -61,2 +61,3 @@ week = week * 7; | ||
}, | ||
addTo: function addTo(date) { | ||
@@ -63,0 +64,0 @@ var d = clone(date); |
{ | ||
"name": "date-duration", | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"description": "Manipulate Date objects with ISO 8601-formatted durations", | ||
@@ -9,3 +9,4 @@ "main": "dist/duration.js", | ||
"build": "babel --source-maps -d dist/ src/", | ||
"test": "npm run lint && npm run build && mocha --compilers js:babel-register test", | ||
"mocha": "TZ=Europe/Brussels mocha --compilers js:babel-register test && TZ=America/New_York mocha --compilers js:babel-register test", | ||
"test": "npm run lint && npm run build && npm run mocha", | ||
"clean": "rm -rf dist", | ||
@@ -37,9 +38,8 @@ "preversion": "npm run test", | ||
"devDependencies": { | ||
"babel-cli": "6.3.17", | ||
"babel-register": "6.3.13", | ||
"babel-eslint": "4.1.6", | ||
"babel-preset-es2015": "6.3.13", | ||
"eslint": "1.10.3", | ||
"mocha": "2.3.4" | ||
"babel-cli": "6.10.1", | ||
"babel-preset-es2015": "6.9.0", | ||
"babel-register": "6.9.0", | ||
"eslint": "3.0.1", | ||
"mocha": "2.5.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
5
0
11812