lower-case
Advanced tools
Comparing version 2.0.0 to 2.0.1
/** | ||
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt | ||
*/ | ||
const SUPPORTED_LOCALE = { | ||
var SUPPORTED_LOCALE = { | ||
tr: { | ||
@@ -37,5 +37,5 @@ regexp: /\u0130|\u0049|\u0049\u0307/g, | ||
export function localeLowerCase(str, locale) { | ||
const lang = SUPPORTED_LOCALE[locale.toLowerCase()]; | ||
var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; | ||
if (lang) | ||
return lowerCase(str.replace(lang.regexp, m => lang.map[m])); | ||
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); | ||
return lowerCase(str); | ||
@@ -42,0 +42,0 @@ } |
import { lowerCase, localeLowerCase } from "."; | ||
const TEST_CASES = [ | ||
var TEST_CASES = [ | ||
["", ""], | ||
@@ -9,19 +9,27 @@ ["test", "test"], | ||
]; | ||
const LOCALE_TEST_CASES = [ | ||
var LOCALE_TEST_CASES = [ | ||
["STRING", "strıng", "tr"] | ||
]; | ||
describe("lower case", () => { | ||
for (const [input, result] of TEST_CASES) { | ||
it(`${input} -> ${result}`, () => { | ||
describe("lower case", function () { | ||
var _loop_1 = function (input, result) { | ||
it(input + " -> " + result, function () { | ||
expect(lowerCase(input)).toEqual(result); | ||
}); | ||
}; | ||
for (var _i = 0, TEST_CASES_1 = TEST_CASES; _i < TEST_CASES_1.length; _i++) { | ||
var _a = TEST_CASES_1[_i], input = _a[0], result = _a[1]; | ||
_loop_1(input, result); | ||
} | ||
}); | ||
describe("locale lower case", () => { | ||
for (const [input, result, locale] of LOCALE_TEST_CASES) { | ||
it(`${locale}: ${input} -> ${result}`, () => { | ||
describe("locale lower case", function () { | ||
var _loop_2 = function (input, result, locale) { | ||
it(locale + ": " + input + " -> " + result, function () { | ||
expect(localeLowerCase(input, locale)).toEqual(result); | ||
}); | ||
}; | ||
for (var _i = 0, LOCALE_TEST_CASES_1 = LOCALE_TEST_CASES; _i < LOCALE_TEST_CASES_1.length; _i++) { | ||
var _a = LOCALE_TEST_CASES_1[_i], input = _a[0], result = _a[1], locale = _a[2]; | ||
_loop_2(input, result, locale); | ||
} | ||
}); | ||
//# sourceMappingURL=index.spec.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
*/ | ||
const SUPPORTED_LOCALE = { | ||
var SUPPORTED_LOCALE = { | ||
tr: { | ||
@@ -40,5 +40,5 @@ regexp: /\u0130|\u0049|\u0049\u0307/g, | ||
function localeLowerCase(str, locale) { | ||
const lang = SUPPORTED_LOCALE[locale.toLowerCase()]; | ||
var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; | ||
if (lang) | ||
return lowerCase(str.replace(lang.regexp, m => lang.map[m])); | ||
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); | ||
return lowerCase(str); | ||
@@ -45,0 +45,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const _1 = require("."); | ||
const TEST_CASES = [ | ||
var _1 = require("."); | ||
var TEST_CASES = [ | ||
["", ""], | ||
@@ -11,19 +11,27 @@ ["test", "test"], | ||
]; | ||
const LOCALE_TEST_CASES = [ | ||
var LOCALE_TEST_CASES = [ | ||
["STRING", "strıng", "tr"] | ||
]; | ||
describe("lower case", () => { | ||
for (const [input, result] of TEST_CASES) { | ||
it(`${input} -> ${result}`, () => { | ||
describe("lower case", function () { | ||
var _loop_1 = function (input, result) { | ||
it(input + " -> " + result, function () { | ||
expect(_1.lowerCase(input)).toEqual(result); | ||
}); | ||
}; | ||
for (var _i = 0, TEST_CASES_1 = TEST_CASES; _i < TEST_CASES_1.length; _i++) { | ||
var _a = TEST_CASES_1[_i], input = _a[0], result = _a[1]; | ||
_loop_1(input, result); | ||
} | ||
}); | ||
describe("locale lower case", () => { | ||
for (const [input, result, locale] of LOCALE_TEST_CASES) { | ||
it(`${locale}: ${input} -> ${result}`, () => { | ||
describe("locale lower case", function () { | ||
var _loop_2 = function (input, result, locale) { | ||
it(locale + ": " + input + " -> " + result, function () { | ||
expect(_1.localeLowerCase(input, locale)).toEqual(result); | ||
}); | ||
}; | ||
for (var _i = 0, LOCALE_TEST_CASES_1 = LOCALE_TEST_CASES; _i < LOCALE_TEST_CASES_1.length; _i++) { | ||
var _a = LOCALE_TEST_CASES_1[_i], input = _a[0], result = _a[1], locale = _a[2]; | ||
_loop_2(input, result, locale); | ||
} | ||
}); | ||
//# sourceMappingURL=index.spec.js.map |
{ | ||
"name": "lower-case", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Transforms the string to lower case", | ||
@@ -19,3 +19,3 @@ "main": "dist/index.js", | ||
"specs": "jest --coverage", | ||
"test": "npm run build && npm run lint && npm run specs && npm run size", | ||
"test": "npm run build && npm run lint && npm run specs", | ||
"size": "size-limit", | ||
@@ -84,3 +84,6 @@ "prepare": "npm run build" | ||
}, | ||
"gitHead": "55911ca17c2e0c964b9b84143e14e29ffc9ff499" | ||
"dependencies": { | ||
"tslib": "^1.10.0" | ||
}, | ||
"gitHead": "07b68e1a696a1a34090d4f1fc136b1bd467aaa3f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
17517
184
0
1
+ Addedtslib@^1.10.0
+ Addedtslib@1.14.1(transitive)