first commit
This commit is contained in:
1
node_modules/title-case/dist/index.d.ts
generated
vendored
Normal file
1
node_modules/title-case/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function titleCase(input: string): string;
|
||||
34
node_modules/title-case/dist/index.js
generated
vendored
Normal file
34
node_modules/title-case/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.titleCase = void 0;
|
||||
var SMALL_WORDS = /\b(?:an?d?|a[st]|because|but|by|en|for|i[fn]|neither|nor|o[fnr]|only|over|per|so|some|tha[tn]|the|to|up|upon|vs?\.?|versus|via|when|with|without|yet)\b/i;
|
||||
var TOKENS = /[^\s:–—-]+|./g;
|
||||
var WHITESPACE = /\s/;
|
||||
var IS_MANUAL_CASE = /.(?=[A-Z]|\..)/;
|
||||
var ALPHANUMERIC_PATTERN = /[A-Za-z0-9\u00C0-\u00FF]/;
|
||||
function titleCase(input) {
|
||||
var result = "";
|
||||
var m;
|
||||
// tslint:disable-next-line
|
||||
while ((m = TOKENS.exec(input)) !== null) {
|
||||
var token = m[0], index = m.index;
|
||||
if (
|
||||
// Ignore already capitalized words.
|
||||
!IS_MANUAL_CASE.test(token) &&
|
||||
// Ignore small words except at beginning or end.
|
||||
(!SMALL_WORDS.test(token) ||
|
||||
index === 0 ||
|
||||
index + token.length === input.length) &&
|
||||
// Ignore URLs.
|
||||
(input.charAt(index + token.length) !== ":" ||
|
||||
WHITESPACE.test(input.charAt(index + token.length + 1)))) {
|
||||
// Find and uppercase first word character, skips over *modifiers*.
|
||||
result += token.replace(ALPHANUMERIC_PATTERN, function (m) { return m.toUpperCase(); });
|
||||
continue;
|
||||
}
|
||||
result += token;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.titleCase = titleCase;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/title-case/dist/index.js.map
generated
vendored
Normal file
1
node_modules/title-case/dist/index.js.map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CAAC;AA5BD,8BA4BC","sourcesContent":["const SMALL_WORDS = /\\b(?:an?d?|a[st]|because|but|by|en|for|i[fn]|neither|nor|o[fnr]|only|over|per|so|some|tha[tn]|the|to|up|upon|vs?\\.?|versus|via|when|with|without|yet)\\b/i;\nconst TOKENS = /[^\\s:–—-]+|./g;\nconst WHITESPACE = /\\s/;\nconst IS_MANUAL_CASE = /.(?=[A-Z]|\\..)/;\nconst ALPHANUMERIC_PATTERN = /[A-Za-z0-9\\u00C0-\\u00FF]/;\n\nexport function titleCase(input: string) {\n let result = \"\";\n let m: RegExpExecArray | null;\n\n // tslint:disable-next-line\n while ((m = TOKENS.exec(input)) !== null) {\n const { 0: token, index } = m;\n\n if (\n // Ignore already capitalized words.\n !IS_MANUAL_CASE.test(token) &&\n // Ignore small words except at beginning or end.\n (!SMALL_WORDS.test(token) ||\n index === 0 ||\n index + token.length === input.length) &&\n // Ignore URLs.\n (input.charAt(index + token.length) !== \":\" ||\n WHITESPACE.test(input.charAt(index + token.length + 1)))\n ) {\n // Find and uppercase first word character, skips over *modifiers*.\n result += token.replace(ALPHANUMERIC_PATTERN, (m) => m.toUpperCase());\n continue;\n }\n\n result += token;\n }\n\n return result;\n}\n"]}
|
||||
1
node_modules/title-case/dist/index.spec.d.ts
generated
vendored
Normal file
1
node_modules/title-case/dist/index.spec.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
75
node_modules/title-case/dist/index.spec.js
generated
vendored
Normal file
75
node_modules/title-case/dist/index.spec.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util_1 = require("util");
|
||||
var _1 = require(".");
|
||||
/**
|
||||
* Based on https://github.com/gouch/to-title-case/blob/master/test/tests.json.
|
||||
*/
|
||||
var TEST_CASES = [
|
||||
["", ""],
|
||||
["2019", "2019"],
|
||||
["test", "Test"],
|
||||
["two words", "Two Words"],
|
||||
["one. two.", "One. Two."],
|
||||
["a small word starts", "A Small Word Starts"],
|
||||
["small word ends on", "Small Word Ends On"],
|
||||
["we keep NASA capitalized", "We Keep NASA Capitalized"],
|
||||
["pass camelCase through", "Pass camelCase Through"],
|
||||
["follow step-by-step instructions", "Follow Step-by-Step Instructions"],
|
||||
["your hair[cut] looks (nice)", "Your Hair[cut] Looks (Nice)"],
|
||||
["leave Q&A unscathed", "Leave Q&A Unscathed"],
|
||||
[
|
||||
"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"],
|
||||
["start title — end title", "Start Title — End Title"],
|
||||
["start title—end title", "Start Title—End Title"],
|
||||
["start title - end title", "Start Title - End Title"],
|
||||
["don't break", "Don't Break"],
|
||||
['"double quotes"', '"Double Quotes"'],
|
||||
['double quotes "inner" word', 'Double Quotes "Inner" Word'],
|
||||
["fancy double quotes “inner” word", "Fancy Double Quotes “Inner” Word"],
|
||||
["have you read “The Lottery”?", "Have You Read “The Lottery”?"],
|
||||
["one: two", "One: Two"],
|
||||
["one two: three four", "One Two: Three Four"],
|
||||
['one two: "Three Four"', 'One Two: "Three Four"'],
|
||||
["email email@example.com address", "Email email@example.com Address"],
|
||||
[
|
||||
"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*"],
|
||||
["this vs. that", "This vs. That"],
|
||||
["this vs that", "This vs That"],
|
||||
["this v. that", "This v. That"],
|
||||
["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",
|
||||
],
|
||||
[
|
||||
"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",
|
||||
],
|
||||
["newcastle upon tyne", "Newcastle upon Tyne"],
|
||||
["newcastle *upon* tyne", "Newcastle *upon* Tyne"],
|
||||
];
|
||||
describe("swap case", function () {
|
||||
var _loop_1 = function (input, result) {
|
||||
it(util_1.inspect(input) + " -> " + util_1.inspect(result), function () {
|
||||
expect(_1.titleCase(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);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=index.spec.js.map
|
||||
1
node_modules/title-case/dist/index.spec.js.map
generated
vendored
Normal file
1
node_modules/title-case/dist/index.spec.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":";;AAAA,6BAA+B;AAC/B,sBAA8B;AAE9B;;GAEG;AACH,IAAM,UAAU,GAAuB;IACrC,CAAC,EAAE,EAAE,EAAE,CAAC;IACR,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,WAAW,EAAE,WAAW,CAAC;IAC1B,CAAC,WAAW,EAAE,WAAW,CAAC;IAC1B,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAC9C,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAC5C,CAAC,0BAA0B,EAAE,0BAA0B,CAAC;IACxD,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IACpD,CAAC,kCAAkC,EAAE,kCAAkC,CAAC;IACxE,CAAC,6BAA6B,EAAE,6BAA6B,CAAC;IAC9D,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAC9C;QACE,uCAAuC;QACv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KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;;IAHL,KAA8B,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU;QAA7B,IAAA,qBAAe,EAAd,KAAK,QAAA,EAAE,MAAM,QAAA;gBAAb,KAAK,EAAE,MAAM;KAIxB;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { inspect } from \"util\";\nimport { titleCase } from \".\";\n\n/**\n * Based on https://github.com/gouch/to-title-case/blob/master/test/tests.json.\n */\nconst TEST_CASES: [string, string][] = [\n [\"\", \"\"],\n [\"2019\", \"2019\"],\n [\"test\", \"Test\"],\n [\"two words\", \"Two Words\"],\n [\"one. two.\", \"One. Two.\"],\n [\"a small word starts\", \"A Small Word Starts\"],\n [\"small word ends on\", \"Small Word Ends On\"],\n [\"we keep NASA capitalized\", \"We Keep NASA Capitalized\"],\n [\"pass camelCase through\", \"Pass camelCase Through\"],\n [\"follow step-by-step instructions\", \"Follow Step-by-Step Instructions\"],\n [\"your hair[cut] looks (nice)\", \"Your Hair[cut] Looks (Nice)\"],\n [\"leave Q&A unscathed\", \"Leave Q&A Unscathed\"],\n [\n \"piña colada while you listen to ænima\",\n \"Piña Colada While You Listen to Ænima\",\n ],\n [\"start title – end title\", \"Start Title – End Title\"],\n [\"start title–end title\", \"Start Title–End Title\"],\n [\"start title — end title\", \"Start Title — End Title\"],\n [\"start title—end title\", \"Start Title—End Title\"],\n [\"start title - end title\", \"Start Title - End Title\"],\n [\"don't break\", \"Don't Break\"],\n ['\"double quotes\"', '\"Double Quotes\"'],\n ['double quotes \"inner\" word', 'Double Quotes \"Inner\" Word'],\n [\"fancy double quotes “inner” word\", \"Fancy Double Quotes “Inner” Word\"],\n [\"have you read “The Lottery”?\", \"Have You Read “The Lottery”?\"],\n [\"one: two\", \"One: Two\"],\n [\"one two: three four\", \"One Two: Three Four\"],\n ['one two: \"Three Four\"', 'One Two: \"Three Four\"'],\n [\"email email@example.com address\", \"Email email@example.com Address\"],\n [\n \"you have an https://example.com/ title\",\n \"You Have an https://example.com/ Title\",\n ],\n [\"_underscores around words_\", \"_Underscores Around Words_\"],\n [\"*asterisks around words*\", \"*Asterisks Around Words*\"],\n [\"this vs. that\", \"This vs. That\"],\n [\"this vs that\", \"This vs That\"],\n [\"this v. that\", \"This v. That\"],\n [\"this v that\", \"This v That\"],\n [\n \"Scott Moritz and TheStreet.com’s million iPhone la-la land\",\n \"Scott Moritz and TheStreet.com’s Million iPhone La-La Land\",\n ],\n [\n \"Notes and observations regarding Apple’s announcements from ‘The Beat Goes On’ special event\",\n \"Notes and Observations Regarding Apple’s Announcements From ‘The Beat Goes On’ Special Event\",\n ],\n [\n \"the quick brown fox jumps over the lazy dog\",\n \"The Quick Brown Fox Jumps over the Lazy Dog\",\n ],\n [\"newcastle upon tyne\", \"Newcastle upon Tyne\"],\n [\"newcastle *upon* tyne\", \"Newcastle *upon* Tyne\"],\n];\n\ndescribe(\"swap case\", () => {\n for (const [input, result] of TEST_CASES) {\n it(`${inspect(input)} -> ${inspect(result)}`, () => {\n expect(titleCase(input)).toEqual(result);\n });\n }\n});\n"]}
|
||||
Reference in New Issue
Block a user