Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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 491,890 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.