Skip to content

Commit

Permalink
Update deps, format prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Dec 1, 2020
1 parent 7174e9d commit d278ab5
Show file tree
Hide file tree
Showing 38 changed files with 749 additions and 1,006 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -241,7 +241,7 @@ If you find the default split hard to use, you can provide a different one. The

```js
const options = {
splitRegexp: /([a-z])([A-Z0-9])/g
splitRegexp: /([a-z])([A-Z0-9])/g,
};
```

Expand Down
1,622 changes: 686 additions & 936 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions package.json
Expand Up @@ -5,7 +5,7 @@
"bootstrap": "lerna bootstrap",
"prettier": "prettier --write",
"build": "lerna run build",
"format": "npm run prettier -- \"{./,packages/**/}*.{js,jsx,ts,tsx,json,md,yml,yaml}\" --ignore-path .gitignore",
"format": "npm run prettier -- \"{,packages/**/}*.{js,jsx,ts,tsx,json,md,yml,yaml}\" --ignore-path .gitignore",
"test": "lerna run test",
"prepare": "npm run bootstrap"
},
Expand All @@ -15,15 +15,12 @@
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,md,yml,yaml}": [
"npm run prettier",
"git add"
]
"*.{js,jsx,ts,tsx,json,md,yml,yaml}": "npm run prettier"
},
"devDependencies": {
"husky": "^3.1.0",
"husky": "^4.3.0",
"lerna": "^3.19.0",
"lint-staged": "^9.5.0",
"prettier": "^1.19.1"
"lint-staged": "^10.5.2",
"prettier": "^2.2.1"
}
}
2 changes: 1 addition & 1 deletion packages/camel-case/src/index.spec.ts
Expand Up @@ -9,7 +9,7 @@ const TEST_CASES: [string, string, Options?][] = [
["_foo_bar_", "fooBar"],
["version 1.2.10", "version_1_2_10"],
["version 1.21.0", "version_1_21_0"],
["version 1.2.10", "version1210", { transform: camelCaseTransformMerge }]
["version 1.2.10", "version1210", { transform: camelCaseTransformMerge }],
];

describe("camel case", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/camel-case/src/index.ts
Expand Up @@ -2,7 +2,7 @@ import {
pascalCase,
pascalCaseTransform,
pascalCaseTransformMerge,
Options
Options,
} from "pascal-case";

export { Options };
Expand All @@ -20,6 +20,6 @@ export function camelCaseTransformMerge(input: string, index: number) {
export function camelCase(input: string, options: Options = {}) {
return pascalCase(input, {
transform: camelCaseTransform,
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/capital-case/src/index.spec.ts
Expand Up @@ -7,7 +7,7 @@ const TEST_CASES: [string, string][] = [
["Test String", "Test String"],
["TestV2", "Test V2"],
["version 1.2.10", "Version 1 2 10"],
["version 1.21.0", "Version 1 21 0"]
["version 1.21.0", "Version 1 21 0"],
];

describe("capital case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/capital-case/src/index.ts
Expand Up @@ -11,6 +11,6 @@ export function capitalCase(input: string, options: Options = {}) {
return noCase(input, {
delimiter: " ",
transform: capitalCaseTransform,
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/change-case/README.md
Expand Up @@ -26,7 +26,7 @@ import {
pascalCase,
pathCase,
sentenceCase,
snakeCase
snakeCase,
} from "change-case";
```

Expand Down
2 changes: 1 addition & 1 deletion packages/constant-case/src/index.spec.ts
Expand Up @@ -9,7 +9,7 @@ const TEST_CASES: [string, string][] = [
["path/case", "PATH_CASE"],
["TestV2", "TEST_V2"],
["version 1.2.10", "VERSION_1_2_10"],
["version 1.21.0", "VERSION_1_21_0"]
["version 1.21.0", "VERSION_1_21_0"],
];

describe("constant case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/constant-case/src/index.ts
Expand Up @@ -7,6 +7,6 @@ export function constantCase(input: string, options: Options = {}) {
return noCase(input, {
delimiter: "_",
transform: upperCase,
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/dot-case/src/index.spec.ts
Expand Up @@ -9,7 +9,7 @@ const TEST_CASES: [string, string][] = [
["path/case", "path.case"],
["TestV2", "test.v2"],
["version 1.2.10", "version.1.2.10"],
["version 1.21.0", "version.1.21.0"]
["version 1.21.0", "version.1.21.0"],
];

describe("dot case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/dot-case/src/index.ts
Expand Up @@ -5,6 +5,6 @@ export { Options };
export function dotCase(input: string, options: Options = {}) {
return noCase(input, {
delimiter: ".",
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/header-case/src/index.spec.ts
Expand Up @@ -7,7 +7,7 @@ const TEST_CASES: [string, string][] = [
["Test String", "Test-String"],
["TestV2", "Test-V2"],
["version 1.2.10", "Version-1-2-10"],
["version 1.21.0", "Version-1-21-0"]
["version 1.21.0", "Version-1-21-0"],
];

describe("header case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/header-case/src/index.ts
Expand Up @@ -5,6 +5,6 @@ export { Options };
export function headerCase(input: string, options: Options = {}) {
return capitalCase(input, {
delimiter: "-",
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/is-lower-case/src/index.spec.ts
Expand Up @@ -6,7 +6,7 @@ const TEST_CASES: [string, boolean][] = [
["TEST", false],
["Test", false],
["123", false],
["snake_case", true]
["snake_case", true],
];

describe("is lower case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/is-upper-case/src/index.spec.ts
Expand Up @@ -6,7 +6,7 @@ const TEST_CASES: [string, boolean][] = [
["TEST", true],
["Test", false],
["123", false],
["CONSTANT_CASE", true]
["CONSTANT_CASE", true],
];

describe("is upper case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/lower-case-first/src/index.spec.ts
Expand Up @@ -3,7 +3,7 @@ import { lowerCaseFirst } from ".";
const TEST_CASES: [string, string][] = [
["", ""],
["test", "test"],
["TEST", "tEST"]
["TEST", "tEST"],
];

describe("lower case first", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/lower-case/src/index.spec.ts
Expand Up @@ -5,11 +5,11 @@ const TEST_CASES: [string, string][] = [
["test", "test"],
["TEST", "test"],
["test string", "test string"],
["TEST STRING", "test string"]
["TEST STRING", "test string"],
];

const LOCALE_TEST_CASES: [string, string, string][] = [
["STRING", "strıng", "tr"]
["STRING", "strıng", "tr"],
];

describe("lower case", () => {
Expand Down
16 changes: 8 additions & 8 deletions packages/lower-case/src/index.ts
Expand Up @@ -15,16 +15,16 @@ const SUPPORTED_LOCALE: Record<string, Locale> = {
map: {
İ: "\u0069",
I: "\u0131",
: "\u0069"
}
: "\u0069",
},
},
az: {
regexp: /\u0130/g,
map: {
İ: "\u0069",
I: "\u0131",
: "\u0069"
}
: "\u0069",
},
},
lt: {
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
Expand All @@ -34,17 +34,17 @@ const SUPPORTED_LOCALE: Record<string, Locale> = {
Į: "\u012F\u0307",
Ì: "\u0069\u0307\u0300",
Í: "\u0069\u0307\u0301",
Ĩ: "\u0069\u0307\u0303"
}
}
Ĩ: "\u0069\u0307\u0303",
},
},
};

/**
* Localized lower case.
*/
export function localeLowerCase(str: string, locale: string) {
const lang = SUPPORTED_LOCALE[locale.toLowerCase()];
if (lang) return lowerCase(str.replace(lang.regexp, m => lang.map[m]));
if (lang) return lowerCase(str.replace(lang.regexp, (m) => lang.map[m]));
return lowerCase(str);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/no-case/src/index.spec.ts
Expand Up @@ -52,7 +52,7 @@ const TEST_CASES: [string, string, Options?][] = [

// Customization.
["camel2019", "camel 2019", { splitRegexp: /([a-z])([A-Z0-9])/g }],
["minifyURLs", "minify urls", { splitRegexp: /([a-z])([A-Z0-9])/g }]
["minifyURLs", "minify urls", { splitRegexp: /([a-z])([A-Z0-9])/g }],
];

describe("no case", () => {
Expand Down
8 changes: 2 additions & 6 deletions packages/no-case/src/index.ts
Expand Up @@ -21,7 +21,7 @@ export function noCase(input: string, options: Options = {}) {
splitRegexp = DEFAULT_SPLIT_REGEXP,
stripRegexp = DEFAULT_STRIP_REGEXP,
transform = lowerCase,
delimiter = " "
delimiter = " ",
} = options;

let result = replace(
Expand All @@ -37,11 +37,7 @@ export function noCase(input: string, options: Options = {}) {
while (result.charAt(end - 1) === "\0") end--;

// Transform each token independently.
return result
.slice(start, end)
.split("\0")
.map(transform)
.join(delimiter);
return result.slice(start, end).split("\0").map(transform).join(delimiter);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/param-case/src/index.spec.ts
Expand Up @@ -7,7 +7,7 @@ const TEST_CASES: [string, string][] = [
["Test String", "test-string"],
["TestV2", "test-v2"],
["version 1.2.10", "version-1-2-10"],
["version 1.21.0", "version-1-21-0"]
["version 1.21.0", "version-1-21-0"],
];

describe("param case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/param-case/src/index.ts
Expand Up @@ -5,6 +5,6 @@ export { Options };
export function paramCase(input: string, options: Options = {}) {
return dotCase(input, {
delimiter: "-",
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/pascal-case/src/index.spec.ts
Expand Up @@ -8,7 +8,7 @@ const TEST_CASES: [string, string, Options?][] = [
["TestV2", "TestV2"],
["version 1.2.10", "Version_1_2_10"],
["version 1.21.0", "Version_1_21_0"],
["version 1.21.0", "Version1210", { transform: pascalCaseTransformMerge }]
["version 1.21.0", "Version1210", { transform: pascalCaseTransformMerge }],
];

describe("pascal case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/pascal-case/src/index.ts
Expand Up @@ -19,6 +19,6 @@ export function pascalCase(input: string, options: Options = {}) {
return noCase(input, {
delimiter: "",
transform: pascalCaseTransform,
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/path-case/src/index.spec.ts
Expand Up @@ -7,7 +7,7 @@ const TEST_CASES: [string, string][] = [
["Test String", "test/string"],
["TestV2", "test/v2"],
["version 1.2.10", "version/1/2/10"],
["version 1.21.0", "version/1/21/0"]
["version 1.21.0", "version/1/21/0"],
];

describe("path case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/path-case/src/index.ts
Expand Up @@ -5,6 +5,6 @@ export { Options };
export function pathCase(input: string, options: Options = {}) {
return dotCase(input, {
delimiter: "/",
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/sentence-case/src/index.spec.ts
Expand Up @@ -7,7 +7,7 @@ const TEST_CASES: [string, string][] = [
["Test String", "Test string"],
["TestV2", "Test v2"],
["version 1.2.10", "Version 1 2 10"],
["version 1.21.0", "Version 1 21 0"]
["version 1.21.0", "Version 1 21 0"],
];

describe("sentence case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/sentence-case/src/index.ts
Expand Up @@ -13,6 +13,6 @@ export function sentenceCase(input: string, options: Options = {}) {
return noCase(input, {
delimiter: " ",
transform: sentenceCaseTransform,
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/snake-case/src/index.spec.ts
Expand Up @@ -8,7 +8,7 @@ const TEST_CASES: [string, string][] = [
["Test String", "test_string"],
["TestV2", "test_v2"],
["version 1.2.10", "version_1_2_10"],
["version 1.21.0", "version_1_21_0"]
["version 1.21.0", "version_1_21_0"],
];

describe("snake case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/snake-case/src/index.ts
Expand Up @@ -5,6 +5,6 @@ export { Options };
export function snakeCase(input: string, options: Options = {}) {
return dotCase(input, {
delimiter: "_",
...options
...options,
});
}
2 changes: 1 addition & 1 deletion packages/sponge-case/src/index.spec.ts
Expand Up @@ -8,7 +8,7 @@ const TEST_CASES: [string, number][] = [
["test string", 11],
["Test String", 11],
["TestV2", 6],
["rAnDoM cAsE", 11]
["rAnDoM cAsE", 11],
];

describe("random case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/swap-case/src/index.spec.ts
Expand Up @@ -6,7 +6,7 @@ const TEST_CASES: [string, string][] = [
["test string", "TEST STRING"],
["Test String", "tEST sTRING"],
["TestV2", "tESTv2"],
["sWaP cAsE", "SwAp CaSe"]
["sWaP cAsE", "SwAp CaSe"],
];

describe("swap case", () => {
Expand Down
12 changes: 6 additions & 6 deletions packages/title-case/src/index.spec.ts
Expand Up @@ -19,7 +19,7 @@ const TEST_CASES: [string, string][] = [
["leave Q&A unscathed", "Leave Q&A Unscathed"],
[
"piña colada while you listen to ænima",
"Piña Colada While You Listen to Ænima"
"Piña Colada While You Listen to Ænima",
],
["start title – end title", "Start Title – End Title"],
["start title–end title", "Start Title–End Title"],
Expand All @@ -37,7 +37,7 @@ const TEST_CASES: [string, string][] = [
["email email@example.com address", "Email email@example.com Address"],
[
"you have an https://example.com/ title",
"You Have an https://example.com/ Title"
"You Have an https://example.com/ Title",
],
["_underscores around words_", "_Underscores Around Words_"],
["*asterisks around words*", "*Asterisks Around Words*"],
Expand All @@ -47,18 +47,18 @@ const TEST_CASES: [string, string][] = [
["this v that", "This v That"],
[
"Scott Moritz and TheStreet.com’s million iPhone la-la land",
"Scott Moritz and TheStreet.com’s Million iPhone La-La Land"
"Scott Moritz and TheStreet.com’s Million iPhone La-La Land",
],
[
"Notes and observations regarding Apple’s announcements from ‘The Beat Goes On’ special event",
"Notes and Observations Regarding Apple’s Announcements From ‘The Beat Goes On’ Special Event"
"Notes and Observations Regarding Apple’s Announcements From ‘The Beat Goes On’ Special Event",
],
[
"the quick brown fox jumps over the lazy dog",
"The Quick Brown Fox Jumps over the Lazy Dog"
"The Quick Brown Fox Jumps over the Lazy Dog",
],
["newcastle upon tyne", "Newcastle upon Tyne"],
["newcastle *upon* tyne", "Newcastle *upon* Tyne"]
["newcastle *upon* tyne", "Newcastle *upon* Tyne"],
];

describe("swap case", () => {
Expand Down

0 comments on commit d278ab5

Please sign in to comment.