typedconverter
Advanced tools
Comparing version 2.3.6 to 2.3.7-canary.kbwv88am.0
{ | ||
"name": "typedconverter", | ||
"version": "2.3.6", | ||
"version": "2.3.7-canary.kbwv88am.0+078d37d", | ||
"description": "Convert object into classes match with TypeScript type annotation", | ||
@@ -13,3 +13,3 @@ "main": "lib/index.js", | ||
"test": "jest", | ||
"prepublish": "tsc -p tsconfig.build.json", | ||
"compile": "tsc -p tsconfig.build.json", | ||
"gen": "ts-node src/generator.ts", | ||
@@ -23,5 +23,5 @@ "clean": "rm -rf src/*.js && rm -rf test/*.js && rm -rf lib", | ||
"@types/validator": "^13.0.0", | ||
"tinspector": "^3.1.0", | ||
"tinspector": "3.2.3-canary.kbwv88am.0+078d37d", | ||
"tslib": "^2.0.0", | ||
"validator": "^13.0.0" | ||
"validator": "^13.1.1" | ||
}, | ||
@@ -31,5 +31,5 @@ "devDependencies": { | ||
"@types/ejs": "^3.0.4", | ||
"@types/hapi__joi": "^17.1.0", | ||
"@types/jest": "^25.2.3", | ||
"@types/lodash": "^4.14.153", | ||
"@types/hapi__joi": "^17.1.2", | ||
"@types/jest": "^26.0.0", | ||
"@types/lodash": "^4.14.156", | ||
"coveralls": "^3.1.0", | ||
@@ -39,5 +39,5 @@ "ejs": "^3.1.3", | ||
"lodash": "^4.17.15", | ||
"ts-jest": "^26.0.0", | ||
"ts-jest": "^26.1.1", | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.3" | ||
"typescript": "^3.9.5" | ||
}, | ||
@@ -49,3 +49,4 @@ "bugs": { | ||
"url": "https://github.com/plumier/typedconverter" | ||
} | ||
}, | ||
"gitHead": "078d37d1ba9e002ea2272403880fab107a8c1817" | ||
} |
@@ -1,15 +0,34 @@ | ||
/** | ||
* This module will serialize function as [typeof: <Function Name>] instead of [Function] | ||
*/ | ||
function extractValues(date) { | ||
return { | ||
year: date.getFullYear(), | ||
month: date.getMonth(), | ||
date: date.getDate() | ||
} | ||
} | ||
function isToday(date) { | ||
var today = extractValues(new Date()); | ||
var value = extractValues(date); | ||
if ( | ||
today.year !== value.year || | ||
today.month !== value.month || | ||
today.date !== value.date | ||
) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
module.exports = { | ||
test(val) { | ||
return val instanceof Date; | ||
return val && typeof val === 'object' && 'getFullYear' in val | ||
}, | ||
print(d) { | ||
return [ | ||
d.getFullYear(), | ||
('0' + (d.getMonth() + 1)).slice(-2), | ||
('0' + d.getDate()).slice(-2) | ||
].join('-'); | ||
print(val) { | ||
if(isToday(val)) return "DATE NOW" | ||
var d = extractValues(val); | ||
return [d.year, d.month, d.date].join('-'); | ||
}, | ||
} |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
45343
26
915
2
1
- Removed@types/acorn@4.0.5(transitive)
- Removed@types/estree@1.0.6(transitive)
- Removedacorn@7.3.1(transitive)
- Removedreflect-metadata@0.1.14(transitive)
- Removedtinspector@3.2.2(transitive)
Updatedvalidator@^13.1.1