feat: adding linter for commits
This commit is contained in:
103
node_modules/camelcase-keys/index.d.ts
generated
vendored
Normal file
103
node_modules/camelcase-keys/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
declare namespace camelcaseKeys {
|
||||
interface Options {
|
||||
/**
|
||||
Recurse nested objects and objects in arrays.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly deep?: boolean;
|
||||
|
||||
/**
|
||||
Exclude keys from being camel-cased.
|
||||
|
||||
@default []
|
||||
*/
|
||||
readonly exclude?: ReadonlyArray<string | RegExp>;
|
||||
|
||||
/**
|
||||
Exclude children at the given object paths in dot-notation from being camel-cased. For example, with an object like `{a: {b: '🦄'}}`, the object path to reach the unicorn is `'a.b'`.
|
||||
|
||||
@default []
|
||||
|
||||
@example
|
||||
```
|
||||
camelcaseKeys({
|
||||
a_b: 1,
|
||||
a_c: {
|
||||
c_d: 1,
|
||||
c_e: {
|
||||
e_f: 1
|
||||
}
|
||||
}
|
||||
}, {
|
||||
deep: true,
|
||||
stopPaths: [
|
||||
'a_c.c_e'
|
||||
]
|
||||
}),
|
||||
// {
|
||||
// aB: 1,
|
||||
// aC: {
|
||||
// cD: 1,
|
||||
// cE: {
|
||||
// e_f: 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
```
|
||||
*/
|
||||
readonly stopPaths?: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
Uppercase the first character as in `bye-bye` → `ByeBye`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly pascalCase?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Convert object keys to camel case using [`camelcase`](https://github.com/sindresorhus/camelcase).
|
||||
|
||||
@param input - Object or array of objects to camel-case.
|
||||
|
||||
@example
|
||||
```
|
||||
import camelcaseKeys = require('camelcase-keys');
|
||||
|
||||
// Convert an object
|
||||
camelcaseKeys({'foo-bar': true});
|
||||
//=> {fooBar: true}
|
||||
|
||||
// Convert an array of objects
|
||||
camelcaseKeys([{'foo-bar': true}, {'bar-foo': false}]);
|
||||
//=> [{fooBar: true}, {barFoo: false}]
|
||||
|
||||
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
|
||||
//=> {fooBar: true, nested: {unicornRainbow: true}}
|
||||
|
||||
// Convert object keys to pascal case
|
||||
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true, pascalCase: true});
|
||||
//=> {FooBar: true, Nested: {UnicornRainbow: true}}
|
||||
|
||||
import minimist = require('minimist');
|
||||
|
||||
const argv = minimist(process.argv.slice(2));
|
||||
//=> {_: [], 'foo-bar': true}
|
||||
|
||||
camelcaseKeys(argv);
|
||||
//=> {_: [], fooBar: true}
|
||||
```
|
||||
*/
|
||||
declare function camelcaseKeys<T extends ReadonlyArray<{[key: string]: any}>>(
|
||||
input: T,
|
||||
options?: camelcaseKeys.Options,
|
||||
): T;
|
||||
|
||||
declare function camelcaseKeys<T extends {[key: string]: any}>(
|
||||
input: T,
|
||||
options?: camelcaseKeys.Options,
|
||||
): T;
|
||||
|
||||
export = camelcaseKeys;
|
77
node_modules/camelcase-keys/index.js
generated
vendored
Normal file
77
node_modules/camelcase-keys/index.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
const mapObj = require('map-obj');
|
||||
const camelCase = require('camelcase');
|
||||
const QuickLru = require('quick-lru');
|
||||
|
||||
const has = (array, key) => array.some(x => {
|
||||
if (typeof x === 'string') {
|
||||
return x === key;
|
||||
}
|
||||
|
||||
x.lastIndex = 0;
|
||||
return x.test(key);
|
||||
});
|
||||
|
||||
const cache = new QuickLru({maxSize: 100000});
|
||||
|
||||
// Reproduces behavior from `map-obj`
|
||||
const isObject = value =>
|
||||
typeof value === 'object' &&
|
||||
value !== null &&
|
||||
!(value instanceof RegExp) &&
|
||||
!(value instanceof Error) &&
|
||||
!(value instanceof Date);
|
||||
|
||||
const camelCaseConvert = (input, options) => {
|
||||
if (!isObject(input)) {
|
||||
return input;
|
||||
}
|
||||
|
||||
options = {
|
||||
deep: false,
|
||||
pascalCase: false,
|
||||
...options
|
||||
};
|
||||
|
||||
const {exclude, pascalCase, stopPaths, deep} = options;
|
||||
|
||||
const stopPathsSet = new Set(stopPaths);
|
||||
|
||||
const makeMapper = parentPath => (key, value) => {
|
||||
if (deep && isObject(value)) {
|
||||
const path = parentPath === undefined ? key : `${parentPath}.${key}`;
|
||||
|
||||
if (!stopPathsSet.has(path)) {
|
||||
value = mapObj(value, makeMapper(path));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(exclude && has(exclude, key))) {
|
||||
const cacheKey = pascalCase ? `${key}_` : key;
|
||||
|
||||
if (cache.has(cacheKey)) {
|
||||
key = cache.get(cacheKey);
|
||||
} else {
|
||||
const ret = camelCase(key, {pascalCase});
|
||||
|
||||
if (key.length < 100) { // Prevent abuse
|
||||
cache.set(cacheKey, ret);
|
||||
}
|
||||
|
||||
key = ret;
|
||||
}
|
||||
}
|
||||
|
||||
return [key, value];
|
||||
};
|
||||
|
||||
return mapObj(input, makeMapper(undefined));
|
||||
};
|
||||
|
||||
module.exports = (input, options) => {
|
||||
if (Array.isArray(input)) {
|
||||
return Object.keys(input).map(key => camelCaseConvert(input[key], options));
|
||||
}
|
||||
|
||||
return camelCaseConvert(input, options);
|
||||
};
|
9
node_modules/camelcase-keys/license
generated
vendored
Normal file
9
node_modules/camelcase-keys/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
73
node_modules/camelcase-keys/package.json
generated
vendored
Normal file
73
node_modules/camelcase-keys/package.json
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "camelcase-keys",
|
||||
"version": "6.2.2",
|
||||
"description": "Convert object keys to camel case",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/camelcase-keys",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"bench": "matcha bench/bench.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"map",
|
||||
"obj",
|
||||
"object",
|
||||
"key",
|
||||
"keys",
|
||||
"value",
|
||||
"values",
|
||||
"val",
|
||||
"iterate",
|
||||
"camelcase",
|
||||
"camel-case",
|
||||
"camel",
|
||||
"case",
|
||||
"dash",
|
||||
"hyphen",
|
||||
"dot",
|
||||
"underscore",
|
||||
"separator",
|
||||
"string",
|
||||
"text",
|
||||
"convert",
|
||||
"pascalcase",
|
||||
"pascal-case",
|
||||
"deep",
|
||||
"recurse",
|
||||
"recursive"
|
||||
],
|
||||
"dependencies": {
|
||||
"camelcase": "^5.3.1",
|
||||
"map-obj": "^4.0.0",
|
||||
"quick-lru": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.1.0",
|
||||
"matcha": "^0.7.0",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.25.3"
|
||||
},
|
||||
"xo": {
|
||||
"overrides": [
|
||||
{
|
||||
"files": "bench/bench.js",
|
||||
"rules": {
|
||||
"import/no-unresolved": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
125
node_modules/camelcase-keys/readme.md
generated
vendored
Normal file
125
node_modules/camelcase-keys/readme.md
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
# camelcase-keys [](https://travis-ci.org/sindresorhus/camelcase-keys)
|
||||
|
||||
> Convert object keys to camel case using [`camelcase`](https://github.com/sindresorhus/camelcase)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install camelcase-keys
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const camelcaseKeys = require('camelcase-keys');
|
||||
|
||||
// Convert an object
|
||||
camelcaseKeys({'foo-bar': true});
|
||||
//=> {fooBar: true}
|
||||
|
||||
// Convert an array of objects
|
||||
camelcaseKeys([{'foo-bar': true}, {'bar-foo': false}]);
|
||||
//=> [{fooBar: true}, {barFoo: false}]
|
||||
|
||||
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
|
||||
//=> {fooBar: true, nested: {unicornRainbow: true}}
|
||||
|
||||
camelcaseKeys({a_b: 1, a_c: {c_d: 1, c_e: {e_f: 1}}}, {deep: true, stopPaths: ['a_c.c_e']}),
|
||||
//=> {aB: 1, aC: {cD: 1, cE: {e_f: 1}}}
|
||||
|
||||
// Convert object keys to pascal case
|
||||
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true, pascalCase: true});
|
||||
//=> {FooBar: true, Nested: {UnicornRainbow: true}}
|
||||
```
|
||||
|
||||
```js
|
||||
const camelcaseKeys = require('camelcase-keys');
|
||||
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
//=> {_: [], 'foo-bar': true}
|
||||
|
||||
camelcaseKeys(argv);
|
||||
//=> {_: [], fooBar: true}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### camelcaseKeys(input, options?)
|
||||
|
||||
#### input
|
||||
|
||||
Type: `object | object[]`
|
||||
|
||||
An object or array of objects to camel-case.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### exclude
|
||||
|
||||
Type: `Array<string | RegExp>`\
|
||||
Default: `[]`
|
||||
|
||||
Exclude keys from being camel-cased.
|
||||
|
||||
##### stopPaths
|
||||
|
||||
Type: `string[]`\
|
||||
Default: `[]`
|
||||
|
||||
Exclude children at the given object paths in dot-notation from being camel-cased. For example, with an object like `{a: {b: '🦄'}}`, the object path to reach the unicorn is `'a.b'`.
|
||||
|
||||
```js
|
||||
camelcaseKeys({
|
||||
a_b: 1,
|
||||
a_c: {
|
||||
c_d: 1,
|
||||
c_e: {
|
||||
e_f: 1
|
||||
}
|
||||
}
|
||||
}, {
|
||||
deep: true,
|
||||
stopPaths: [
|
||||
'a_c.c_e'
|
||||
]
|
||||
}),
|
||||
/*
|
||||
{
|
||||
aB: 1,
|
||||
aC: {
|
||||
cD: 1,
|
||||
cE: {
|
||||
e_f: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
##### deep
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Recurse nested objects and objects in arrays.
|
||||
|
||||
##### pascalCase
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Uppercase the first character as in `bye-bye` → `ByeBye`.
|
||||
|
||||
## camelcase-keys for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of camelcase-keys and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase-keys?utm_source=npm-camelcase-keys&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [snakecase-keys](https://github.com/bendrucker/snakecase-keys)
|
||||
- [kebabcase-keys](https://github.com/mattiloh/kebabcase-keys)
|
||||
|
Reference in New Issue
Block a user