Commit eb22971e by Chavee Issariyapat

handel null and undefined

parent 4c0d9088
...@@ -26,6 +26,9 @@ var y = d * 365.25; ...@@ -26,6 +26,9 @@ var y = d * 365.25;
module.exports = function (val, options) { module.exports = function (val, options) {
options = options || {}; options = options || {};
if (val == null || val == undefined) return undefined;
var type = typeof val; var type = typeof val;
if (type === 'string' && val.length > 0) { if (type === 'string' && val.length > 0) {
return parse(val); return parse(val);
......
{ {
"name": "nexpietime", "name": "nexpietime",
"version": "1.0.0", "version": "1.0.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "1.0.0", "version": "1.0.2",
"license": "ISC", "license": "ISC",
"dependencies": {
"ms": "^2.1.3"
},
"devDependencies": { "devDependencies": {
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-each": "0.0.1", "chai-each": "0.0.1",
...@@ -169,11 +166,6 @@ ...@@ -169,11 +166,6 @@
"integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==",
"dev": true "dev": true
}, },
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/nise": { "node_modules/nise": {
"version": "1.5.3", "version": "1.5.3",
"resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz",
...@@ -383,11 +375,6 @@ ...@@ -383,11 +375,6 @@
"integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==",
"dev": true "dev": true
}, },
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"nise": { "nise": {
"version": "1.5.3", "version": "1.5.3",
"resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz",
......
{ {
"name": "nexpietime", "name": "nexpietime",
"version": "1.0.1", "version": "1.0.2",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment