
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
keys-converter
Advanced tools
This package provide a util function to convert snake case object keys to camel case
A lib to convert object keys to camel-case or snake-case.
npm i keys-converter
# or
yarn add keys-converter
Use on browser
<script src="https://cdn.jsdelivr.net/npm/keys-converter@3.0.3/bundle/index.min.js"></script>
<script type="module">
import { objectKeysToCamelCaseV2, objectKeysToSnakeCaseV2 } from 'https://cdn.skypack.dev/keys-converter';
</script>
import { objectKeysToSnakeCaseV2, objectKeysToCamelCaseV2 } from 'keys-converter';
objectKeysToCamelCaseV2
and objectKeysToSnakeCaseV2
snake_case
to camelCase
import { objectKeysToCamelCaseV2 } from 'keys-converter';
const user = {
_id: "sf2309sdf0010",
company_name: "some name",
user_password: "some@pass123",
created_at: "2020-01-01",
updated_at: "2020-01-01"
};
const result = objectKeysToCamelCaseV2(user);
console.log(result);
> `{
_id: "sf2309sdf0010",
companyName: "some name",
userPassword: "some@pass123",
createdAt: "2020-01-01",
updatedAt: "2020-01-01"
}`
camelCase
to snake_case
import { objectKeysToSnakeCaseV2} from 'keys-converter';
const user = {
_id: "sf2309sdf0010",
companyName: "some name",
userPassword: "some@pass123",
createdAt: "2020-01-01",
updatedAt: "2020-01-01"
};
const result = objectKeysToSnakeCaseV2(user);
console.log(result);
> `{
_id: "sf2309sdf0010",
company_name: "some name",
user_password: "some@pass123",
created_at: "2020-01-01",
updated_at: "2020-01-01"
}`
The function objectKeysToCamelCaseV2
receives an object.
You can to infer the return type as argument so the result returned will have types
result
and input
const user = {
_id: "sf2309sdf0010",
companyName: "some name",
userPassword: "some@pass123",
createdAt: "2020-01-01",
updatedAt: "2020-01-01"
};
/** Dynamic Type */
interface ResultType {
_id: string;
company_name: string,
user_password: string,
created_at: "2020-01-01",
updated_at: "2020-01-01"
}
const result = objectKeysToSnakeCaseV2<ResultType>(user);
If you provide the input type the function will validate the arguments, So if you provide the result type the returned value will have "types"
- Function does not remove the first underscore for security
example
If your object has a protected prop like _id
It will keep it
FAQs
This package provide a util function to convert snake case object keys to camel case
The npm package keys-converter receives a total of 21 weekly downloads. As such, keys-converter popularity was classified as not popular.
We found that keys-converter 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.