2.0.6 • Published 8 months ago

normalize-object v2.0.6

Weekly downloads
602
License
MIT
Repository
github
Last release
8 months ago

normalize-object

NPM

Based off of normalize-case

Version History

  • 2.0: Support for Object-like objects (Map, Set, Buffer, Date, etc)
  • 1.3: Remove gulp, coffee, underscore
  • 1.2: remove node 4.x support
  • 1.1: camelize-object -> normalize-object

Installation

npm install normalize-object

Usage

Normalize an object and all of its keys (included nested object keys and objects in arrays) to the format of your choosing.

normalize(obj, caseType)

Where caseType defaults to camel case

Supports the following casing types:

  • camel
  • capital
  • constant
  • lower
  • pascal
  • sentence
  • snake
  • title
  • upper

Usage Example

var normalize = require('normalize-object');

var input = {
  api_key: "baz",
  "first name": "baz",
  last_name: "foo",
  array: [
    { Name: "baz" },
    { "names  ": [A: 1] }
  ]
};

var output = normalize(input, 'camel'); // camel is used by default

Where output would be:

var output = {
  apiKey: "baz",
  firstName: "baz",
  lastName: "foo",
  array: [
    { name: "baz" },
    { names: [a: 1] }
  ]
};

Testing

npm test
2.0.5

8 months ago

2.0.6

8 months ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.3.0

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago