typedconverter
Advanced tools
Comparing version 2.3.6 to 2.3.7-canary1592806142.0
{ | ||
"name": "typedconverter", | ||
"version": "2.3.6", | ||
"version": "2.3.7-canary1592806142.0+06cb125", | ||
"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,3 +23,3 @@ "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-canary1592806142.0+06cb125", | ||
"tslib": "^2.0.0", | ||
@@ -47,3 +47,4 @@ "validator": "^13.0.0" | ||
"url": "https://github.com/plumier/typedconverter" | ||
} | ||
}, | ||
"gitHead": "06cb125750ec650428ad9dd81e1646264673dfeb" | ||
} |
@@ -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('-'); | ||
}, | ||
} |
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
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
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
45345
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)