npm

Check out our latest tech talk, "JavaScript Supply Chain Security" presented by VP of Security, Adam Baldwin.Watch it here »

pascalcase-keys-object

1.0.1 • Public • Published

pascalcase-keys-object

NPM version NPM downloads

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

It is useful for oracledb.

Installation

$ npm install --save pascalcase-keys-object

or

$ yarn add pascalcase-keys-object

Usage

Node.JS

const pascalKeys = require('pascalcase-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 = pascalKeys(object);
 
console.log(res);
/**
{ CamelCase: 1,
  Uppercase: 2,
  Lowercase: 3,
  SnakeCase: 4,
  PascalCase: 5,
  TitleCase: 6,
  DotCase: 7,
  ParamCase: 8,
  SentenceCase: 9,
  PathCase: 10,
  HeaderCase: 11 }
 */
 
console.log(pascalKeys(null)); // null
console.log(pascalKeys(undefined)); // null

Browser

1. NPM Package
<script src="./node_modules/pascalcase-keys-object/dist/pascalcase-keys-object.js"></script>
<!-- Or use minified-->
<script src="./node_modules/pascalcase-keys-object/dist/pascalcase-keys-object.min.js"></script>
2. Download from source
<script src="path/to/pascalcase-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 = pascalKeys(object);
 
    console.log(res);
    console.log(pascalKeys(null)); // null
    console.log(pascalKeys(undefined)); // null
 
</script> 

API

pascalKeys(object)

Returns a new object which keys is/are pascalcased.

Related

install

npm i pascalcase-keys-object

Downloadsweekly downloads

55

version

1.0.1

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability