6.0.0 • Published 3 years ago

decamelize v6.0.0

Weekly downloads
20,865,873
License
MIT
Repository
github
Last release
3 years ago

decamelize

Convert a camelized string into a lowercased one with a custom separator\ Example: unicornRainbowunicorn_rainbow

If you use this on untrusted user input, don't forget to limit the length to something reasonable.

Install

npm install decamelize

Usage

import decamelize from 'decamelize';

decamelize('unicornRainbow');
//=> 'unicorn_rainbow'

decamelize('unicornRainbow', {separator: '-'});
//=> 'unicorn-rainbow'

decamelize('testGUILabel', {preserveConsecutiveUppercase: true});
//=> 'test_GUI_label'

decamelize('testGUILabel', {preserveConsecutiveUppercase: false});
//=> 'test_gui_label'

API

decamelize(input, options?)

input

Type: string

options

Type: object

separator

Type: string\ Default: '_'

Character or string inserted to separate words in string.

import decamelize from 'decamelize';

decamelize('unicornRainbow');
//=> 'unicorn_rainbow'

decamelize('unicornRainbow', {separator: '-'});
//=> 'unicorn-rainbow'
preserveConsecutiveUppercase

Type: boolean\ Default: false

Preserve sequences of uppercase characters.

import decamelize from 'decamelize';

decamelize('testGUILabel');
//=> 'test_gui_label'

decamelize('testGUILabel', {preserveConsecutiveUppercase: true});
//=> 'test_GUI_label'

Related

See camelcase for the inverse.


decamelize-keysyargs-unparsernyc@pubngo-stack/billing-api-serverarchetype-librarybit-bin@teambit/legacy@redwoodjs/clieasy-select-rnchinjowwchinjowvuedragdropuploadimages@care-for/yargs-unparserreact-native-bluetooth2killi8n-react-native-fast-image@tenjo/web-toolkitprj-initrn-send-smsspecify-importsbabel-specify-imports@icanpm/api-master@zzappie/bigchaindb-driver@arisageha/react-lazyload@arisageha/react-lazyload-fix@oneplanetcrowd/developersams-http-servicefoshata-markdown@cashremit/cr-streamline-iconsgenerator-taro-temps@authdog/oauth2-toolkitapollo-micro-graphql@steroids/styledpostgrest-binreact-native-template-rfbase@cedx/express-corette-css-vargenerator-theme-fi-componentcloud-archive-s3airscanairscan-examplebb-chatreact-native-esc-pos-sahaabgenerator-onebot@borisovart/atol-kkt-module@frxf/frxfvue-webpack-indexdeneme323112@texttree/demo-bsa-reference-rclmodelc@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjames@sonammalhotra/lotide@smishra17/lotide@cheapthrills/lotidereact-native-covid-sdkgenerator-nextjs-typescript-antdgql_din_modbitgetgenerator-sawb-testcomponentreact-native-thanh-toast-librarysalut_gongjang_first_module@jttechnic/interpreter@thanhnguyen14797/react-native-thanh-toast-librarysparrow-bird-code@l1nyanm1ng/react-picture-viewer@brandongregoryscott/node-pg-migratecthpb-plugin-social@iobroker-community-adapters/iobroker.device-watcher@olivervorasai/slidermysql-formatpanqibaoreact-native-printer-brothersrn-pdf-reader-offline@newhorizon-tech/dd-npm-package-templatereact-native-shekhar-bridge-testcogoportutilslevibestliblevibestlib2levilibtest19levilibtest24levilibtest25levilibtest26levilibtest27levilibtest28levilibtest29levinodelib@saber71/lib@nicholasjj/lotidewilscanner@oiti/documentoscopy-react-nativeblitz-database@mink-opn/build-tokensquoc-testreact-native-slider-kfnodejs-fileshareunblock-block-save-variables@prodam/prodam-typesgenerator-myfirstyeomancclibyarntest@saaspe/components
6.0.0

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.0.0

4 years ago

3.2.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.0.0

6 years ago

1.2.0

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

9 years ago

1.0.0

9 years ago