Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@segment/isodate-traverse
Advanced tools
@segment/isodate-traverse is an npm package designed to traverse through objects and convert ISO 8601 date strings into JavaScript Date objects. This can be particularly useful when dealing with JSON data that includes date strings, ensuring that date manipulations and comparisons are handled correctly.
Convert ISO 8601 date strings to Date objects
This feature allows you to traverse through an object and automatically convert any ISO 8601 date strings into JavaScript Date objects. This ensures that date manipulations and comparisons are handled correctly.
const traverse = require('@segment/isodate-traverse');
const data = {
createdAt: '2023-10-01T12:00:00Z',
user: {
lastLogin: '2023-10-02T15:30:00Z'
}
};
const result = traverse(data);
console.log(result);
// Output:
// {
// createdAt: 2023-10-01T12:00:00.000Z,
// user: {
// lastLogin: 2023-10-02T15:30:00.000Z
// }
// }
date-fns is a comprehensive library for working with dates in JavaScript. It provides a wide range of functions for parsing, formatting, and manipulating dates. Unlike @segment/isodate-traverse, date-fns does not automatically traverse objects to convert date strings but offers extensive utilities for date operations.
Moment.js is a popular library for parsing, validating, manipulating, and formatting dates in JavaScript. While it offers powerful date manipulation capabilities, it does not automatically traverse objects to convert ISO date strings like @segment/isodate-traverse.
Luxon is a modern JavaScript library for working with dates and times, built by one of the Moment.js developers. It provides a more modern API and better support for internationalization. Similar to date-fns and Moment.js, Luxon does not automatically traverse objects to convert date strings.
Traverse an object (or array) and convert all ISO strings into Dates.
$ npm install @segment/isodate-traverse
var traverse = require('@segment/isodate-traverse');
var obj = {
date: '2013-09-04T00:57:26.434Z'
};
var traversed = traverse(obj);
// {
// date: [object Date]
// }
Traverse an obj
, converting all ISO strings to real Dates. By default, strict
mode will be enabled, requiring at least YYYY-MM-DD
FAQs
Traverse an object and convert all ISO strings into Dates.
The npm package @segment/isodate-traverse receives a total of 205,509 weekly downloads. As such, @segment/isodate-traverse popularity was classified as popular.
We found that @segment/isodate-traverse demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 147 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.