@zenjs/underscore

1.0.0 • Public • Published

@zenjs/underscore

A port of node.inflection method .underscore, but there are some differences in string processing:

When the first character is _, this _ will not be removed like node.inflection.underscore and will still be preserved.

Installation

Install inflection through npm

npm install @zenjs/underscore

Description

This function transforms String object from camelcase to underscore.

Arguments

str

type: String
desc: The subject string.

all_upper_case

type: Boolean
desc: Default is to lowercase and add underscore prefix

Example code

const underscore = require('@zenjs/uppercase')

underscore('MessageProperties') // Return 'message_properties'
underscore('messageProperties') // Return 'message_properties'
underscore('MP') // Return 'm_p'
underscore('MP', true) // Return 'MP'
underscore('_createdAt') // Return '_created_at'

Readme

Keywords

none

Package Sidebar

Install

npm i @zenjs/underscore

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.25 kB

Total Files

3

Last publish

Collaborators

  • zencode
  • huangshenglei