@spare/phrasing
Advanced tools
Comparing version 0.4.18 to 0.4.19
@@ -5,14 +5,7 @@ 'use strict'; | ||
var regexPhrasing = require('@spare/regex-phrasing'); | ||
var vectorMapper = require('@vect/vector-mapper'); | ||
var decoVector = require('@spare/deco-vector'); | ||
var enumChars = require('@spare/enum-chars'); | ||
var decoVector = require('@spare/deco-vector'); | ||
const INIWORD = /[A-Za-z\d]+/; | ||
const INILOW = /^[a-z]+/; | ||
const CAMEL = /[A-Z]+|[0-9]+/g; | ||
const WORD = /[A-Za-z\d]+/g; | ||
const CAPWORD = /([A-Z][a-z]+|[A-Z]+|[\d]+[a-z]*)/g; | ||
const DASH_CAPREST = /[\W_]+([A-Za-z\d])([A-Za-z\d]*)/g; | ||
const CAPREST = /([A-Za-z\d])([A-Za-z\d]*)/g; | ||
const wordToCap = word => word[0].toUpperCase() + word.substring(1).toLowerCase(); | ||
@@ -34,5 +27,5 @@ | ||
ph = ''; | ||
if (((ms = INILOW.exec(phrase)) || (ms = CAPWORD.exec(phrase))) && ([wd] = ms)) ph = wd.toLowerCase(); | ||
if (((ms = regexPhrasing.INILOW.exec(phrase)) || (ms = regexPhrasing.CAPWORD.exec(phrase))) && ([wd] = ms)) ph = wd.toLowerCase(); | ||
while ((ms = CAPWORD.exec(phrase)) && ([wd] = ms)) ph += de + wd.toLowerCase(); | ||
while ((ms = regexPhrasing.CAPWORD.exec(phrase)) && ([wd] = ms)) ph += de + wd.toLowerCase(); | ||
@@ -53,5 +46,5 @@ return ph; | ||
ph = ''; | ||
if ((ms = WORD.exec(dashed)) && ([wd] = ms)) ph = wd.toLowerCase(); | ||
if ((ms = regexPhrasing.WORD.exec(dashed)) && ([wd] = ms)) ph = wd.toLowerCase(); | ||
while ((ms = WORD.exec(dashed)) && ([wd] = ms)) ph += de + wordToCap(wd); | ||
while ((ms = regexPhrasing.WORD.exec(dashed)) && ([wd] = ms)) ph += de + wordToCap(wd); | ||
@@ -72,5 +65,5 @@ return ph; | ||
ph = ''; | ||
if ((ms = WORD.exec(dashed)) && ([wd] = ms)) ph = wordToCap(wd); | ||
if ((ms = regexPhrasing.WORD.exec(dashed)) && ([wd] = ms)) ph = wordToCap(wd); | ||
while ((ms = WORD.exec(dashed)) && ([wd] = ms)) ph += de + wordToCap(wd); | ||
while ((ms = regexPhrasing.WORD.exec(dashed)) && ([wd] = ms)) ph += de + wordToCap(wd); | ||
@@ -97,2 +90,3 @@ return ph; | ||
* @returns {string[]} | ||
* @deprecated use splitCamel in @spare/splitter | ||
*/ | ||
@@ -104,5 +98,5 @@ | ||
ve = []; | ||
if ((ms = INILOW.exec(phrase)) && ([wd] = ms)) ve.push(wd); | ||
if ((ms = regexPhrasing.INILOW.exec(phrase)) && ([wd] = ms)) ve.push(wd); | ||
while ((ms = CAPWORD.exec(phrase)) && ([wd] = ms)) ve.push(wd); | ||
while ((ms = regexPhrasing.CAPWORD.exec(phrase)) && ([wd] = ms)) ve.push(wd); | ||
@@ -115,2 +109,3 @@ return ve; | ||
* @returns {string[]} | ||
* @deprecated use splitSnake in @spare/splitter | ||
*/ | ||
@@ -151,10 +146,45 @@ | ||
Object.defineProperty(exports, 'CAMEL', { | ||
enumerable: true, | ||
get: function () { | ||
return regexPhrasing.CAMEL; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'CAPREST', { | ||
enumerable: true, | ||
get: function () { | ||
return regexPhrasing.CAPREST; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'CAPWORD', { | ||
enumerable: true, | ||
get: function () { | ||
return regexPhrasing.CAPWORD; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'DASH_CAPREST', { | ||
enumerable: true, | ||
get: function () { | ||
return regexPhrasing.DASH_CAPREST; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'INILOW', { | ||
enumerable: true, | ||
get: function () { | ||
return regexPhrasing.INILOW; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'INIWORD', { | ||
enumerable: true, | ||
get: function () { | ||
return regexPhrasing.INIWORD; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'WORD', { | ||
enumerable: true, | ||
get: function () { | ||
return regexPhrasing.WORD; | ||
} | ||
}); | ||
exports.Adjoin = Adjoin; | ||
exports.CAMEL = CAMEL; | ||
exports.CAPREST = CAPREST; | ||
exports.CAPWORD = CAPWORD; | ||
exports.DASH_CAPREST = DASH_CAPREST; | ||
exports.INILOW = INILOW; | ||
exports.INIWORD = INIWORD; | ||
exports.WORD = WORD; | ||
exports.adjoin = adjoin; | ||
@@ -161,0 +191,0 @@ exports.camelToSnake = camelToSnake; |
@@ -0,13 +1,7 @@ | ||
import { INILOW, CAPWORD, WORD } from '@spare/regex-phrasing'; | ||
export { CAMEL, CAPREST, CAPWORD, DASH_CAPREST, INILOW, INIWORD, WORD } from '@spare/regex-phrasing'; | ||
import { mutate } from '@vect/vector-mapper'; | ||
import { cosmetics } from '@spare/deco-vector'; | ||
import { SP } from '@spare/enum-chars'; | ||
import { cosmetics } from '@spare/deco-vector'; | ||
const INIWORD = /[A-Za-z\d]+/; | ||
const INILOW = /^[a-z]+/; | ||
const CAMEL = /[A-Z]+|[0-9]+/g; | ||
const WORD = /[A-Za-z\d]+/g; | ||
const CAPWORD = /([A-Z][a-z]+|[A-Z]+|[\d]+[a-z]*)/g; | ||
const DASH_CAPREST = /[\W_]+([A-Za-z\d])([A-Za-z\d]*)/g; | ||
const CAPREST = /([A-Za-z\d])([A-Za-z\d]*)/g; | ||
const wordToCap = word => word[0].toUpperCase() + word.substring(1).toLowerCase(); | ||
@@ -89,2 +83,3 @@ | ||
* @returns {string[]} | ||
* @deprecated use splitCamel in @spare/splitter | ||
*/ | ||
@@ -106,2 +101,3 @@ | ||
* @returns {string[]} | ||
* @deprecated use splitSnake in @spare/splitter | ||
*/ | ||
@@ -142,2 +138,2 @@ | ||
export { Adjoin, CAMEL, CAPREST, CAPWORD, DASH_CAPREST, INILOW, INIWORD, WORD, adjoin, camelToSnake, camelToVector, snakeToCamel, snakeToPascal, snakeToVector, wordToCap, wordsToCamel, wordsToPascal }; | ||
export { Adjoin, adjoin, camelToSnake, camelToVector, snakeToCamel, snakeToPascal, snakeToVector, wordToCap, wordsToCamel, wordsToPascal }; |
{ | ||
"name": "@spare/phrasing", | ||
"version": "0.4.18", | ||
"version": "0.4.19", | ||
"description": "Convert among snake/kebab/camel/pascal phrasings", | ||
@@ -18,4 +18,5 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@spare/deco-vector": "^0.4.18", | ||
"@spare/enum-chars": "^0.4.18", | ||
"@spare/deco-vector": "^0.4.19", | ||
"@spare/enum-chars": "^0.4.19", | ||
"@spare/regex-phrasing": "^0.4.19", | ||
"@vect/vector-mapper": "^0.2.3" | ||
@@ -41,3 +42,3 @@ }, | ||
"homepage": "https://github.com/hoyeungw/spare#readme", | ||
"gitHead": "edcdb9bfb5db7490e6de29a06a928fc16388d91e" | ||
"gitHead": "ea580a256bd67f70cb7890ed2f3778589379e669" | ||
} |
12231
272
4
+ Added@spare/regex-phrasing@0.4.19(transitive)
Updated@spare/deco-vector@^0.4.19
Updated@spare/enum-chars@^0.4.19