@hint/utils-string
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -6,5 +6,5 @@ "use strict"; | ||
const mergeIgnoreIncludeArrays = (originalArray, ignoreArray = [], includeArray = []) => { | ||
let result = to_lowercase_array_1.toLowerCaseArray(originalArray); | ||
const include = to_lowercase_array_1.toLowerCaseArray(includeArray); | ||
const ignore = to_lowercase_array_1.toLowerCaseArray(ignoreArray); | ||
let result = (0, to_lowercase_array_1.toLowerCaseArray)(originalArray); | ||
const include = (0, to_lowercase_array_1.toLowerCaseArray)(includeArray); | ||
const ignore = (0, to_lowercase_array_1.toLowerCaseArray)(ignoreArray); | ||
include.forEach((e) => { | ||
@@ -11,0 +11,0 @@ if (!result.includes(e)) { |
@@ -6,4 +6,4 @@ "use strict"; | ||
const normalizeIncludes = (source, included) => { | ||
return normalize_string_1.normalizeString(source).includes(normalize_string_1.normalizeString(included)); | ||
return (0, normalize_string_1.normalizeString)(source).includes((0, normalize_string_1.normalizeString)(included)); | ||
}; | ||
exports.normalizeIncludes = normalizeIncludes; |
@@ -6,4 +6,4 @@ "use strict"; | ||
const normalizeStringByDelimiter = (value, delimiter) => { | ||
return normalize_string_1.normalizeString(value).replace(/[^a-z0-9]/gi, delimiter); | ||
return (0, normalize_string_1.normalizeString)(value).replace(/[^a-z0-9]/gi, delimiter); | ||
}; | ||
exports.normalizeStringByDelimiter = normalizeStringByDelimiter; |
@@ -5,12 +5,12 @@ "use strict"; | ||
const src_1 = require("../src"); | ||
ava_1.default(`cutString returns a string if it's smaller than the threshold`, (t) => { | ||
(0, ava_1.default)(`cutString returns a string if it's smaller than the threshold`, (t) => { | ||
const source = 'this-is-a-string'; | ||
const transformed = src_1.cutString(source); | ||
const transformed = (0, src_1.cutString)(source); | ||
t.is(transformed, source, `${transformed} !== ${source}`); | ||
}); | ||
ava_1.default(`cutString cuts the string and adds "…" if it is bigger than the threshold`, (t) => { | ||
(0, ava_1.default)(`cutString cuts the string and adds "…" if it is bigger than the threshold`, (t) => { | ||
const source = 'this-is-a-string'; | ||
const expected = 'thi … ring'; | ||
const transformed = src_1.cutString(source, 10); | ||
const transformed = (0, src_1.cutString)(source, 10); | ||
t.is(transformed, expected, `${transformed} !== ${expected}`); | ||
}); |
@@ -12,17 +12,17 @@ "use strict"; | ||
const headersArray = Object.keys(headers); | ||
ava_1.default('mergeIgnoreIncludeArrays - new headers are included', (t) => { | ||
(0, ava_1.default)('mergeIgnoreIncludeArrays - new headers are included', (t) => { | ||
const included = ['header-4', 'header-5']; | ||
const includedHeaders = src_1.mergeIgnoreIncludeArrays(headersArray, undefined, included); | ||
const includedHeaders = (0, src_1.mergeIgnoreIncludeArrays)(headersArray, undefined, included); | ||
t.deepEqual(includedHeaders, ['header-1', 'header-2', 'header-3', 'header-4', 'header-5']); | ||
}); | ||
ava_1.default('mergeIgnoreIncludeArrays - headers are excluded', (t) => { | ||
(0, ava_1.default)('mergeIgnoreIncludeArrays - headers are excluded', (t) => { | ||
const excluded = ['header-1', 'header-2']; | ||
const includedHeaders = src_1.mergeIgnoreIncludeArrays(headersArray, excluded); | ||
const includedHeaders = (0, src_1.mergeIgnoreIncludeArrays)(headersArray, excluded); | ||
t.deepEqual(includedHeaders, ['header-3', 'header-4']); | ||
}); | ||
ava_1.default('mergeIgnoreIncludeArrays - some included, some excluded', (t) => { | ||
(0, ava_1.default)('mergeIgnoreIncludeArrays - some included, some excluded', (t) => { | ||
const included = ['header-5', 'header-6']; | ||
const excluded = ['header-1', 'header-2']; | ||
const includedHeaders = src_1.mergeIgnoreIncludeArrays(headersArray, excluded, included); | ||
const includedHeaders = (0, src_1.mergeIgnoreIncludeArrays)(headersArray, excluded, included); | ||
t.deepEqual(includedHeaders, ['header-3', 'header-4', 'header-5', 'header-6']); | ||
}); |
@@ -5,8 +5,8 @@ "use strict"; | ||
const src_1 = require("../src"); | ||
ava_1.default('normalizeIncludes should return the right value', (t) => { | ||
(0, ava_1.default)('normalizeIncludes should return the right value', (t) => { | ||
const mainString = ' ThIs is a noT nOrmaLIZed sTRing '; | ||
t.true(src_1.normalizeIncludes(mainString, ' this ')); | ||
t.false(src_1.normalizeIncludes(mainString, 'sttring')); | ||
t.true(src_1.normalizeIncludes(mainString, 'norma')); | ||
t.true(src_1.normalizeIncludes(mainString, 'string')); | ||
t.true((0, src_1.normalizeIncludes)(mainString, ' this ')); | ||
t.false((0, src_1.normalizeIncludes)(mainString, 'sttring')); | ||
t.true((0, src_1.normalizeIncludes)(mainString, 'norma')); | ||
t.true((0, src_1.normalizeIncludes)(mainString, 'string')); | ||
}); |
@@ -5,6 +5,6 @@ "use strict"; | ||
const src_1 = require("../src"); | ||
ava_1.default(`normalizeStringByDelimiter returns a string replacing everithing that is not a letter or a number by the provided delimiter`, (t) => { | ||
t.is(src_1.normalizeStringByDelimiter(' test ', '*'), 'test'); | ||
t.is(src_1.normalizeStringByDelimiter(' test test', '-'), 'test-test'); | ||
t.is(src_1.normalizeStringByDelimiter(' te st ', '~'), 'te~st'); | ||
(0, ava_1.default)(`normalizeStringByDelimiter returns a string replacing everithing that is not a letter or a number by the provided delimiter`, (t) => { | ||
t.is((0, src_1.normalizeStringByDelimiter)(' test ', '*'), 'test'); | ||
t.is((0, src_1.normalizeStringByDelimiter)(' test test', '-'), 'test-test'); | ||
t.is((0, src_1.normalizeStringByDelimiter)(' te st ', '~'), 'te~st'); | ||
}); |
@@ -5,11 +5,11 @@ "use strict"; | ||
const src_1 = require("../src"); | ||
ava_1.default(`prettyPrintArray returns an empty string if the array is empty`, (t) => { | ||
(0, ava_1.default)(`prettyPrintArray returns an empty string if the array is empty`, (t) => { | ||
const expectedString = ''; | ||
const result = src_1.prettyPrintArray([]); | ||
const result = (0, src_1.prettyPrintArray)([]); | ||
t.is(result, expectedString); | ||
}); | ||
ava_1.default(`prettyPrintArray returns the expected string`, (t) => { | ||
t.is(src_1.prettyPrintArray(['1']), `'1'`); | ||
t.is(src_1.prettyPrintArray(['1', '2']), `'1' and '2'`); | ||
t.is(src_1.prettyPrintArray(['1', '2', '3']), `'1', '2', and '3'`); | ||
(0, ava_1.default)(`prettyPrintArray returns the expected string`, (t) => { | ||
t.is((0, src_1.prettyPrintArray)(['1']), `'1'`); | ||
t.is((0, src_1.prettyPrintArray)(['1', '2']), `'1' and '2'`); | ||
t.is((0, src_1.prettyPrintArray)(['1', '2', '3']), `'1', '2', and '3'`); | ||
}); |
@@ -5,7 +5,7 @@ "use strict"; | ||
const src_1 = require("../src"); | ||
ava_1.default('toCamelCase transforms a - separated string to camelCase', (t) => { | ||
(0, ava_1.default)('toCamelCase transforms a - separated string to camelCase', (t) => { | ||
const source = 'this-is-a-string'; | ||
const expected = 'thisIsAString'; | ||
const transformed = src_1.toCamelCase(source); | ||
const transformed = (0, src_1.toCamelCase)(source); | ||
t.is(transformed, expected, `${transformed} !== ${expected}`); | ||
}); |
@@ -5,3 +5,3 @@ "use strict"; | ||
const to_lowercase_keys_1 = require("../src/to-lowercase-keys"); | ||
ava_1.default('toLowerCaseKeys lowercases the properties of an object', (t) => { | ||
(0, ava_1.default)('toLowerCaseKeys lowercases the properties of an object', (t) => { | ||
const obj = { | ||
@@ -12,4 +12,4 @@ SometHing: true, | ||
const expected = [['something', true], ['another', false]]; | ||
const actual = Object.entries(to_lowercase_keys_1.toLowerCaseKeys(obj)); | ||
const actual = Object.entries((0, to_lowercase_keys_1.toLowerCaseKeys)(obj)); | ||
t.deepEqual(actual, expected, `Entries are not the same.`); | ||
}); |
@@ -5,16 +5,16 @@ "use strict"; | ||
const src_1 = require("../src"); | ||
ava_1.default(`toPascalCase returns a string in Pascal Case`, (t) => { | ||
(0, ava_1.default)(`toPascalCase returns a string in Pascal Case`, (t) => { | ||
const expected = 'ThisIsAString'; | ||
const pascalCased = src_1.toPascalCase('this-is-a-string'); | ||
const pascalCased = (0, src_1.toPascalCase)('this-is-a-string'); | ||
t.is(pascalCased, expected); | ||
}); | ||
ava_1.default(`toPascalCase returns a string in Pascal Case even if the input doesn't have delimiter`, (t) => { | ||
(0, ava_1.default)(`toPascalCase returns a string in Pascal Case even if the input doesn't have delimiter`, (t) => { | ||
const expected = 'Test'; | ||
const pascalCased = src_1.toPascalCase('test'); | ||
const pascalCased = (0, src_1.toPascalCase)('test'); | ||
t.is(pascalCased, expected); | ||
}); | ||
ava_1.default(`toPascalCase returns an empty sting if passed`, (t) => { | ||
(0, ava_1.default)(`toPascalCase returns an empty sting if passed`, (t) => { | ||
const expected = ''; | ||
const pascalCased = src_1.toPascalCase(''); | ||
const pascalCased = (0, src_1.toPascalCase)(''); | ||
t.is(pascalCased, expected); | ||
}); |
@@ -8,3 +8,4 @@ { | ||
], | ||
"timeout": "1m" | ||
"timeout": "1m", | ||
"workerThreads": false | ||
}, | ||
@@ -14,5 +15,5 @@ "dependencies": {}, | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"eslint": "^7.29.0", | ||
"eslint-plugin-import": "^2.25.2", | ||
"ava": "^4.0.1", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-markdown": "^2.2.1", | ||
@@ -22,3 +23,3 @@ "npm-run-all": "^4.1.5", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.3.5" | ||
"typescript": "^4.5.5" | ||
}, | ||
@@ -60,3 +61,3 @@ "files": [ | ||
}, | ||
"version": "1.0.10" | ||
"version": "1.0.11" | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
127903
61
1