Socket
Socket
Sign inDemoInstall

@percy/config

Package Overview
Dependencies
Maintainers
6
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/config - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

10

dist/utils/normalize.js
import merge from './merge.js';
import { getSchema } from '../validate.js'; // Edge case camelizations
const CAMELCASE_MAP = new Map([['css', 'CSS'], ['javascript', 'JavaScript']]); // Converts kebab-cased and snake_cased strings to camelCase.
const CAMELCASE_MAP = new Map([['css', 'CSS'], ['javascript', 'JavaScript']]); // Regular expression that matches words from boundaries or consecutive casing
const KEBAB_SNAKE_REG = /[-_]([^-_]+)/g;
const WORD_REG = /[a-z]{2,}|[A-Z]{2,}|[0-9]{2,}|[^-_\s]+?(?=[A-Z0-9-_\s]|$)/g; // Converts kebab-cased and snake_cased strings to camelCase.
export function camelcase(str) {
if (typeof str !== 'string') return str;
return str.replace(KEBAB_SNAKE_REG, (match, word) => CAMELCASE_MAP.get(word) || word[0].toUpperCase() + word.slice(1));
return str.match(WORD_REG).reduce((s, w, i) => s + (i ? CAMELCASE_MAP.get(w.toLowerCase()) || w[0].toUpperCase() + w.slice(1).toLowerCase() : w.toLowerCase()), '');
} // Coverts camelCased and snake_cased strings to kebab-case.
const CAMEL_SNAKE_REG = /([a-z])([A-Z]+)|_([^_]+)/g;
export function kebabcase(str) {
if (typeof str !== 'string') return str;
return Array.from(CAMELCASE_MAP).reduce((str, [word, camel]) => str.replace(camel, `-${word}`), str).replace(CAMEL_SNAKE_REG, (match, p, n, w) => `${p || ''}-${(n || w).toLowerCase()}`);
return Array.from(CAMELCASE_MAP).reduce((str, [word, camel]) => str.replace(camel, `-${word}`), str).match(WORD_REG).join('-').toLowerCase();
} // Removes undefined empty values and renames kebab-case properties to camelCase. Optionally

@@ -17,0 +17,0 @@ // allows deep merging with options.overrides, converting keys to kebab-case with options.kebab,

{
"name": "@percy/config",
"version": "1.5.1",
"version": "1.6.0",
"license": "MIT",

@@ -37,3 +37,3 @@ "repository": {

"dependencies": {
"@percy/logger": "1.5.1",
"@percy/logger": "1.6.0",
"ajv": "^8.6.2",

@@ -46,3 +46,3 @@ "cosmiconfig": "^7.0.0",

},
"gitHead": "c67c0d482d3da18e529f7bc2e1c219c04e59bbea"
"gitHead": "dd03aec4a68a26425cda3afd10fa142011198b5f"
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc