Add stylelint dependency
This also adds CC-BY-4.0 to the list of accepted licenses.
DISABLE_THIRD_PARTY_CHECK=update dependencies
Bug: chromium:1083142
Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
diff --git a/node_modules/camelcase-keys/index.js b/node_modules/camelcase-keys/index.js
new file mode 100644
index 0000000..d6349c5
--- /dev/null
+++ b/node_modules/camelcase-keys/index.js
@@ -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);
+};