tag2content
Advanced tools
Comparing version 1.0.3 to 1.0.4
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var camelCase = require("camelcase"); | ||
exports.getVariables = function (text) { | ||
@@ -9,4 +8,4 @@ var variables = {}; | ||
while ((temp = regExp.exec(text))) { | ||
var name_1 = camelCase(temp[1]); | ||
var value = getTransformedValue(temp[2]); | ||
var name_1 = toCamelCase(temp[1]); | ||
var value = toBooleanOrString(temp[2]); | ||
variables[name_1] = value; | ||
@@ -16,3 +15,3 @@ } | ||
}; | ||
var getTransformedValue = function (value) { | ||
var toBooleanOrString = function (value) { | ||
switch (value) { | ||
@@ -27,1 +26,8 @@ case 'true': | ||
}; | ||
var toCamelCase = function (text) { | ||
return text | ||
.replace(/(?:^\w|[A-Z]|\b\w)/g, function (letter, index) { | ||
return index === 0 ? letter.toLowerCase() : letter.toUpperCase(); | ||
}) | ||
.replace(/[_.\-\s]+/g, ''); | ||
}; |
{ | ||
"name": "tag2content", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Replace a tag with content in a configurable way", | ||
@@ -16,3 +16,3 @@ "main": "lib/index.js", | ||
"test": "jest --config jestconfig.json", | ||
"test-watch": "npm run test -- --watch", | ||
"test:watch": "npm run test -- --watch", | ||
"version": "npm run format && git add -A src" | ||
@@ -43,5 +43,3 @@ }, | ||
"dependencies": { | ||
"@types/camelcase": "^4.1.0", | ||
"@types/node": "^10.12.15", | ||
"camelcase": "^5.0.0", | ||
"escape-string-regexp": "^1.0.5" | ||
@@ -48,0 +46,0 @@ }, |
9055
2
187
- Removed@types/camelcase@^4.1.0
- Removedcamelcase@^5.0.0
- Removed@types/camelcase@4.1.0(transitive)
- Removedcamelcase@5.3.1(transitive)