Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

πŸ›‘ [deprecated] πŸ›‘ Pascalcase the keys of an object. Use for node.js and browser

Notifications You must be signed in to change notification settings

huynhsamha/pascalcase-keys-object

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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