
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
@segment/isodate-traverse
Advanced tools
Traverse an object and convert all ISO strings into Dates.
@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 0 weekly downloads. As such, @segment/isodate-traverse popularity was classified as not 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
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.