{"name":"capitalize","version":"2.0.4","description":"capitalize the first letter of a string, or all words in a string","main":"index.js","dependencies":{},"devDependencies":{"tape":"~2.4.0","markdown-code-blocks":"0.0.1"},"scripts":{"test":"markdown-code-blocks -t javascript < README.md | sed \"s/require('capitalize')/require('.')/\" | node"},"repository":{"type":"git","url":"git://github.com/grncdr/js-capitalize.git"},"bugs":{"url":"git://github.com/grncdr/js-capitalize/issues"},"homepage":"https://github.com/grncdr/js-capitalize","keywords":["capitalize"],"author":{"name":"Stephen Sugden","email":"me@stephensugden.com"},"license":"MIT","gitHead":"4d8a1ac3a74ea51216c40e0bec15f90e1a0d8156","_id":"capitalize@2.0.4","_nodeVersion":"16.8.0","_npmVersion":"7.21.0","dist":{"integrity":"sha512-wcSyiFqXRYyCoqu0o0ekXzJAKCLMkqWS5QWGlgTJFJKwRmI6pzcN2hBl5VPq9RzLW5Uf4FF/V/lcFfjCtVak2w==","shasum":"eed7f94c6699a318eeef6e68967fe139c764b866","tarball":"http://registry-npm.ywwl.com/capitalize/download/capitalize-2.0.4.tgz","fileCount":6,"unpackedSize":8521,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2lgoCRA9TVsSAnZWagAAc3wQAJMCfayzCDAwgza8wMiw\nCuNVr4VKmF6Jnd5StjN8D5ipdSMa4PV/CvOce4I/Nv3ndjiBr/L0ZGYvbOrA\nlyu9D6u0VUW3RLitwMlpK1JDqnNFx32J3oapCdxqA+Vp+Tq0lJNIJ1VynjYo\n50qFdnPkf6Ph3Tx1mMe7ZOEANXvcRHc43uVMc4uEA2mCVw+opybEE0FPpbXl\nPD2dL+kjgPViCPCHy6VKGNOqW5iYlgLbj11xAKy792XA+FP7eodRTbVlQ1i8\nPJTQF7F0X1KGyJ0URa3aZXZHN7g9TpHUmLfs6gWiEv2kV3y+syJUjxcY+Oic\nN3M0JJQGECp8m3cgN3GKeQaDXT33/O5a/FwDzYt9X3xoHTZi+703FVF627Gf\npIS50ZrIBsjiLB0fAkZXR/fKZb6NXihpI0YSKfi8s60nLeBiLiPBpcPTnSxY\nRUzN0v1BtIDlLhnwlM7gqEvP6S/DOIk4uiQX7jEdw9Dh/tlBDr1PjXv4H157\n1k5u5AeCvG3YttTkIIELmtltS6xmgswc4sXTajVMRFkw2G4+rLiXPz7vbVuU\nmeMZ3v/1ajh2Zn3KMDEDVLezY0A+oKFk9S0BjGGo8uZYuCB6lLTXeMU0tmlI\n2EShLb/tLb2jgZ14BuJZbxwgMJbCYN9klrhIBF5KdfKoqTHsWOPUvIy3Ol5k\nTmwQ\r\n=JYOK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDp0ys6I/T3bNtRVTIhh631dEZGyZ7Hfc3NvFh9yDk6FgIhANyRggkrblRTDoiUpf2cyp45EJOq5l1FJzFyjq+shbR9"}],"size":3410,"noattachment":false,"key":"/capitalize/-/capitalize-2.0.4.tgz"},"_npmUser":{"name":"grncdr","email":"glurgle@gmail.com"},"directories":{},"maintainers":[{"name":"robkuz","email":"robert@robkuz.com"},{"name":"grncdr","email":"glurgle@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capitalize_2.0.4_1635090715099_0.03731276143158757"},"_hasShrinkwrap":false,"readme":"# capitalize ![Build](https://github.com/grncdr/js-capitalize/workflows/Node%20CI/badge.svg)\n\nCapitalize the first letter of a string, or all words in a string.\n\n## Synopsis\n\nCapitalize the first letter of a string:\n\n```javascript\nvar capitalize = require('capitalize')\n\nvar test = require('tape')\n\ntest('Capitalize first letter', function (t) {\n  t.plan(1)\n  t.equal(capitalize(\"united states\"), \"United states\")\n})\n```\n\nOr capitalize each word in a string:\n\n```javascript\ntest('Capitalize each word', function (t) {\n  t.plan(1)\n  t.equal(capitalize.words(\"united states\"), \"United States\")\n})\n```\n\nNo matter the original case:\n\n```javascript\ntest('Capitalize first letter with original string...', function (t) {\n  t.plan(2)\n\n  t.test('...in upper case', function (t1) {\n    t1.plan(1)\n    t1.equal(capitalize.words(\"UNITED STATES\"), \"United States\")\n  })\n\n  t.test('...in mixed case', function (t2) {\n    t2.plan(1)\n    t2.equal(capitalize.words(\"uNiTeD sTaTeS\"), \"United States\")\n  })\n\n})\n\ntest('Capitalize each word with original string...', function (t) {\n  t.plan(2)\n\n  t.test('...in upper case', function (t1) {\n    t1.plan(1)\n    t1.equal(capitalize.words(\"UNITED STATES\"), \"United States\")\n  })\n\n  t.test('...in mixed case', function (t2) {\n    t2.plan(1)\n    t2.equal(capitalize.words(\"uNiTeD sTaTeS\"), \"United States\")\n  })\n\n})\n```\n\nThanks to [@c990802](https://github.com/grncdr/js-capitalize/pull/2) and [Stack Overflow](http://stackoverflow.com/questions/20690499/concrete-javascript-regex-for-accented-characters-diacritics), capitalize handles international characters:\n\n```javascript\ntest('Capitalize words with international characters', function (t) {\n  t.plan(1)\n  t.equal(capitalize.words('hello-cañapolísas'), 'Hello-Cañapolísas')\n})\n```\n\nand thanks to [@6akcuk](https://github.com/grncdr/js-capitalize/pull/11) it can also capitalize cyrillic characters:\n\n```javascript\ntest('Capitalize words with cyrillic characters', function (t) {\n  t.plan(1)\n  t.equal(capitalize.words('привет мир'), \"Привет Мир\")\n})\n```\n\nand thanks to [@ultraflynn](https://github.com/grncdr/js-capitalize/pull/3) and [@DatGuyJonathon](https://github.com/grncdr/js-capitalize/issues/15) capitalize properly handles quotes within the string:\n\n```javascript\ntest('Capitalize each word, ignoring quotes', function(t) {\n    t.plan(1)\n    t.equal(capitalize.words(\"it's a nice day\"), \"It's A Nice Day\")\n})\n\ntest('Quotes test case 2', function(t) {\n    t.plan(1)\n    t.equal(capitalize.words(\"It’s a Boy\"), \"It’s A Boy\")\n})\n\ntest('Handles embedded quotes', function(t) {\n    t.plan(1)\n    t.equal(capitalize.words(\"'There's angels among us'\"), \"'There's Angels Among Us'\")\n})\n```\n\nand thanks to [@sergejkaravajnij](https://github.com/grncdr/js-capitalize/pull/9), capitalize also supports a second boolean parameter to preserve casing of the rest of the strings content:\n\n```javascript\ntest('Capitalize a string, preserving the original case of other letters', function (t) {\n  t.plan(1)\n  t.equal(capitalize('canDoItRight', true), 'CanDoItRight')\n})\n\ntest('Capitalize words, preserving the case', function (t) {\n  t.plan(1)\n  t.equal(capitalize.words('on gitHub', true), 'On GitHub')\n})\n```\n\nand thanks to [@rubengmurray](https://github.com/grncdr/js-capitalize/pull/13), capitalize now handles shorthand ordinal numbers as would be expected:\n\n```javascript\ntest('Capitalize words, handling shorthand ordinals (1st, 2nd, 3rd) correctly', function (t) {\n  t.plan(1)\n  t.equal(capitalize.words('1st place'), '1st Place')\n})\n```\n\nand thanks to a suggestion from [@Songyu-Wang](https://github.com/grncdr/js-capitalize/issues/16), capitalize supports skipping words that should never be capitalized (e.g.  articles and coordinating conjunctions in English).\n\n```javascript\ntest('Title-case words, by providing a skipWord regex', function (t) {\n  t.plan(1)\n  var opts = { skipWord: /^(a|the|an|and|or|but|in|on|of|it)$/ }\n  t.equal(\n    capitalize.words('the story of an unlikely feature and the way it was implemented', opts),\n    'The Story of an Unlikely Feature and the Way it Was Implemented'\n  )\n})\n\ntest('Title-case words, by providing a skipWord callback', function (t) {\n  t.plan(1)\n  t.equal(\n    capitalize.words('this is nice eh?', { skipWord: (word) => word.length < 3 }),\n    'This is Nice eh?'\n  )\n})\n```\n\n## Install\n\n    npm install capitalize\n\n## License\n\nMIT\n","publish_time":1635090715236,"_cnpm_publish_time":1635090715236,"dist-tags":{"latest":"2.0.4"}}