Skip to content

Convert input (string, array, object) to lowerCamelcase

License

Notifications You must be signed in to change notification settings

B2XCare/camelcase-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM Package To Convert Input Into lowerCamelcase Format

HitCount Generic badge GitHub license GitHub contributors GitHub issues GitHub issues-closed

NPM

Convert your input into lowerCamelcase format, this Node.js module allows you to convert string, array. object into lowerCamelcase.

>=1.0.0 Version of this package requires >=6.0 version of Node.js

To Use This Package For Earlier Versions (<6.0) Of Your Node.js Then Download <1.0.0 Version

Installation

Install with the node package manager npm:

  • Using npm
    $ npm install camelcase-input --save
  • Using yarn
    $ yarn add camelcase-input

How To Use?

Convert string Input

const camelcase = require('camelcase-input').camelcase
console.log(camelcase('Foo-Bar'))

/* OUTPUT */
fooBar

Convert object Input

const camelcase = require('camelcase-input').camelcase
console.log(camelcase({'foo-bar': true}))

/* OUTPUT */
{ fooBar: true }

Convert array of objects Input

const camelcase = require('camelcase-input').camelcase
console.log(camelcase([{'foo-bar': true}, {'is_that_you': true}]))

/* OUTPUT */
[ { fooBar: true }, { isThatYou: true } ]

Convert array of string Input

const camelcase = require('camelcase-input').camelcase
console.log(camelcase(['Foo-Bar', 'are-you-there']))

/* OUTPUT */
fooBar, areYouThere

Convert array of objects Input ({ deep: true })

const camelcase = require('camelcase-input').camelcase
console.log(camelcase([{'Foo-bar': [{'abc-df__r': true}, {'tghd_dfdf--ee': true}]}, {'bar-foo': { 'Test-te': {'opt-tdt': 'dfdfdf'} }}], { deep: true })))

/* OUTPUT */
[{ fooBar: [{ abcDfR: true }, { tghdDfdfEe: true }] },{ barFoo: { testTe: { optTdt: dfdfdf } } }]

Convert string Input And Remove Digit From Start Of String ({ removeDigitFromStart: true })

/* SAME APPLIES TO Objects, Array, etc. */
const camelcase = require('camelcase-input').camelcase
console.log(camelcase('1. Information12', { deep: true })))

/* OUTPUT */
information12

Convert string Input And Remove () From String If It Contains Atleast One Character

/* SAME APPLIES TO Objects, Array, etc. */
const camelcase = require('camelcase-input').camelcase
console.log(camelcase('Information (1 min)', { deep: true })))

/* OUTPUT */
information1Min

Returns string Input As It Is If It Does Not Contain Any Character

/* SAME APPLIES TO Objects, Array, etc. */
const camelcase = require('camelcase-input').camelcase
console.log(camelcase('2018-06-15 06:00:00', { deep: true })))

/* OUTPUT */
2018-06-15 06:00:00

Changelog

  • 1.0.3 remove digit from start of string, remove () from input added
  • 1.0.2 nested object conversion issue resolve
  • 1.0.1 value assign issue fixed
  • 1.0.0 Initial version