nos

nosep

This facilitates the conversion of object properties that have separators to the format used in JS

Showing:

Popularity

Downloads/wk

4

GitHub Stars

6

Maintenance

Last Commit

3mos ago

Contributors

0

Package

Dependencies

0

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

Welcome to No Separators (nosep) 👋

Version Documentation

This module facilitates the conversion of object properties that have separators to the format used in JS.

Install

yarn users:

yarn add nosep

npm users:

npm install nosep

Importing:

import { noSep } from 'nosep'

Usage:

Sanitize Object Properties

In the below object we have properties with the most varied forms of used separators. Let's call .sanitizeProperties(obj, separator) and check the result after application.

const object = {'deploy#in-azure_dev-ops': false, 'deploy#in-dev_mode': true}

//noSep.sanitizeProperties(object[,separator])

/**
 * camelCasing properties with default '_' (underscore) 
 */ 
noSep.sanitizeProperties(object); // => { 'deploy#in-azureDev-ops': false, 'deploy#in-devMode': true }

/**
 * camelCasing properties with '#'
 */ 
noSep.sanitizeProperties(object, '#'); // => { 'deployIn-azureDev-ops': false, 'deployIn-devMode': true }

/**
 * camelCasing properties with '-'
 */
noSep.sanitizeProperties(object, '-'); // => { deployInAzureDevOps: false, deployInDevMode: true }

/**
 * camelCasing properties with 'y' (letter)
 */
noSep.sanitizeProperties(object, 'y'); // => { deploInAzureDevOps: false, deploInDevMode: true }


Aditional Usage:

CamelCase string Array & Capitalize string

In addition we can use .capitalize(string) to generate a camelCaseBased string from an Array of strings, or simple Capitalize a string.

// noSep.capitalize(string[,string[]])

/** 
 * camelCasing an Array of strings
 */
noSep.capitalize(['created', 'class', 'function']); // => createdClassFunction


/** 
 * Capitalizing the string "created"
 */
 noSep.capitalize('created') // => Created

Author

👤 Iago Calazans (💼 Senior Node|TypeScript Developer)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100