2-camel-case 中文文档教程

发布于 3年前 浏览 24 项目主页 更新于 3年前

2-camel-case

将任何嵌套级别的对象或数组转换为驼峰式样式

Installation

$ npm install 2-camel-case

$ yarn add 2-camel-case

Example

import toCamelCase from '2-camel-case';

toCamelCase({
  first_name: 'Ivan',
  middle_name: 'Ivanovich',
  last_name: 'Ivanov',
});
/* 
  return {
    firstName: 'Ivan',
    middleName: 'Ivanovich',
    lastName: 'Ivanov', 
  }
*/

toCamelCase([
  {
    first_name: 'Ivan',
    middle_name: 'Ivanovich',
    last_name: 'Ivanov',
  },
]);
/* 
  return [
  {
    firstName: 'Ivan',
    middleName: 'Ivanovich',
    lastName: 'Ivanov',
  },
]
*/

API

toCameCase(data)

data

类型:array | 对象

2-camel-case

Converting an object or array of any nesting level to camelcase style

Installation

$ npm install 2-camel-case

or

$ yarn add 2-camel-case

Example

import toCamelCase from '2-camel-case';

toCamelCase({
  first_name: 'Ivan',
  middle_name: 'Ivanovich',
  last_name: 'Ivanov',
});
/* 
  return {
    firstName: 'Ivan',
    middleName: 'Ivanovich',
    lastName: 'Ivanov', 
  }
*/

toCamelCase([
  {
    first_name: 'Ivan',
    middle_name: 'Ivanovich',
    last_name: 'Ivanov',
  },
]);
/* 
  return [
  {
    firstName: 'Ivan',
    middleName: 'Ivanovich',
    lastName: 'Ivanov',
  },
]
*/

API

toCameCase(data)

data

Type: array | object

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文