
Security Fundamentals
Turtles, Clams, and Cyber Threat Actors: Shell Usage
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.
immutable-parsejs
Advanced tools
Sometimes when working with large data sets that come from an external source, think API, we need someway of converting that data into Immutable structures. This is useful, not only for type safety, but also for comparison checks and the improved performa
Sometimes when working with large data sets that come from an external source, think API, we need someway of converting that data into Immutable structures. This is useful, not only for type safety, but also for comparison checks and the improved performance they provide.
For more on why, check out Immutable's documentation: https://immutable-js.com/
This package (389 bytes GZipped) exports a single function, parseJs
, that can be used to wrap a nested data structure in Immutable objects, namely List
and Record
.
Install with Yarn:
$ yarn add immutable-parsejs
Install with NPM:
$ npm i immutable-parsejs
Once you have your data structure, either an object, or an array of objects, you can pass that into the parseJs
function:
import { parseJs } from 'immutable-parsejs';
const dataSet = [
{ userId: 1001, firstName: 'John' },
{ userId: 1002, firstName: 'Joe' },
];
const result = parseJs(dataSet); // <-- List<Record>;
const { firstName } = result.get(0);
/*[...]*/
console.log(firstName); // <-- John
/*[...]*/
console.log(result === result.setIn([0, 'firstName'], 'John')); // <-- true
console.log(result === result.setIn([0, 'firstName'], 'Sam')); // <-- false
Now your data set is wrapped recursively, objects will now be Record
's, and arrays will be List
's.
When working with complex structures in TypeScript, getting nested types to work is tricky. Types are automatically infered, but they can only do so much. If you have an array of objects, that themselves have arrays, TypeScript will incorrectly infer the arrays within an object to be array primitives, not List
's. To get around this, I'd suggest that you define your data structure via an interface upfront (this is good practice, anyway).
FAQs
Sometimes when working with large data sets that come from an external source, think API, we need someway of converting that data into Immutable structures. This is useful, not only for type safety, but also for comparison checks and the improved performa
The npm package immutable-parsejs receives a total of 0 weekly downloads. As such, immutable-parsejs popularity was classified as not popular.
We found that immutable-parsejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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 Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.
Security News
At VulnCon 2025, NIST scrapped its NVD consortium plans, admitted it can't keep up with CVEs, and outlined automation efforts amid a mounting backlog.
Product
We redesigned our GitHub PR comments to deliver clear, actionable security insights without adding noise to your workflow.