@wessberg/stringutil
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -1,85 +0,41 @@ | ||
<a name="1.0.17"></a> | ||
## [1.0.17](https://github.com/wessberg/stringutil/compare/v1.0.16...v1.0.17) (2018-06-20) | ||
## [1.0.19](https://github.com/wessberg/stringutil/compare/v1.0.18...v1.0.19) (2019-10-15) | ||
## [1.0.18](https://github.com/wessberg/stringutil/compare/v1.0.17...v1.0.18) (2018-10-18) | ||
### Features | ||
<a name="1.0.16"></a> | ||
## [1.0.16](https://github.com/wessberg/stringutil/compare/v1.0.15...v1.0.16) (2018-05-04) | ||
- Added a new function: 'truncate' ([9241795](https://github.com/wessberg/stringutil/commit/92417959f08578ada494d285629b4437fa583abf)) | ||
## [1.0.17](https://github.com/wessberg/stringutil/compare/v1.0.16...v1.0.17) (2018-06-20) | ||
## [1.0.16](https://github.com/wessberg/stringutil/compare/v1.0.15...v1.0.16) (2018-05-04) | ||
<a name="1.0.15"></a> | ||
## [1.0.15](https://github.com/wessberg/stringutil/compare/v1.0.14...v1.0.15) (2018-03-31) | ||
<a name="1.0.14"></a> | ||
## [1.0.14](https://github.com/wessberg/stringutil/compare/v1.0.13...v1.0.14) (2018-02-03) | ||
<a name="1.0.13"></a> | ||
## [1.0.13](https://github.com/wessberg/stringutil/compare/v1.0.12...v1.0.13) (2017-10-28) | ||
<a name="1.0.12"></a> | ||
## [1.0.12](https://github.com/wessberg/stringutil/compare/v1.0.11...v1.0.12) (2017-10-22) | ||
<a name="1.0.11"></a> | ||
## [1.0.11](https://github.com/wessberg/stringutil/compare/v1.0.10...v1.0.11) (2017-10-22) | ||
<a name="1.0.10"></a> | ||
## [1.0.10](https://github.com/wessberg/stringutil/compare/v1.0.9...v1.0.10) (2017-08-20) | ||
<a name="1.0.9"></a> | ||
## [1.0.9](https://github.com/wessberg/stringutil/compare/v1.0.8...v1.0.9) (2017-08-20) | ||
<a name="1.0.8"></a> | ||
## [1.0.8](https://github.com/wessberg/stringutil/compare/v1.0.7...v1.0.8) (2017-08-08) | ||
<a name="1.0.7"></a> | ||
## [1.0.7](https://github.com/wessberg/stringutil/compare/v1.0.6...v1.0.7) (2017-08-08) | ||
<a name="1.0.6"></a> | ||
## [1.0.6](https://github.com/wessberg/stringutil/compare/v1.0.5...v1.0.6) (2017-08-08) | ||
<a name="1.0.5"></a> | ||
## [1.0.5](https://github.com/wessberg/stringutil/compare/v1.0.4...v1.0.5) (2017-07-11) | ||
<a name="1.0.4"></a> | ||
## [1.0.4](https://github.com/wessberg/stringutil/compare/v1.0.3...v1.0.4) (2017-07-10) | ||
<a name="1.0.3"></a> | ||
## [1.0.3](https://github.com/wessberg/stringutil/compare/v1.0.2...v1.0.3) (2017-07-10) | ||
<a name="1.0.2"></a> | ||
## [1.0.2](https://github.com/wessberg/stringutil/compare/v1.0.1...v1.0.2) (2017-07-10) | ||
<a name="1.0.1"></a> | ||
## 1.0.1 (2017-07-10) | ||
@@ -1,2 +0,162 @@ | ||
export * from "./string-util/string-util"; | ||
export * from "./string-util/i-truncate-options"; | ||
interface ITruncateOptions { | ||
length: number; | ||
omission: string; | ||
} | ||
/** | ||
* Unquotes the given string - if it is quoted | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function unquote(str: string): string; | ||
/** | ||
* Returns true if the string is in camelCase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isInCamelCase(str: string): boolean; | ||
/** | ||
* Returns true if the string is in PascalCase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isInPascalCase(str: string): boolean; | ||
/** | ||
* Returns true if the string is in kebab-case | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isInKebabCase(str: string): boolean; | ||
/** | ||
* Returns true if the string is in uppercase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isLowerCase(str: string): boolean; | ||
/** | ||
* Returns true if the string is in uppercase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isUpperCase(str: string): boolean; | ||
/** | ||
* Lowercases the first character of the string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function lowerCaseFirst(str: string): string; | ||
/** | ||
* Uppercases the first character of the string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function upperCaseFirst(str: string): string; | ||
/** | ||
* Returns true if the string is empty (has nothing but whitespace) | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isEmpty(str: string): boolean; | ||
/** | ||
* Returns true if the given string starts with a quote. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function startsWithQuote(str: string): boolean; | ||
/** | ||
* Returns true if the given string ends with a quote. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function endsWithQuote(str: string): boolean; | ||
/** | ||
* Returns true if the given string is quoted. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isQuoted(str: string): boolean; | ||
/** | ||
* Returns all index matches of the provided Regular Expression on the provided string, optionally starting from a specific index. | ||
* @param {RegExp} regexp | ||
* @param {string} str | ||
* @param {number} [from=0] | ||
* @returns {number[]} | ||
*/ | ||
declare function allIndexesOf(str: string, regexp: RegExp, from?: number): number[]; | ||
/** | ||
* Matches all occurrences of the given RegExp, including capture groups, globally. Supports both global RegExps and non-global RegExps | ||
* @param {string} str | ||
* @param {RegExp} regexp | ||
* @param {number} [from=0] | ||
* @returns {RegExpExecArray[]} | ||
*/ | ||
declare function matchAll(str: string, regexp: RegExp, from?: number): RegExpExecArray[]; | ||
/** | ||
* Trims all of the provided strings. | ||
* @param {string[]} strings | ||
* @returns {string[]} | ||
*/ | ||
declare function trimAll(strings: string[]): string[]; | ||
/** | ||
* camelCases the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function camelCase(str: string): string; | ||
/** | ||
* PascalCases the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function pascalCase(str: string): string; | ||
/** | ||
* Capitalizes the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function capitalize(str: string): string; | ||
/** | ||
* kebab-cases (dash-cases) the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function kebabCase(str: string): string; | ||
/** | ||
* Removes all whitespace from a string. If the second argument is truthy, it will preserve spaces. | ||
* @param {string} str | ||
* @param {boolean} [preserveSpaces=false] | ||
* @returns {string} | ||
*/ | ||
declare function removeWhitespace(str: string, preserveSpaces?: boolean): string; | ||
/** | ||
* Returns true if the given string contains whitespace | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function containsWhitespace(str: string): boolean; | ||
/** | ||
* Returns true if the given string contains nothing but whitespace | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function containsOnlyWhitespace(str: string): boolean; | ||
/** | ||
* Trims a string. It works like String.prototype.trim, except it also handles HTML spaces ( ). | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function trim(str: string): string; | ||
/** | ||
* Replaces special characters like "æ" with "ae". | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function convertToAscii(str: string): string; | ||
/** | ||
* Truncates the given text by the given max length and with the given omission character(s) | ||
* @param {string} text | ||
* @param {ITruncateOptions} [options] | ||
* @returns {string} | ||
*/ | ||
declare function truncate(text: string, { length, omission }?: Partial<ITruncateOptions>): string; | ||
export { unquote, isInCamelCase, isInPascalCase, isInKebabCase, isLowerCase, isUpperCase, lowerCaseFirst, upperCaseFirst, isEmpty, startsWithQuote, endsWithQuote, isQuoted, allIndexesOf, matchAll, trimAll, camelCase, pascalCase, capitalize, kebabCase, removeWhitespace, containsWhitespace, containsOnlyWhitespace, trim, convertToAscii, truncate, ITruncateOptions }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,5 +0,316 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./string-util/string-util"), exports); | ||
//# sourceMappingURL=index.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
/** | ||
* Unquotes the given string - if it is quoted | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function unquote(str) { | ||
return isQuoted(str) ? str.slice(1, str.length - 1) : str; | ||
} | ||
/** | ||
* Returns true if the string is in camelCase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isInCamelCase(str) { | ||
return camelCase(str) === str; | ||
} | ||
/** | ||
* Returns true if the string is in PascalCase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isInPascalCase(str) { | ||
return pascalCase(str) === str; | ||
} | ||
/** | ||
* Returns true if the string is in kebab-case | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isInKebabCase(str) { | ||
return kebabCase(str) === str; | ||
} | ||
/** | ||
* Returns true if the string is in uppercase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isLowerCase(str) { | ||
return str.toLowerCase() === str; | ||
} | ||
/** | ||
* Returns true if the string is in uppercase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isUpperCase(str) { | ||
return str.toUpperCase() === str; | ||
} | ||
/** | ||
* Lowercases the first character of the string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function lowerCaseFirst(str) { | ||
if (str.length < 2) | ||
return str.toLowerCase(); | ||
const head = str.slice(0, 1); | ||
const tail = str.slice(1); | ||
return `${head.toLowerCase()}${tail}`; | ||
} | ||
/** | ||
* Uppercases the first character of the string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function upperCaseFirst(str) { | ||
if (str.length < 2) | ||
return str.toUpperCase(); | ||
const head = str.slice(0, 1); | ||
const tail = str.slice(1); | ||
return `${head.toUpperCase()}${tail}`; | ||
} | ||
/** | ||
* Returns true if the string is empty (has nothing but whitespace) | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isEmpty(str) { | ||
return trim(str).length === 0; | ||
} | ||
/** | ||
* Returns true if the given string starts with a quote. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function startsWithQuote(str) { | ||
return str.startsWith(`"`) || str.startsWith(`'`) || str.startsWith("`"); | ||
} | ||
/** | ||
* Returns true if the given string ends with a quote. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function endsWithQuote(str) { | ||
return str.endsWith(`"`) || str.endsWith(`'`) || str.endsWith("`"); | ||
} | ||
/** | ||
* Returns true if the given string is quoted. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isQuoted(str) { | ||
const trimmed = removeWhitespace(str, true); | ||
return startsWithQuote(trimmed) && endsWithQuote(trimmed); | ||
} | ||
/** | ||
* Returns all index matches of the provided Regular Expression on the provided string, optionally starting from a specific index. | ||
* @param {RegExp} regexp | ||
* @param {string} str | ||
* @param {number} [from=0] | ||
* @returns {number[]} | ||
*/ | ||
function allIndexesOf(str, regexp, from = 0) { | ||
return matchAll(str, regexp, from).map(match => match.index); | ||
} | ||
/** | ||
* Matches all occurrences of the given RegExp, including capture groups, globally. Supports both global RegExps and non-global RegExps | ||
* @param {string} str | ||
* @param {RegExp} regexp | ||
* @param {number} [from=0] | ||
* @returns {RegExpExecArray[]} | ||
*/ | ||
function matchAll(str, regexp, from = 0) { | ||
let flags = regexp.flags; | ||
if (!flags.includes("g")) { | ||
flags += "g"; | ||
} | ||
// Normalize the regular expression and make sure it *does* include the Global ('g') flag | ||
const normalizedRegExp = new RegExp(regexp, flags); | ||
const matches = []; | ||
while (true) { | ||
const match = normalizedRegExp.exec(str); | ||
if (match == null) | ||
break; | ||
if (match.index >= from) { | ||
matches.push(match); | ||
} | ||
} | ||
return matches; | ||
} | ||
/** | ||
* Trims all of the provided strings. | ||
* @param {string[]} strings | ||
* @returns {string[]} | ||
*/ | ||
function trimAll(strings) { | ||
return strings.map(str => trim(str)); | ||
} | ||
/** | ||
* camelCases the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function camelCase(str) { | ||
return lowerCaseFirst(str | ||
// Replaces any - or _ characters with a space | ||
.replace(/[-_+]+/g, " ").replace(/[ ]{2,}/g, " ") | ||
// Removes any non alphanumeric characters | ||
.replace(/[^\w\sa-zæøåàáäâëêéèïîíìöòóôüúùû&]/gi, "").replace(/[A-Z]{2,}/g, $1 => $1.toLowerCase()) | ||
// Uppercases the first character in each group immediately following a space | ||
// (delimited by spaces) | ||
.replace(/ (.)/g, $1 => $1.toUpperCase()) | ||
// Removes spaces | ||
.replace(/ /g, "")); | ||
} | ||
/** | ||
* PascalCases the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function pascalCase(str) { | ||
return capitalize(camelCase(str)); | ||
} | ||
/** | ||
* Capitalizes the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function capitalize(str) { | ||
return str.slice(0, 1).toUpperCase() + str.slice(1); | ||
} | ||
/** | ||
* kebab-cases (dash-cases) the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function kebabCase(str) { | ||
// Lower cases the string | ||
let _str = str; | ||
if (!/[a-zæøåàáäâëêéèïîíìöòóôüúùû]/.test(_str)) | ||
_str = str.toLowerCase(); | ||
return _str.replace(/(?:_)[A-ZÅÀÁÂÄÆËÊÉÈÏÎÍÌÖÔÒÓØÜÛÚÙ]{2,}|[A-Z]{2,}(?=_)/g, $1 => ` ${$1.toLowerCase()}`).replace(/[-_+]/g, " ").replace(/[ \t\r]*[A-ZÅÀÁÂÄÆËÊÉÈÏÎÍÌÖÔÒÓØÜÛÚÙ]+[ \t\r]+/g, $1 => ` ${$1.toLowerCase()} `).replace(/[A-ZÅÀÁÂÄÆËÊÉÈÏÎÍÌÖÔÒÓØÜÛÚÙ]/g, $1 => ` ${$1.toLowerCase()}`).replace(/^[ \t\r]+/g, "").replace(/\s{2,}/g, " ").replace(/\s+/g, "-"); | ||
} | ||
/** | ||
* Removes all whitespace from a string. If the second argument is truthy, it will preserve spaces. | ||
* @param {string} str | ||
* @param {boolean} [preserveSpaces=false] | ||
* @returns {string} | ||
*/ | ||
function removeWhitespace(str, preserveSpaces = false) { | ||
// Convert tabs to spaces and remove anything but spaces. | ||
if (preserveSpaces) { | ||
return str | ||
.replace(/ /g, " ") | ||
.replace(/[\t]/g, " ") | ||
.replace(/[\n\r]/g, "") | ||
.replace(/[ ]{2,}/g, " "); | ||
} | ||
// Remove any kind of whitespace. | ||
return str | ||
.replace(/[ \n\t\r]/g, "") | ||
.replace(/ /, ""); | ||
} | ||
/** | ||
* Returns true if the given string contains whitespace | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function containsWhitespace(str) { | ||
return str.length !== removeWhitespace(str).length; | ||
} | ||
/** | ||
* Returns true if the given string contains nothing but whitespace | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function containsOnlyWhitespace(str) { | ||
return removeWhitespace(str).length === 0; | ||
} | ||
/** | ||
* Trims a string. It works like String.prototype.trim, except it also handles HTML spaces ( ). | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function trim(str) { | ||
let local = str.trim(); | ||
while (local.startsWith(" ")) { | ||
local = local.slice(" ".length); | ||
local = local.trim(); | ||
} | ||
while (local.endsWith(" ")) { | ||
local = local.slice(0, local.length - " ".length); | ||
local = local.trim(); | ||
} | ||
return local; | ||
} | ||
/** | ||
* Replaces special characters like "æ" with "ae". | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function convertToAscii(str) { | ||
return str | ||
.replace(/ /g, "-") | ||
.replace(/_/g, "-") | ||
.replace(/[àáâäãą]/g, "a") | ||
.replace(/[èéêëę]/g, "e") | ||
.replace(/[ìíîïı]/g, "i") | ||
.replace(/[òóôõöőð]/g, "o") | ||
.replace(/[ùúûüŭů]/g, "u") | ||
.replace(/[çćčĉ]/g, "c") | ||
.replace(/[çćčĉ]/g, "c") | ||
.replace(/[żźž]/g, "z") | ||
.replace(/[śşšŝ]/g, "s") | ||
.replace(/[ñń]/g, "n") | ||
.replace(/[ýÿ]/g, "y") | ||
.replace(/[ğĝ]/g, "g") | ||
.replace(/ß/g, "ss") | ||
.replace(/æ/g, "ae") | ||
.replace(/ø/g, "oe") | ||
.replace(/å/g, "aa") | ||
// Remove all other unicode characters | ||
.replace(/[^\x00-\x7F]/g, ""); | ||
} | ||
/** | ||
* Truncates the given text by the given max length and with the given omission character(s) | ||
* @param {string} text | ||
* @param {ITruncateOptions} [options] | ||
* @returns {string} | ||
*/ | ||
function truncate(text, { length = 30, omission = "..." } = {}) { | ||
if (text.length <= length) | ||
return text; | ||
return `${text.slice(0, (length - (omission.length)))}${omission}`; | ||
} | ||
exports.allIndexesOf = allIndexesOf; | ||
exports.camelCase = camelCase; | ||
exports.capitalize = capitalize; | ||
exports.containsOnlyWhitespace = containsOnlyWhitespace; | ||
exports.containsWhitespace = containsWhitespace; | ||
exports.convertToAscii = convertToAscii; | ||
exports.endsWithQuote = endsWithQuote; | ||
exports.isEmpty = isEmpty; | ||
exports.isInCamelCase = isInCamelCase; | ||
exports.isInKebabCase = isInKebabCase; | ||
exports.isInPascalCase = isInPascalCase; | ||
exports.isLowerCase = isLowerCase; | ||
exports.isQuoted = isQuoted; | ||
exports.isUpperCase = isUpperCase; | ||
exports.kebabCase = kebabCase; | ||
exports.lowerCaseFirst = lowerCaseFirst; | ||
exports.matchAll = matchAll; | ||
exports.pascalCase = pascalCase; | ||
exports.removeWhitespace = removeWhitespace; | ||
exports.startsWithQuote = startsWithQuote; | ||
exports.trim = trim; | ||
exports.trimAll = trimAll; | ||
exports.truncate = truncate; | ||
exports.unquote = unquote; | ||
exports.upperCaseFirst = upperCaseFirst; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,162 @@ | ||
export * from "./string-util/string-util"; | ||
export * from "./string-util/i-truncate-options"; | ||
interface ITruncateOptions { | ||
length: number; | ||
omission: string; | ||
} | ||
/** | ||
* Unquotes the given string - if it is quoted | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function unquote(str: string): string; | ||
/** | ||
* Returns true if the string is in camelCase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isInCamelCase(str: string): boolean; | ||
/** | ||
* Returns true if the string is in PascalCase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isInPascalCase(str: string): boolean; | ||
/** | ||
* Returns true if the string is in kebab-case | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isInKebabCase(str: string): boolean; | ||
/** | ||
* Returns true if the string is in uppercase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isLowerCase(str: string): boolean; | ||
/** | ||
* Returns true if the string is in uppercase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isUpperCase(str: string): boolean; | ||
/** | ||
* Lowercases the first character of the string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function lowerCaseFirst(str: string): string; | ||
/** | ||
* Uppercases the first character of the string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function upperCaseFirst(str: string): string; | ||
/** | ||
* Returns true if the string is empty (has nothing but whitespace) | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isEmpty(str: string): boolean; | ||
/** | ||
* Returns true if the given string starts with a quote. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function startsWithQuote(str: string): boolean; | ||
/** | ||
* Returns true if the given string ends with a quote. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function endsWithQuote(str: string): boolean; | ||
/** | ||
* Returns true if the given string is quoted. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function isQuoted(str: string): boolean; | ||
/** | ||
* Returns all index matches of the provided Regular Expression on the provided string, optionally starting from a specific index. | ||
* @param {RegExp} regexp | ||
* @param {string} str | ||
* @param {number} [from=0] | ||
* @returns {number[]} | ||
*/ | ||
declare function allIndexesOf(str: string, regexp: RegExp, from?: number): number[]; | ||
/** | ||
* Matches all occurrences of the given RegExp, including capture groups, globally. Supports both global RegExps and non-global RegExps | ||
* @param {string} str | ||
* @param {RegExp} regexp | ||
* @param {number} [from=0] | ||
* @returns {RegExpExecArray[]} | ||
*/ | ||
declare function matchAll(str: string, regexp: RegExp, from?: number): RegExpExecArray[]; | ||
/** | ||
* Trims all of the provided strings. | ||
* @param {string[]} strings | ||
* @returns {string[]} | ||
*/ | ||
declare function trimAll(strings: string[]): string[]; | ||
/** | ||
* camelCases the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function camelCase(str: string): string; | ||
/** | ||
* PascalCases the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function pascalCase(str: string): string; | ||
/** | ||
* Capitalizes the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function capitalize(str: string): string; | ||
/** | ||
* kebab-cases (dash-cases) the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function kebabCase(str: string): string; | ||
/** | ||
* Removes all whitespace from a string. If the second argument is truthy, it will preserve spaces. | ||
* @param {string} str | ||
* @param {boolean} [preserveSpaces=false] | ||
* @returns {string} | ||
*/ | ||
declare function removeWhitespace(str: string, preserveSpaces?: boolean): string; | ||
/** | ||
* Returns true if the given string contains whitespace | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function containsWhitespace(str: string): boolean; | ||
/** | ||
* Returns true if the given string contains nothing but whitespace | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
declare function containsOnlyWhitespace(str: string): boolean; | ||
/** | ||
* Trims a string. It works like String.prototype.trim, except it also handles HTML spaces ( ). | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function trim(str: string): string; | ||
/** | ||
* Replaces special characters like "æ" with "ae". | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
declare function convertToAscii(str: string): string; | ||
/** | ||
* Truncates the given text by the given max length and with the given omission character(s) | ||
* @param {string} text | ||
* @param {ITruncateOptions} [options] | ||
* @returns {string} | ||
*/ | ||
declare function truncate(text: string, { length, omission }?: Partial<ITruncateOptions>): string; | ||
export { unquote, isInCamelCase, isInPascalCase, isInKebabCase, isLowerCase, isUpperCase, lowerCaseFirst, upperCaseFirst, isEmpty, startsWithQuote, endsWithQuote, isQuoted, allIndexesOf, matchAll, trimAll, camelCase, pascalCase, capitalize, kebabCase, removeWhitespace, containsWhitespace, containsOnlyWhitespace, trim, convertToAscii, truncate, ITruncateOptions }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,290 @@ | ||
export * from "./string-util/string-util"; | ||
//# sourceMappingURL=index.js.map | ||
/** | ||
* Unquotes the given string - if it is quoted | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function unquote(str) { | ||
return isQuoted(str) ? str.slice(1, str.length - 1) : str; | ||
} | ||
/** | ||
* Returns true if the string is in camelCase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isInCamelCase(str) { | ||
return camelCase(str) === str; | ||
} | ||
/** | ||
* Returns true if the string is in PascalCase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isInPascalCase(str) { | ||
return pascalCase(str) === str; | ||
} | ||
/** | ||
* Returns true if the string is in kebab-case | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isInKebabCase(str) { | ||
return kebabCase(str) === str; | ||
} | ||
/** | ||
* Returns true if the string is in uppercase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isLowerCase(str) { | ||
return str.toLowerCase() === str; | ||
} | ||
/** | ||
* Returns true if the string is in uppercase | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isUpperCase(str) { | ||
return str.toUpperCase() === str; | ||
} | ||
/** | ||
* Lowercases the first character of the string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function lowerCaseFirst(str) { | ||
if (str.length < 2) | ||
return str.toLowerCase(); | ||
const head = str.slice(0, 1); | ||
const tail = str.slice(1); | ||
return `${head.toLowerCase()}${tail}`; | ||
} | ||
/** | ||
* Uppercases the first character of the string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function upperCaseFirst(str) { | ||
if (str.length < 2) | ||
return str.toUpperCase(); | ||
const head = str.slice(0, 1); | ||
const tail = str.slice(1); | ||
return `${head.toUpperCase()}${tail}`; | ||
} | ||
/** | ||
* Returns true if the string is empty (has nothing but whitespace) | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isEmpty(str) { | ||
return trim(str).length === 0; | ||
} | ||
/** | ||
* Returns true if the given string starts with a quote. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function startsWithQuote(str) { | ||
return str.startsWith(`"`) || str.startsWith(`'`) || str.startsWith("`"); | ||
} | ||
/** | ||
* Returns true if the given string ends with a quote. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function endsWithQuote(str) { | ||
return str.endsWith(`"`) || str.endsWith(`'`) || str.endsWith("`"); | ||
} | ||
/** | ||
* Returns true if the given string is quoted. | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function isQuoted(str) { | ||
const trimmed = removeWhitespace(str, true); | ||
return startsWithQuote(trimmed) && endsWithQuote(trimmed); | ||
} | ||
/** | ||
* Returns all index matches of the provided Regular Expression on the provided string, optionally starting from a specific index. | ||
* @param {RegExp} regexp | ||
* @param {string} str | ||
* @param {number} [from=0] | ||
* @returns {number[]} | ||
*/ | ||
function allIndexesOf(str, regexp, from = 0) { | ||
return matchAll(str, regexp, from).map(match => match.index); | ||
} | ||
/** | ||
* Matches all occurrences of the given RegExp, including capture groups, globally. Supports both global RegExps and non-global RegExps | ||
* @param {string} str | ||
* @param {RegExp} regexp | ||
* @param {number} [from=0] | ||
* @returns {RegExpExecArray[]} | ||
*/ | ||
function matchAll(str, regexp, from = 0) { | ||
let flags = regexp.flags; | ||
if (!flags.includes("g")) { | ||
flags += "g"; | ||
} | ||
// Normalize the regular expression and make sure it *does* include the Global ('g') flag | ||
const normalizedRegExp = new RegExp(regexp, flags); | ||
const matches = []; | ||
while (true) { | ||
const match = normalizedRegExp.exec(str); | ||
if (match == null) | ||
break; | ||
if (match.index >= from) { | ||
matches.push(match); | ||
} | ||
} | ||
return matches; | ||
} | ||
/** | ||
* Trims all of the provided strings. | ||
* @param {string[]} strings | ||
* @returns {string[]} | ||
*/ | ||
function trimAll(strings) { | ||
return strings.map(str => trim(str)); | ||
} | ||
/** | ||
* camelCases the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function camelCase(str) { | ||
return lowerCaseFirst(str | ||
// Replaces any - or _ characters with a space | ||
.replace(/[-_+]+/g, " ").replace(/[ ]{2,}/g, " ") | ||
// Removes any non alphanumeric characters | ||
.replace(/[^\w\sa-zæøåàáäâëêéèïîíìöòóôüúùû&]/gi, "").replace(/[A-Z]{2,}/g, $1 => $1.toLowerCase()) | ||
// Uppercases the first character in each group immediately following a space | ||
// (delimited by spaces) | ||
.replace(/ (.)/g, $1 => $1.toUpperCase()) | ||
// Removes spaces | ||
.replace(/ /g, "")); | ||
} | ||
/** | ||
* PascalCases the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function pascalCase(str) { | ||
return capitalize(camelCase(str)); | ||
} | ||
/** | ||
* Capitalizes the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function capitalize(str) { | ||
return str.slice(0, 1).toUpperCase() + str.slice(1); | ||
} | ||
/** | ||
* kebab-cases (dash-cases) the given string. | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function kebabCase(str) { | ||
// Lower cases the string | ||
let _str = str; | ||
if (!/[a-zæøåàáäâëêéèïîíìöòóôüúùû]/.test(_str)) | ||
_str = str.toLowerCase(); | ||
return _str.replace(/(?:_)[A-ZÅÀÁÂÄÆËÊÉÈÏÎÍÌÖÔÒÓØÜÛÚÙ]{2,}|[A-Z]{2,}(?=_)/g, $1 => ` ${$1.toLowerCase()}`).replace(/[-_+]/g, " ").replace(/[ \t\r]*[A-ZÅÀÁÂÄÆËÊÉÈÏÎÍÌÖÔÒÓØÜÛÚÙ]+[ \t\r]+/g, $1 => ` ${$1.toLowerCase()} `).replace(/[A-ZÅÀÁÂÄÆËÊÉÈÏÎÍÌÖÔÒÓØÜÛÚÙ]/g, $1 => ` ${$1.toLowerCase()}`).replace(/^[ \t\r]+/g, "").replace(/\s{2,}/g, " ").replace(/\s+/g, "-"); | ||
} | ||
/** | ||
* Removes all whitespace from a string. If the second argument is truthy, it will preserve spaces. | ||
* @param {string} str | ||
* @param {boolean} [preserveSpaces=false] | ||
* @returns {string} | ||
*/ | ||
function removeWhitespace(str, preserveSpaces = false) { | ||
// Convert tabs to spaces and remove anything but spaces. | ||
if (preserveSpaces) { | ||
return str | ||
.replace(/ /g, " ") | ||
.replace(/[\t]/g, " ") | ||
.replace(/[\n\r]/g, "") | ||
.replace(/[ ]{2,}/g, " "); | ||
} | ||
// Remove any kind of whitespace. | ||
return str | ||
.replace(/[ \n\t\r]/g, "") | ||
.replace(/ /, ""); | ||
} | ||
/** | ||
* Returns true if the given string contains whitespace | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function containsWhitespace(str) { | ||
return str.length !== removeWhitespace(str).length; | ||
} | ||
/** | ||
* Returns true if the given string contains nothing but whitespace | ||
* @param {string} str | ||
* @returns {boolean} | ||
*/ | ||
function containsOnlyWhitespace(str) { | ||
return removeWhitespace(str).length === 0; | ||
} | ||
/** | ||
* Trims a string. It works like String.prototype.trim, except it also handles HTML spaces ( ). | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function trim(str) { | ||
let local = str.trim(); | ||
while (local.startsWith(" ")) { | ||
local = local.slice(" ".length); | ||
local = local.trim(); | ||
} | ||
while (local.endsWith(" ")) { | ||
local = local.slice(0, local.length - " ".length); | ||
local = local.trim(); | ||
} | ||
return local; | ||
} | ||
/** | ||
* Replaces special characters like "æ" with "ae". | ||
* @param {string} str | ||
* @returns {string} | ||
*/ | ||
function convertToAscii(str) { | ||
return str | ||
.replace(/ /g, "-") | ||
.replace(/_/g, "-") | ||
.replace(/[àáâäãą]/g, "a") | ||
.replace(/[èéêëę]/g, "e") | ||
.replace(/[ìíîïı]/g, "i") | ||
.replace(/[òóôõöőð]/g, "o") | ||
.replace(/[ùúûüŭů]/g, "u") | ||
.replace(/[çćčĉ]/g, "c") | ||
.replace(/[çćčĉ]/g, "c") | ||
.replace(/[żźž]/g, "z") | ||
.replace(/[śşšŝ]/g, "s") | ||
.replace(/[ñń]/g, "n") | ||
.replace(/[ýÿ]/g, "y") | ||
.replace(/[ğĝ]/g, "g") | ||
.replace(/ß/g, "ss") | ||
.replace(/æ/g, "ae") | ||
.replace(/ø/g, "oe") | ||
.replace(/å/g, "aa") | ||
// Remove all other unicode characters | ||
.replace(/[^\x00-\x7F]/g, ""); | ||
} | ||
/** | ||
* Truncates the given text by the given max length and with the given omission character(s) | ||
* @param {string} text | ||
* @param {ITruncateOptions} [options] | ||
* @returns {string} | ||
*/ | ||
function truncate(text, { length = 30, omission = "..." } = {}) { | ||
if (text.length <= length) | ||
return text; | ||
return `${text.slice(0, (length - (omission.length)))}${omission}`; | ||
} | ||
export { allIndexesOf, camelCase, capitalize, containsOnlyWhitespace, containsWhitespace, convertToAscii, endsWithQuote, isEmpty, isInCamelCase, isInKebabCase, isInPascalCase, isLowerCase, isQuoted, isUpperCase, kebabCase, lowerCaseFirst, matchAll, pascalCase, removeWhitespace, startsWithQuote, trim, trimAll, truncate, unquote, upperCaseFirst }; | ||
//# sourceMappingURL=index.js.map |
The MIT License (MIT) | ||
Copyright © 2018 Frederik Wessberg <frederikwessberg@hotmail.com> | ||
Copyright © 2019 [Frederik Wessberg](mailto:frederikwessberg@hotmail.com) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg)) | ||
@@ -21,2 +21,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE | ||
SOFTWARE |
109
package.json
{ | ||
"name": "@wessberg/stringutil", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "A collection of helper functions for working with strings", | ||
@@ -16,29 +16,19 @@ "repository": { | ||
"scripts": { | ||
"generate:readme": "scaffold readme --blacklist faq", | ||
"generate:license": "scaffold license", | ||
"generate:contributing": "scaffold contributing", | ||
"generate:coc": "scaffold coc", | ||
"generate:changelog": "standard-changelog", | ||
"generate:all": "npm run generate:license & npm run generate:contributing & npm run generate:coc & npm run generate:readme & npm run generate:changelog", | ||
"generate:readme": "scaffold readme --yes", | ||
"generate:license": "scaffold license --yes", | ||
"generate:contributing": "scaffold contributing --yes", | ||
"generate:coc": "scaffold coc --yes", | ||
"generate:changelog": "standard-changelog --first-release", | ||
"generate:all": "npm run generate:license & npm run generate:contributing & npm run generate:coc & npm run generate:readme && npm run generate:changelog", | ||
"clean:dist": "rm -rf dist", | ||
"clean:compiled": "rm -rf compiled", | ||
"clean": "npm run clean:dist && npm run clean:compiled", | ||
"clean": "npm run clean:dist", | ||
"lint": "tsc --noEmit && tslint -c tslint.json --project tsconfig.json", | ||
"tsc:dist:cjs": "tsc --module commonjs --outDir dist/cjs -p tsconfig.dist.json", | ||
"tsc:dist:esm": "tsc --module es2015 --outDir dist/esm -p tsconfig.dist.json", | ||
"tsc:test": "tsc --module commonjs --target es2017 --sourceMap", | ||
"build:cjs": "npm run tsc:dist:cjs", | ||
"build:esm": "npm run tsc:dist:esm", | ||
"build:test": "npm run tsc:test", | ||
"prebuild": "npm run clean", | ||
"build": "npm run build:cjs & npm run build:esm", | ||
"pretest": "npm run clean:compiled && npm run build:test", | ||
"test": "NODE_ENV=TEST ava --verbose", | ||
"posttest": "npm run clean:compiled", | ||
"validate": "npm run lint && npm run test", | ||
"publish:pre": "NODE_ENV=production npm run validate && NODE_ENV=production npm run build", | ||
"publish:meta": "npm run generate:all && git add . && (git commit -am \"Bumped version\" || true) && git push", | ||
"publish:patch": "npm run publish:pre && npm version patch && npm run publish:meta && npm publish", | ||
"publish:minor": "npm run publish:pre && npm version minor && npm run publish:meta && npm publish", | ||
"publish:major": "npm run publish:pre && npm version minor && npm run publish:meta && npm publish" | ||
"prettier": "prettier --write '{src,test,documentation}/**/*.{js,ts,json,html,xml,css,md}'", | ||
"test": "ava", | ||
"prebuild": "npm run clean:dist", | ||
"build": "npm run rollup", | ||
"rollup": "rollup -c rollup.config.js", | ||
"preversion": "npm run lint && NODE_ENV=production npm run build", | ||
"version": "npm run generate:all && git add .", | ||
"release": "np --no-cleanup --no-yarn" | ||
}, | ||
@@ -53,19 +43,29 @@ "keywords": [ | ||
], | ||
"author": { | ||
"name": "Frederik Wessberg", | ||
"email": "frederikwessberg@hotmail.com", | ||
"url": "https://github.com/wessberg" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Frederik Wessberg", | ||
"email": "frederikwessberg@hotmail.com", | ||
"url": "https://github.com/wessberg", | ||
"imageUrl": "https://avatars2.githubusercontent.com/u/20454213?s=460&v=4", | ||
"github": "wessberg", | ||
"role": "Lead Developer", | ||
"twitter": "FredWessberg" | ||
} | ||
], | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@wessberg/ts-config": "^0.0.30", | ||
"@wessberg/scaffold": "^1.0.4", | ||
"standard-changelog": "^2.0.1", | ||
"ava": "^0.25.0", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.1.3" | ||
"@wessberg/ts-config": "^0.0.41", | ||
"@wessberg/scaffold": "^1.0.19", | ||
"@wessberg/rollup-plugin-ts": "^1.1.69", | ||
"rollup": "^1.24.0", | ||
"ava": "^2.4.0", | ||
"tslint": "^5.20.0", | ||
"typescript": "^3.6.4", | ||
"standard-changelog": "^2.0.15", | ||
"prettier": "^1.18.2", | ||
"pretty-quick": "^2.0.0", | ||
"husky": "^3.0.9", | ||
"np": "^5.1.1", | ||
"ts-node": "^8.4.1" | ||
}, | ||
"dependencies": { | ||
"tslib": "^1.9.3" | ||
}, | ||
"main": "./dist/cjs/index.js", | ||
@@ -78,16 +78,21 @@ "module": "./dist/esm/index.js", | ||
"engines": { | ||
"node": ">=9.0.0" | ||
"node": ">=8.0.0" | ||
}, | ||
"scaffold": { | ||
"patreonUserId": "11315442", | ||
"contributorMeta": { | ||
"Frederik Wessberg": { | ||
"imageUrl": "https://avatars2.githubusercontent.com/u/20454213?s=460&v=4", | ||
"role": "Maintainer", | ||
"twitterHandle": "FredWessberg", | ||
"isCocEnforcer": true | ||
} | ||
}, | ||
"backers": [] | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "pretty-quick --staged" | ||
} | ||
}, | ||
"ava": { | ||
"files": [ | ||
"test/*.test.ts" | ||
], | ||
"compileEnhancements": false, | ||
"extensions": [ | ||
"ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
} | ||
} |
103
README.md
@@ -1,16 +0,65 @@ | ||
<a href="https://npmcharts.com/compare/@wessberg/stringutil?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/%40wessberg%2Fstringutil.svg" height="20"></img></a> | ||
<a href="https://david-dm.org/wessberg/stringutil"><img alt="Dependencies" src="https://img.shields.io/david/wessberg/stringutil.svg" height="20"></img></a> | ||
<a href="https://www.npmjs.com/package/@wessberg/stringutil"><img alt="NPM Version" src="https://badge.fury.io/js/%40wessberg%2Fstringutil.svg" height="20"></img></a> | ||
<a href="https://github.com/wessberg/stringutil/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/wessberg%2Fstringutil.svg" height="20"></img></a> | ||
<a href="https://opensource.org/licenses/MIT"><img alt="MIT License" src="https://img.shields.io/badge/License-MIT-yellow.svg" height="20"></img></a> | ||
<a href="https://www.patreon.com/bePatron?u=11315442"><img alt="Support on Patreon" src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" height="20"></img></a> | ||
<!-- SHADOW_SECTION_LOGO_START --> | ||
# `@wessberg/stringutil` | ||
<!-- SHADOW_SECTION_LOGO_END --> | ||
<!-- SHADOW_SECTION_DESCRIPTION_SHORT_START --> | ||
> A collection of helper functions for working with strings | ||
<!-- SHADOW_SECTION_DESCRIPTION_SHORT_END --> | ||
<!-- SHADOW_SECTION_BADGES_START --> | ||
<a href="https://npmcharts.com/compare/%40wessberg%2Fstringutil?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/%40wessberg%2Fstringutil.svg" /></a> | ||
<a href="https://www.npmjs.com/package/%40wessberg%2Fstringutil"><img alt="NPM version" src="https://badge.fury.io/js/%40wessberg%2Fstringutil.svg" /></a> | ||
<a href="https://david-dm.org/wessberg/stringutil"><img alt="Dependencies" src="https://img.shields.io/david/wessberg%2Fstringutil.svg" /></a> | ||
<a href="https://github.com/wessberg/stringutil/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/wessberg%2Fstringutil.svg" /></a> | ||
<a href="https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square" /></a> | ||
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" /></a> | ||
<a href="https://www.patreon.com/bePatron?u=11315442"><img alt="Support on Patreon" src="https://img.shields.io/badge/patreon-donate-green.svg" /></a> | ||
<!-- SHADOW_SECTION_BADGES_END --> | ||
<!-- SHADOW_SECTION_DESCRIPTION_LONG_START --> | ||
## Description | ||
A collection of helper functions for working with strings. | ||
<!-- SHADOW_SECTION_DESCRIPTION_LONG_END --> | ||
This library is a simple collection of helper functions for working with strings. | ||
<!-- SHADOW_SECTION_FEATURES_START --> | ||
### Features | ||
<!-- SHADOW_SECTION_FEATURES_END --> | ||
- Various helpers for changing and checking casing | ||
- Helpers for changing and checking quoting | ||
<!-- SHADOW_SECTION_FEATURE_IMAGE_START --> | ||
<!-- SHADOW_SECTION_FEATURE_IMAGE_END --> | ||
<!-- SHADOW_SECTION_TOC_START --> | ||
## Table of Contents | ||
- [Description](#description) | ||
- [Features](#features) | ||
- [Table of Contents](#table-of-contents) | ||
- [Install](#install) | ||
- [NPM](#npm) | ||
- [Yarn](#yarn) | ||
- [Usage](#usage) | ||
- [Contributing](#contributing) | ||
- [Maintainers](#maintainers) | ||
- [Backers](#backers) | ||
- [Patreon](#patreon) | ||
- [License](#license) | ||
<!-- SHADOW_SECTION_TOC_END --> | ||
<!-- SHADOW_SECTION_INSTALL_START --> | ||
## Install | ||
@@ -30,4 +79,10 @@ | ||
<!-- SHADOW_SECTION_INSTALL_END --> | ||
<!-- SHADOW_SECTION_USAGE_START --> | ||
## Usage | ||
<!-- SHADOW_SECTION_USAGE_END --> | ||
```typescript | ||
@@ -42,2 +97,4 @@ import {camelCase, allIndexesOf} from "@wessberg/stringutil"; | ||
<!-- SHADOW_SECTION_CONTRIBUTING_START --> | ||
## Contributing | ||
@@ -47,12 +104,32 @@ | ||
<!-- SHADOW_SECTION_CONTRIBUTING_END --> | ||
<!-- SHADOW_SECTION_MAINTAINERS_START --> | ||
## Maintainers | ||
- <a href="https://github.com/wessberg"><img alt="Frederik Wessberg" src="https://avatars2.githubusercontent.com/u/20454213?s=460&v=4" height="11"></img></a> [Frederik Wessberg](https://github.com/wessberg): _Maintainer_ | ||
| <img alt="Frederik Wessberg" src="https://avatars2.githubusercontent.com/u/20454213?s=460&v=4" height="70" /> | | ||
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| [Frederik Wessberg](mailto:frederikwessberg@hotmail.com)<br><strong>Twitter</strong>: [@FredWessberg](https://twitter.com/FredWessberg)<br><strong>Github</strong>: [@wessberg](https://github.com/wessberg)<br>_Lead Developer_ | | ||
## Backers 🏅 | ||
<!-- SHADOW_SECTION_MAINTAINERS_END --> | ||
[Become a backer](https://www.patreon.com/bePatron?u=11315442) and get your name, logo, and link to your site listed here. | ||
<!-- SHADOW_SECTION_BACKERS_START --> | ||
## License 📄 | ||
## Backers | ||
MIT © [Frederik Wessberg](https://github.com/wessberg) | ||
### Patreon | ||
[Become a backer](https://www.patreon.com/bePatron?u=11315442) and get your name, avatar, and Twitter handle listed here. | ||
<a href="https://www.patreon.com/bePatron?u=11315442"><img alt="Backers on Patreon" src="https://patreon-badge.herokuapp.com/11315442.png" width="500" /></a> | ||
<!-- SHADOW_SECTION_BACKERS_END --> | ||
<!-- SHADOW_SECTION_LICENSE_START --> | ||
## License | ||
MIT © [Frederik Wessberg](mailto:frederikwessberg@hotmail.com) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg)) | ||
<!-- SHADOW_SECTION_LICENSE_END --> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
71625
0
133
13
12
927
- Removedtslib@^1.9.3
- Removedtslib@1.14.1(transitive)