
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
object-case-builder
Advanced tools
Is simple util who can change object key names by case strategy. For example, your yml config uses snake case but you need a javascript object with keys in the lower camel case. It is this simple functionality give this package!
$ npm i --save object-case-builder
snake-case to lower camel caseimport {
ObjectCaseBuilder,
PropertyNamingStrategyEnum,
} from 'object-case-builder';
const input: object = {
'max_users_count': 1,
'auth_secret_token': 'SECRET TOKEN',
'credit_card_number': 00000000000000,
}
const output: object = new ObjectCaseBuilder()
.setPropertyNamingStrategy(PropertyNamingStrategyEnum.LOWER_CAMEL_CASE)
.formatObject(
input,
PropertyNamingStrategyEnum.SNAKE_CASE
);
console.log(output);
/* console output
{
maxUsersCount: 1,
authSecretToken: 'SECRET TOKEN',
creditCardNumber: 00000000000000
}
*/
kebab-case to screaming-snake-caseimport {
ObjectCaseBuilder,
PropertyNamingStrategyEnum,
} from 'object-case-builder';
const input: object = {
'message-content': 'test',
'timestamp': 1673698827991,
'author-name': 'nikyoff',
}
const output: object = new ObjectCaseBuilder()
.setPropertyNamingStrategy(PropertyNamingStrategyEnum.SCREAMING_SNAKE_CASE)
.formatObject(
input,
PropertyNamingStrategyEnum.KEBAB_CASE
);
console.log(output);
/* console output
{
'MESSAGE_CONTENT': 'test',
'TIMESTAMP': 1673698827991,
'AUTHOR_NAME': 'nikyoff',
}
*/
Sometime you need transform your output to class and thats possible!
//message-data.ts
import { Expose, Transform } from "class-transformer";
export class MessageData {
@Expose()
@Transform(params => params.value instanceof Date ? params.value : new Date(params.value))
public createTimestamp: Date;
@Expose()
public messageContent: string;
}
import {
ObjectCaseBuilder,
PropertyNamingStrategyEnum,
} from 'object-case-builder';
import { MessageData } from './message-data'
const input: object = {
'create_timestamp': 1673698827991,
'message-content': 'test',
}
const output: MessageData = new ObjectCaseBuilder<MessageData>()
.setPropertyNamingStrategy(PropertyNamingStrategyEnum.LOWER_CAMEL_CASE)
.formatObject(
input,
PropertyNamingStrategyEnum.SNAKE_CASE,
MessageData
);
//screaming-snake.property-naming-strategy.ts
export class ScreamingSnakePropertyNamingStrategy extends PropertyNamingStrategy {
public propertyNameToWords(property: string): string[] {
return property.split('_');
}
public wordsToPropertyName(words: string[]): string {
return words.join('_').toUpperCase();
}
}
import { PropertyNamingRegister } from 'object-case-builder';
import { ScreamingSnakePropertyNamingStrategy } from './screaming-snake.property-naming-strategy';
PropertyNamingRegister.registerStrategy(
'SCREAMING_SNAKE_CASE',
ScreamingSnakePropertyNamingStrategy,
);
FAQs
Object case builder
We found that object-case-builder 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 News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.