Learn how companies like Phone2Action are using npm in their front-end developmentJoin the conversation »

underscore_case

0.2.0 • Public • Published

Transforms strings to UNDERSCORE_CASE notation.

Installation

$ npm install underscore_case

or

$ yarn add underscore_case --save

Usage

// result: TEST_VALUE
const newString = underscoreCase('testValue')

Transformation examples

underscoreCase('testValue')       // result: TEST_VALUE
underscoreCase('-testValue')      // result: TEST_VALUE
underscoreCase('_testValue')      // result: TEST_VALUE
underscoreCase('test Value')      // result: TEST_VALUE
underscoreCase('test value')      // result: TEST_VALUE
underscoreCase('test  value')     // result: TEST_VALUE
underscoreCase('test-value')      // result: TEST_VALUE
underscoreCase('test--value')     // result: TEST_VALUE
underscoreCase('test -value')     // result: TEST_VALUE
underscoreCase('test_value')      // result: TEST_VALUE
underscoreCase('test__value')     // result: TEST_VALUE
underscoreCase('test_Value')      // result: TEST_VALUE
underscoreCase('testValue-')      // result: TEST_VALUE
underscoreCase('testValue ')      // result: TEST_VALUE
underscoreCase('1testValue ')     // result: 1_TEST_VALUE
underscoreCase('1test2Value ')    // result: 1_TEST2_VALUE
underscoreCase('123testValue ')   // result: 123_TEST_VALUE

Install

npm i underscore_case

DownloadsWeekly Downloads

5

Version

0.2.0

License

MIT

Unpacked Size

4.04 kB

Total Files

5

Last publish

Collaborators

  • avatar