This package has been deprecated

Author message:

Package no longer supporteed. Use at your own risk. Please refer to using package https://www.npmjs.com/package/js-convert-case.

snakecase-keys-object

1.0.2 • Public • Published

snakecase-keys-object

NPM version NPM downloads

Snakecase the keys of an object. Use for node.js and browser

It is useful for oracledb.

Installation

$ npm install --save snakecase-keys-object

or

$ yarn add snakecase-keys-object

Usage

Node.JS

const snakeKeys = require('snakecase-keys-object');
 
const object = {
    camelCase: 1,
    UPPERCASE: 2,
    lowercase: 3,
    snake_case: 4,
    PascalCase: 5,
    'Title Case': 6,
    'dot.case': 7,
    'param-case': 8,
    'Sentence case': 9,
    'path/case': 10,
    'Header-Case': 11
};
 
const res = snakeKeys(object);
 
console.log(res);
/**
 { camel_case: 1,
   uppercase: 2,
   lowercase: 3,
   snake_case: 4,
   pascal_case: 5,
   title_case: 6,
   dot_case: 7,
   param_case: 8,
   sentence_case: 9,
   path_case: 10,
   header_case: 11 }
 */
 
console.log(snakeKeys(null)); // null
console.log(snakeKeys(undefined)); // null

Browser

1. NPM Package
<script src="./node_modules/snakecase-keys-object/dist/snakecase-keys-object.js"></script>
<!-- Or use minified-->
<script src="./node_modules/snakecase-keys-object/dist/snakecase-keys-object.min.js"></script>
2. Download from source
<script src="path/to/snakecase-keys-object"></script>
Usage
<script>
    const object = {
        camelCase: 1,
        UPPERCASE: 2,
        lowercase: 3,
        snake_case: 4,
        PascalCase: 5,
        'Title Case': 6,
        'dot.case': 7,
        'param-case': 8,
        'Sentence case': 9,
        'path/case': 10,
        'Header-Case': 11
    };
 
    const res = snakeKeys(object);
 
    console.log(res);
    console.log(snakeKeys(null)); // null
    console.log(snakeKeys(undefined)); // null
</script> 

API

snakeKeys(object)

Returns a new object which keys is/are snakecased.

Related

Package Sidebar

Install

npm i snakecase-keys-object

Weekly Downloads

129

Version

1.0.2

License

ISC

Unpacked Size

4.7 kB

Total Files

6

Last publish

Collaborators

  • huynhsamha