@ultraq/string-utils
Advanced tools
+11
-8
| { | ||
| "name": "@ultraq/string-utils", | ||
| "version": "1.2.0", | ||
| "version": "2.0.0", | ||
| "description": "A collection of utilities for JavaScript strings", | ||
@@ -21,3 +21,3 @@ "author": "Emanuel Rabina <emanuelrabina@gmail.com> (http://www.ultraq.net.nz/)", | ||
| "scripts": { | ||
| "lint": "eslint '*.js'", | ||
| "lint": "eslint \"*.js\"", | ||
| "test": "npm run lint && jest", | ||
@@ -31,9 +31,12 @@ "coverage": "cat ./coverage/lcov.info | coveralls", | ||
| "devDependencies": { | ||
| "babel-cli": "^6.26.0", | ||
| "babel-preset-env": "^1.6.1", | ||
| "coveralls": "^2.13.1", | ||
| "eslint": "^4.8.0", | ||
| "eslint-config-ultraq": "^2.0.0", | ||
| "jest": "^21.2.1" | ||
| "@babel/cli": "^7.8.4", | ||
| "@babel/preset-env": "^7.9.6", | ||
| "coveralls": "^3.1.0", | ||
| "eslint": "^7.0.0", | ||
| "eslint-config-ultraq": "^2.3.2", | ||
| "jest": "^26.0.1" | ||
| }, | ||
| "engines": { | ||
| "node": ">=10" | ||
| } | ||
| } |
+1
-8
@@ -5,6 +5,5 @@ | ||
| [](https://travis-ci.org/ultraq/string-utils) | ||
| [](https://travis-ci.com/ultraq/string-utils) | ||
| [](https://coveralls.io/github/ultraq/string-utils?branch=master) | ||
| [](https://www.npmjs.com/package/@ultraq/string-utils) | ||
| [](https://github.com/ultraq/string-utils/blob/master/LICENSE.txt) | ||
@@ -23,9 +22,3 @@ A collection of utilities for JavaScript strings. | ||
| Via bower: | ||
| ``` | ||
| bower install https://github.com/ultraq/string-utils.git --save | ||
| ``` | ||
| API | ||
@@ -32,0 +25,0 @@ --- |
@@ -1,2 +0,2 @@ | ||
| 'use strict'; | ||
| "use strict"; | ||
@@ -8,2 +8,3 @@ Object.defineProperty(exports, "__esModule", { | ||
| exports.format = format; | ||
| /* | ||
@@ -34,6 +35,4 @@ * Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/) | ||
| function escapeHtml(string) { | ||
| return typeof string !== 'string' ? string : string.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '''); | ||
| } | ||
| /** | ||
@@ -49,4 +48,6 @@ * Returns the replacement of each placeholder in a template string with a | ||
| */ | ||
| function format(template) { | ||
| for (var _len = arguments.length, values = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
| for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
| values[_key - 1] = arguments[_key]; | ||
@@ -53,0 +54,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["string-utils.js"],"names":[],"mappings":";;;;;QAwBgB,U,GAAA,U;QAoBA,M,GAAA,M;AA5ChB;;;;;;;;;;;;;;;;AAgBA;;;;;;;;AAQO,SAAS,UAAT,CAAoB,MAApB,EAA4B;;AAElC,SAAO,OAAO,MAAP,KAAkB,QAAlB,GAA6B,MAA7B,GAAsC,OAC3C,OAD2C,CACnC,IADmC,EAC7B,OAD6B,EAE3C,OAF2C,CAEnC,IAFmC,EAE7B,MAF6B,EAG3C,OAH2C,CAGnC,IAHmC,EAG7B,MAH6B,EAI3C,OAJ2C,CAInC,IAJmC,EAI7B,QAJ6B,EAK3C,OAL2C,CAKnC,IALmC,EAK7B,QAL6B,CAA7C;AAMA;;AAED;;;;;;;;;;AAUO,SAAS,MAAT,CAAgB,QAAhB,EAAqC;AAAA,oCAAR,MAAQ;AAAR,UAAQ;AAAA;;AAE3C,SAAO,SAAS,OAAT,CAAiB,YAAjB,EAA+B,UAAC,KAAD,EAAQ,KAAR;AAAA,WAAkB,OAAO,CAAC,KAAR,IAAiB,EAAnC;AAAA,GAA/B,CAAP;AACA","file":"string-utils.cjs.js","sourcesContent":["/* \n * Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Escapes special HTML characters in a string with their entity code\n * equivalents.\n * \n * @param {String} string\n * @return {String}\n * HTML escaped string, safe for use in HTML.\n */\nexport function escapeHtml(string) {\n\n\treturn typeof string !== 'string' ? string : string\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"')\n\t\t.replace(/'/g, ''');\n}\n\n/**\n * Returns the replacement of each placeholder in a template string with a\n * corresponding replacement value.\n * \n * @param {String} template\n * @param {...String} values\n * Argument list of values or a single array of values.\n * @return {String}\n * Replaced template string.\n */\nexport function format(template, ...values) {\n\n\treturn template.replace(/\\{(\\d+)\\}/g, (match, index) => values[+index] + '');\n}\n"]} | ||
| {"version":3,"sources":["string-utils.js"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;;;;;AAgBA;;;;;;;;AAQO,SAAS,UAAT,CAAoB,MAApB,EAA4B;AAElC,SAAO,OAAO,MAAP,KAAkB,QAAlB,GAA6B,MAA7B,GAAsC,MAAM,CACjD,OAD2C,CACnC,IADmC,EAC7B,OAD6B,EAE3C,OAF2C,CAEnC,IAFmC,EAE7B,MAF6B,EAG3C,OAH2C,CAGnC,IAHmC,EAG7B,MAH6B,EAI3C,OAJ2C,CAInC,IAJmC,EAI7B,QAJ6B,EAK3C,OAL2C,CAKnC,IALmC,EAK7B,QAL6B,CAA7C;AAMA;AAED;;;;;;;;;;;;AAUO,SAAS,MAAT,CAAgB,QAAhB,EAAqC;AAAA,oCAAR,MAAQ;AAAR,IAAA,MAAQ;AAAA;;AAE3C,SAAO,QAAQ,CAAC,OAAT,CAAiB,YAAjB,EAA+B,UAAC,KAAD,EAAQ,KAAR;AAAA,WAAkB,MAAM,CAAC,CAAC,KAAF,CAAN,GAAiB,EAAnC;AAAA,GAA/B,CAAP;AACA","file":"string-utils.cjs.js","sourcesContent":["/* \n * Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Escapes special HTML characters in a string with their entity code\n * equivalents.\n * \n * @param {String} string\n * @return {String}\n * HTML escaped string, safe for use in HTML.\n */\nexport function escapeHtml(string) {\n\n\treturn typeof string !== 'string' ? string : string\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"')\n\t\t.replace(/'/g, ''');\n}\n\n/**\n * Returns the replacement of each placeholder in a template string with a\n * corresponding replacement value.\n * \n * @param {String} template\n * @param {...String} values\n * Argument list of values or a single array of values.\n * @return {String}\n * Replaced template string.\n */\nexport function format(template, ...values) {\n\n\treturn template.replace(/\\{(\\d+)\\}/g, (match, index) => values[+index] + '');\n}\n"]} |
@@ -26,6 +26,4 @@ /* | ||
| export function escapeHtml(string) { | ||
| return typeof string !== 'string' ? string : string.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '''); | ||
| } | ||
| /** | ||
@@ -41,4 +39,5 @@ * Returns the replacement of each placeholder in a template string with a | ||
| */ | ||
| export function format(template) { | ||
| for (var _len = arguments.length, values = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
| for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
| values[_key - 1] = arguments[_key]; | ||
@@ -45,0 +44,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["string-utils.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;AAgBA;;;;;;;;AAQA,OAAO,SAAS,UAAT,CAAoB,MAApB,EAA4B;;AAElC,SAAO,OAAO,MAAP,KAAkB,QAAlB,GAA6B,MAA7B,GAAsC,OAC3C,OAD2C,CACnC,IADmC,EAC7B,OAD6B,EAE3C,OAF2C,CAEnC,IAFmC,EAE7B,MAF6B,EAG3C,OAH2C,CAGnC,IAHmC,EAG7B,MAH6B,EAI3C,OAJ2C,CAInC,IAJmC,EAI7B,QAJ6B,EAK3C,OAL2C,CAKnC,IALmC,EAK7B,QAL6B,CAA7C;AAMA;;AAED;;;;;;;;;;AAUA,OAAO,SAAS,MAAT,CAAgB,QAAhB,EAAqC;AAAA,oCAAR,MAAQ;AAAR,UAAQ;AAAA;;AAE3C,SAAO,SAAS,OAAT,CAAiB,YAAjB,EAA+B,UAAC,KAAD,EAAQ,KAAR;AAAA,WAAkB,OAAO,CAAC,KAAR,IAAiB,EAAnC;AAAA,GAA/B,CAAP;AACA","file":"string-utils.es.js","sourcesContent":["/* \n * Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Escapes special HTML characters in a string with their entity code\n * equivalents.\n * \n * @param {String} string\n * @return {String}\n * HTML escaped string, safe for use in HTML.\n */\nexport function escapeHtml(string) {\n\n\treturn typeof string !== 'string' ? string : string\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"')\n\t\t.replace(/'/g, ''');\n}\n\n/**\n * Returns the replacement of each placeholder in a template string with a\n * corresponding replacement value.\n * \n * @param {String} template\n * @param {...String} values\n * Argument list of values or a single array of values.\n * @return {String}\n * Replaced template string.\n */\nexport function format(template, ...values) {\n\n\treturn template.replace(/\\{(\\d+)\\}/g, (match, index) => values[+index] + '');\n}\n"]} | ||
| {"version":3,"sources":["string-utils.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;AAgBA;;;;;;;;AAQA,OAAO,SAAS,UAAT,CAAoB,MAApB,EAA4B;AAElC,SAAO,OAAO,MAAP,KAAkB,QAAlB,GAA6B,MAA7B,GAAsC,MAAM,CACjD,OAD2C,CACnC,IADmC,EAC7B,OAD6B,EAE3C,OAF2C,CAEnC,IAFmC,EAE7B,MAF6B,EAG3C,OAH2C,CAGnC,IAHmC,EAG7B,MAH6B,EAI3C,OAJ2C,CAInC,IAJmC,EAI7B,QAJ6B,EAK3C,OAL2C,CAKnC,IALmC,EAK7B,QAL6B,CAA7C;AAMA;AAED;;;;;;;;;;;AAUA,OAAO,SAAS,MAAT,CAAgB,QAAhB,EAAqC;AAAA,oCAAR,MAAQ;AAAR,IAAA,MAAQ;AAAA;;AAE3C,SAAO,QAAQ,CAAC,OAAT,CAAiB,YAAjB,EAA+B,UAAC,KAAD,EAAQ,KAAR;AAAA,WAAkB,MAAM,CAAC,CAAC,KAAF,CAAN,GAAiB,EAAnC;AAAA,GAA/B,CAAP;AACA","file":"string-utils.es.js","sourcesContent":["/* \n * Copyright 2017, Emanuel Rabina (http://www.ultraq.net.nz/)\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Escapes special HTML characters in a string with their entity code\n * equivalents.\n * \n * @param {String} string\n * @return {String}\n * HTML escaped string, safe for use in HTML.\n */\nexport function escapeHtml(string) {\n\n\treturn typeof string !== 'string' ? string : string\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"')\n\t\t.replace(/'/g, ''');\n}\n\n/**\n * Returns the replacement of each placeholder in a template string with a\n * corresponding replacement value.\n * \n * @param {String} template\n * @param {...String} values\n * Argument list of values or a single array of values.\n * @return {String}\n * Replaced template string.\n */\nexport function format(template, ...values) {\n\n\treturn template.replace(/\\{(\\d+)\\}/g, (match, index) => values[+index] + '');\n}\n"]} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
-100%24929
-0.7%41
-14.58%