common-utils-helper
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

common-utils-helper

It is a place to provide helper methods used in NodeJS for common projects.

JSON parse helpers

Date Reviver

You may use the dateReviver function to convert the strings that represents an ISO Date format to a Date Objects instead of strings.

var CommonUtilsHelper = require ('CommonUtilsHelper');
var jsonStr = '{"date":"2017-04-01T12:00:00Z"}';
var obj = JSON.parse(jsonStr, CommonUtilsHelper.JSON.dateReviver);
// The typeof obj.date should be object instead of string

This will convert a sting of type '2017-04-01T12:00:00Z' to a Date object of the same date/time. Access to Date methods would be available directly from the parsed date property.

Package Sidebar

Install

npm i common-utils-helper

Weekly Downloads

0

Version

0.3.0

License

ISC

Last publish

Collaborators

  • mohmaherid