iso-datestring-validator
Advanced tools
Comparing version 2.1.4 to 2.2.0
@@ -1,1 +0,1 @@ | ||
"use strict";function i(i){for(var e in i)exports.hasOwnProperty(e)||(exports[e]=i[e])}Object.defineProperty(exports,"__esModule",{value:!0}),i(require("./is-valid-date/is-valid-date.function")),i(require("./is-valid-iso-datestring/is-valid-iso-datestring.function")),i(require("./is-valid-time/is-valid-time.function")),i(require("./is-valid-year-month/is-valid-year-month.function")); | ||
(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){return void 0===t&&(t="-"),new RegExp("^(?!0{4}"+t+"0{2}"+t+"0{2})((?=[0-9]{4}"+t+"(((0[^2])|1[0-2])|02(?="+t+"(([0-1][0-9])|2[0-8])))"+t+"[0-9]{2})|(?=((([13579][26])|([2468][048])|(0[48]))0{2})|([0-9]{2}((((0|[2468])[48])|[2468][048])|([13579][26])))"+t+"02"+t+"29))([0-9]{4})"+t+"(?!((0[469])|11)"+t+"31)((0[1,3-9]|1[0-2])|(02(?!"+t+"3)))"+t+"([0-2][0-9]|3[0-1])$").test(e)}function n(e){var t=/\D/.exec(e);return t?t[0]:""}function i(e,t,r){void 0===t&&(t=":"),void 0===r&&(r=!1);var i=new RegExp("^([0-1]|2(?=([0-3])|4"+t+"00))[0-9]"+t+"[0-5][0-9]("+t+"([0-5]|6(?=0))[0-9])?(.[0-9]{1,9})?$");if(!r||!/[Z+\-]/.test(e))return i.test(e);if(/Z$/.test(e))return i.test(e.replace("Z",""));var o=e.includes("+"),a=e.split(/[+-]/),u=a[0],d=a[1];return i.test(u)&&function(e,t,r){return void 0===r&&(r=":"),new RegExp(t?"^(0(?!(2"+r+"4)|0"+r+"3)|1(?=([0-1]|2(?="+r+"[04])|[34](?="+r+"0))))([03469](?="+r+"[03])|[17](?="+r+"0)|2(?="+r+"[04])|5(?="+r+"[034])|8(?="+r+"[04]))"+r+"([03](?=0)|4(?=5))[05]$":"^(0(?=[^0])|1(?=[0-2]))([39](?="+r+"[03])|[0-24-8](?="+r+"00))"+r+"[03]0$").test(e)}(d,o,n(d))}function o(e){var t,o=e.split("T"),a=o[0],u=o[1],d=r(a,n(a));return!!u&&d&&i(u,(t=u.match(/[^Z+\-\d]/),Array.isArray(t)?t[0]:""),!0)}function a(e,t){return void 0===t&&(t="-"),new RegExp("^[0-9]{4}"+t+"(0(?=[^0])|1(?=[0-2]))[0-9]$").test(e)}e.r(t),e.d(t,{isValidDate:()=>r,isValidISODateString:()=>o,isValidTime:()=>i,isValidYearMonth:()=>a});var u=exports;for(var d in t)u[d]=t[d];t.__esModule&&Object.defineProperty(u,"__esModule",{value:!0})})(); |
@@ -7,6 +7,8 @@ { | ||
"moment": "^2.24.0", | ||
"terser": "^5.3.3", | ||
"ts-jest": "^24.0.2", | ||
"ts-loader": "^9.2.5", | ||
"tslint": "^5.20.1", | ||
"typescript": "^3.7.4" | ||
"typescript": "^3.7.4", | ||
"webpack": "^5.51.1", | ||
"webpack-cli": "^4.8.0" | ||
}, | ||
@@ -17,3 +19,3 @@ "jest": { | ||
"scripts": { | ||
"build": "tsc && node ./minify-dist.js", | ||
"build": "webpack", | ||
"lint": "tslint -p tsconfig.json -c tslint.json", | ||
@@ -30,6 +32,6 @@ "test": "jest --verbose", | ||
"name": "Volodymyr Yepishev", | ||
"email": "yepishevv@gmail.com" | ||
"email": "i.m.bwca@gmail.com" | ||
}, | ||
"license": "MIT", | ||
"version": "2.1.4", | ||
"version": "2.2.0", | ||
"keywords": [ | ||
@@ -36,0 +38,0 @@ "date", |
@@ -13,4 +13,4 @@ # iso-datestring-validator | ||
``` | ||
isValidTime('14-45-15.000+00-00', '-', true) | ||
```js | ||
isValidTime('14-45-15.000+00-00', '-', true); | ||
// will yield wrong result | ||
@@ -29,3 +29,3 @@ ``` | ||
``` | ||
```js | ||
npm i --save iso-datestring-validator | ||
@@ -36,3 +36,3 @@ ``` | ||
``` | ||
```js | ||
yarn add iso-datestring-validator | ||
@@ -43,3 +43,3 @@ ``` | ||
``` | ||
```ts | ||
import * as isoDatestringValidator from 'iso-datestring-validator'; | ||
@@ -50,3 +50,3 @@ ``` | ||
``` | ||
```ts | ||
import { | ||
@@ -66,3 +66,3 @@ isValidDate, | ||
``` | ||
```ts | ||
import { isValidDate } from 'iso-datestring-validator'; | ||
@@ -87,3 +87,3 @@ | ||
``` | ||
```ts | ||
import { isValidTime } from 'iso-datestring-validator'; | ||
@@ -101,12 +101,11 @@ | ||
// pass time, separator and boolean flag to enable zone offset check | ||
isValidTime('14:45:15.000+00:00', ':', true) | ||
isValidTime('14:45:15.000+00:00', ':', true); | ||
// true | ||
// you can take advantage of default separator if you pass undefined as second param | ||
isValidTime('14:45:15.000+00:00', undefined, true) | ||
isValidTime('14:45:15.000+00:00', undefined, true); | ||
// true | ||
isValidTime('144515.000Z', '', true) | ||
isValidTime('144515.000Z', '', true); | ||
// true | ||
``` | ||
@@ -118,3 +117,3 @@ | ||
``` | ||
```ts | ||
import { isValidYearMonth } from 'iso-datestring-validator'; | ||
@@ -133,3 +132,3 @@ | ||
``` | ||
```ts | ||
import { isValidISODateString } from 'iso-datestring-validator'; | ||
@@ -142,5 +141,6 @@ | ||
// true | ||
``` | ||
That's all about this package. Have fun, feel free to contribute with some test :] | ||
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/bwca) |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
1
9547
10
11