New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@spare/phrasing

Package Overview
Dependencies
Maintainers
1
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spare/phrasing - npm Package Compare versions

Comparing version 0.3.7 to 0.3.9

28

dist/index.cjs.js

@@ -85,2 +85,28 @@ 'use strict';

/**
* Camel/pascal case phrase -> split vector
* Snake: fox_jumps_over_dog
* Kebab: fox-jumps-over-dog
* @param {string} phrase camel/pascal-case phrase
* @returns {string[]}
*/
function camelToVector(phrase) {
let ms,
wd,
ve = [];
if ((ms = INILOW.exec(phrase)) && ([wd] = ms)) ve.push(wd);
while ((ms = CAPWORD.exec(phrase)) && ([wd] = ms)) ve.push(wd);
return ve;
}
/**
* snake or kebab phrase -> split vector
* @param {string} phrase - dashed phrase
* @returns {string[]}
*/
const snakeToVector = phrase => phrase.split(/\W/g);
exports.CAMEL = CAMEL;

@@ -94,6 +120,8 @@ exports.CAPREST = CAPREST;

exports.camelToSnake = camelToSnake;
exports.camelToVector = camelToVector;
exports.snakeToCamel = snakeToCamel;
exports.snakeToPascal = snakeToPascal;
exports.snakeToVector = snakeToVector;
exports.wordToCap = wordToCap;
exports.wordsToCamel = wordsToCamel;
exports.wordsToPascal = wordsToPascal;

28

dist/index.esm.js

@@ -81,2 +81,28 @@ import { mutate } from '@vect/vector-mapper';

export { CAMEL, CAPREST, CAPWORD, DASH_CAPREST, INILOW, INIWORD, WORD, camelToSnake, snakeToCamel, snakeToPascal, wordToCap, wordsToCamel, wordsToPascal };
/**
* Camel/pascal case phrase -> split vector
* Snake: fox_jumps_over_dog
* Kebab: fox-jumps-over-dog
* @param {string} phrase camel/pascal-case phrase
* @returns {string[]}
*/
function camelToVector(phrase) {
let ms,
wd,
ve = [];
if ((ms = INILOW.exec(phrase)) && ([wd] = ms)) ve.push(wd);
while ((ms = CAPWORD.exec(phrase)) && ([wd] = ms)) ve.push(wd);
return ve;
}
/**
* snake or kebab phrase -> split vector
* @param {string} phrase - dashed phrase
* @returns {string[]}
*/
const snakeToVector = phrase => phrase.split(/\W/g);
export { CAMEL, CAPREST, CAPWORD, DASH_CAPREST, INILOW, INIWORD, WORD, camelToSnake, camelToVector, snakeToCamel, snakeToPascal, snakeToVector, wordToCap, wordsToCamel, wordsToPascal };

16

package.json
{
"name": "@spare/phrasing",
"version": "0.3.7",
"description": "A debugging tool",
"version": "0.3.9",
"description": "Convert among snake/kebab/camel/pascal phrasings",
"main": "dist/index.cjs.js",

@@ -25,6 +25,8 @@ "module": "dist/index.esm.js",

"keywords": [
"test",
"console",
"debug",
"print"
"phrasing",
"split",
"camel",
"kebab",
"pascal",
"snake"
],

@@ -37,3 +39,3 @@ "author": "Hoyeung Wong",

"homepage": "https://github.com/hoyeungw/spare#readme",
"gitHead": "24f9b918bfc02607aca1c23933c6409c7097ded8"
"gitHead": "028ebcbe8435520c001ae45a558c5682333f77e6"
}
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