Socket
Socket
Sign inDemoInstall

kebabcase-keys

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    kebabcase-keys

Convert object keys to kebab-case


Version published
Maintainers
1
Install size
38.0 kB
Created

Readme

Source

kebabcase-keys Build Status

Convert object keys to kebab-case using lodash.kebabcase, forked from camelcase-keys by Sindre Sorhus.

Install

$ npm install kebabcase-keys

Usage

const kebabcaseKeys = require('kebabcase-keys');

// Convert an object
kebabcaseKeys({foo_bar: true});
//=> {'foo-bar': true}

// Convert an array of objects
kebabcaseKeys([{fooBar: true}, {bar_foo: false}]);
//=> [{'foo-bar': true}, {'bar-foo': false}]

kebabcaseKeys({foo_bar: true, nested: {unicorn_rainbow: true}}, {deep: true});
//=> {'foo-bar': true, nested: {'unicorn-rainbow': true}}

API

kebabcaseKeys(input, [options])

input

Type: Object Object[]

Object or array of objects to kebab-case.

options

Type: Object

exclude

Type: Array<string|RegExp>
Default: []

Exclude keys from being kebab-cased.

deep

Type: boolean
Default: false

Recurse nested objects and objects in arrays.

Credits

This is a fork from camelcase-keys by Sindre Sorhus. I just integrated a different case-converter.

License

MIT © Sindre Sorhus MIT © Matthias Lohscheidt

Keywords

FAQs

Last updated on 29 Jan 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc