Javascript object reamp

Search for a command to run...

No comments yet. Be the first to comment.
All of us command line fans have our common CLI tools ready for tasks such as jq for JSON manipulation and curl for creating HTTP requests. I decided to revisit these tools and refactor them to check if I can make them more flexible and easy to use b...
Your team has 14 versions of the same code review skill across 5 repos, with no way to sync them. when one improves, the others don't. drop a folder in .claude/skills/ and pray nothing drifts. source

AI agents are unreasonably good at writing SQL. They get specific error messages, fix their own mistakes in one retry, and can introspect query performance with EXPLAIN ANALYZE before you even ask. No

n8n has over 400 integrations. Zapier claims 7,000+. Every single one was hand-built, tested against a moving API, and will eventually break when that API ships a v2. The entire workflow automation in

Part of the "Your Next Startup" series, where I break down startup ideas I think are worth building. Auth0 sold for \(6.5B. Okta is worth \)15B+. CyberArk, Delinea, BeyondTrust, all printing money fro

For as long as software has existed, we've been building two doors into our systems. Door one: the UI, a carefully designed surface where humans point, click, and occasionally rage-quit. Door two: the

in my daily job as a full stack js developer I often need to manipulate js objects, either remove fields or transform to a new structure etc.
I decided to create an npm module object-remap, to make this repeated task more reliable, reduce code, and create cleaner code.
let's look at the examples:
const objectRemap = require("object-remap");
const obj = {
a: 1,
b: 2,
c: 3,
d: {
e: 4,
f: [1, 2, 3]
}
};
//simple usage
const fields = ["a", "b", "c"];
let newObj = objectRemap(obj, fields);
console.log({ obj, newObj });
/*
{
obj: { a: 1, b: 2, c: 3, d: { e: 4, f: [Array] } },
newObj: { a: 1, b: 2, c: 3}
}
*/
//advance usage
const fieldsMap = [
{
origin: "a",
target: "a"
},
{
origin: "d.e",
target: "e"
},
{
origin: "d.f",
target: "f",
formatter: data => `${data.length} items`
}
];
newObj = objectRemap(obj, fieldsMap);
console.log({ obj, newObj });
/*
{
obj: { a: 1, b: 2, c: 3, d: { e: 4, f: [Array] } },
newObj: { a: 1, e: 4, f: '3 items' }
}
*/
for getting started install the package with npm:
npm i -S object-remap