
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
The snakeize npm package is used to convert object keys to snake_case. This is particularly useful when working with APIs or databases that follow the snake_case naming convention.
Convert object keys to snake_case
This feature allows you to convert the keys of an object from camelCase or other formats to snake_case.
const snakeize = require('snakeize');
const input = { firstName: 'John', lastName: 'Doe' };
const output = snakeize(input);
console.log(output); // { first_name: 'John', last_name: 'Doe' }
Nested object key conversion
This feature allows you to convert the keys of nested objects to snake_case.
const snakeize = require('snakeize');
const input = { user: { firstName: 'John', lastName: 'Doe' }, age: 30 };
const output = snakeize(input);
console.log(output); // { user: { first_name: 'John', last_name: 'Doe' }, age: 30 }
The camelcase-keys package converts object keys to camelCase. It is similar to snakeize but focuses on converting keys to camelCase instead of snake_case.
The decamelize-keys package converts object keys from camelCase to another format, such as snake_case. It is similar to snakeize but offers more flexibility in the target format.
Lodash is a utility library that provides a wide range of functions for manipulating objects, arrays, and other data structures. It includes a method for converting object keys to snake_case, but it is a more general-purpose library compared to snakeize.
recursively transform key strings from camel-case to underscore-style. Derives directly from substack's camelize
var snakeize = require('snakeize');
var obj = {
feeFieFoe: 'fum',
beepBoop: [
{ 'abcXyz': 'mno' },
{ 'FooBar': 'baz' },
{ 'CheeseID': 'wensleydale' }
]
};
var res = snakeize(obj);
console.log(JSON.stringify(res, null, 2));
output:
{
"fee_fie_foe": "fum",
"beep_boop": [
{
"abc_xyz": "mno"
},
{
"foo_bar": "baz"
},
{
"cheese_id": "wensleydale"
}
]
}
var snakeize = require('snakeize')
Convert the key strings in obj
from camel-case to underscore-stlye recursively.
With npm do:
npm install snakeize
To use in the browser, use browserify or component:
component install nathan7/snakeize
MIT
FAQs
recursively transform key strings from camel-case to underscore-style
The npm package snakeize receives a total of 207,248 weekly downloads. As such, snakeize popularity was classified as popular.
We found that snakeize 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.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.