Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typedconverter

Package Overview
Dependencies
Maintainers
1
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedconverter - npm Package Compare versions

Comparing version 2.3.6 to 2.3.7-canary1592806142.0

9

package.json
{
"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('-');
},
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc