{"_id":"@cactuslab/nicetype","_rev":"2-fdeea90228a24c76c928a82b7e1fdb68","name":"@cactuslab/nicetype","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@cactuslab/nicetype","version":"1.0.0","description":"Transform plain ASCII punctuation into “smart” Unicode equivalents.","main":"dist/nicetype.js","module":"src/index.js","engines":{"node":"14.16.1","npm":"6.14.12","pnpm":">=6.3.0"},"scripts":{"test":"jest","lint":"pnpx eslint src/**","prepare":"pnpm run lint && pnpm test","build":"pnpx webpack --config _develop/webpack.config.prod.js --env NODE_ENV=prod","preversion":"npm run prepare","version":"npm run build && git add -A dist"},"browserslist":["defaults"],"keywords":["typography","curly quotes","dashes","hyphens"],"author":{"name":"Cactuslab"},"license":"Apache-2.0","devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-transform-runtime":"^7.14.3","@babel/preset-env":"^7.14.2","babel-jest":"^27.0.2","babel-loader":"^8.2.2","browserlist":"^1.0.1","eslint":"^7.27.0","eslint-config-airbnb":"^18.2.1","eslint-plugin-import":"^2.23.3","eslint-plugin-jest":"^24.3.6","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.23.2","eslint-plugin-react-hooks":"^4.2.0","jest":"^27.0.3","webpack":"^5.38.1","webpack-cli":"^4.7.0","webpack-merge":"^5.7.3"},"dependencies":{"@babel/runtime":"^7.14.0","core-js":"^3.13.0"},"directories":{"test":"tests"},"repository":{"type":"git","url":"git+https://github.com/cactuslab/nicetype.git"},"bugs":{"url":"https://github.com/cactuslab/nicetype/issues"},"homepage":"https://github.com/cactuslab/nicetype#readme","gitHead":"763bb3d7104ed41988e44098339d8bddc735b217","_id":"@cactuslab/nicetype@1.0.0","_nodeVersion":"14.16.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-7fAkhNQFDfdZEPt0Wh6jd6FcnW1s+gprlXYIpNJJMvoQHuAisCKb99kR0SM2hl8OJivlbu6srN+Wyaat+K4usQ==","shasum":"03b8658b1c02d61525b45cb017a2b47dd0fbca76","tarball":"https://registry.npmjs.org/@cactuslab/nicetype/-/nicetype-1.0.0.tgz","fileCount":4,"unpackedSize":43028,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg+hCXCRA9TVsSAnZWagAAqSQP/AsyZf1NO2Wm4oSlh4oI\nimAL6ypUbZ64rWqvVSr/qLmhhUc2eYErDK4GiRlmz/qK5fnOqzQ89G9H54xG\nUkrMjQGL3In33xPtycxq2YsarobIVarsgSzcKMDf4tZ+ZCyCGbolwephqt8E\n14JES+wNzOY5JrW8r2/iZehwVlecDwheepItrp5YgPe7HDArlqOAqANX/eqS\nEpAWoqNNmF61MR9p5xDc05g69Edg45XQhP7xi8rMefXZ+F756H3CCNnK0blK\nF7jGs0jlY6sjbIbbDPc1fV5lSxz8Zg8I+juhms4YgkPbe/ylPgFksAMOGYmq\nXM7KHd3UGCAkKq7rczbL1gT12H7rcvwf6LNwNvYLYLIuhl+qLUEOb8wEA/vN\no6tDKc+281A5bicGSJeYdHZffoKMCqpcUc1TuDljmviXuOz4nstxDQsCsn6M\nlx3ss/CRCGDPDsOE5niNQuaZZSA7J9wQABQsBc7FelOZQvlYtF2MTkfYsBWX\nITDu3CMDovpCFTE/qgiDLCTzQ8hTQnQu5SqKvwW7zd3Zp0TfpC6rY4SwzUx6\nllKR3t0pQr4rsBszevvV4zCXZBHL52EkVricLr7+T6qJGOKRecBC5Jk5Ccg1\nFONLWEprYv7/qzqaPSDdddavWNjSAkzYLd27hCvmP4WE0M/SlxxtOagU8OKt\npsCs\r\n=21rE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDqxD0Ap8dS/DvXdS510INpjztPHiB8KGlNwkiu2zyXswIhAKO8Uma3TlFAIOawI9AMP+Y0Cr5hoYRO4K8qaX6obApU"}]},"_npmUser":{"name":"hydnhntr","email":"hydnhntr+npmjs@gmail.com"},"maintainers":[{"name":"hydnhntr","email":"hydnhntr+npmjs@gmail.com"},{"name":"karlvr","email":"karl@xk72.com"},{"name":"tomcarey","email":"tom@cactuslab.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nicetype_1.0.0_1627000983048_0.5488992368366383"},"_hasShrinkwrap":false},"1.0.1":{"name":"@cactuslab/nicetype","version":"1.0.1","description":"Transform plain ASCII punctuation into “smart” Unicode equivalents.","main":"dist/nicetype.js","module":"src/index.js","engines":{"node":"14.16.1","npm":"6.14.12","pnpm":">=6.3.0"},"scripts":{"test":"jest","lint":"pnpx eslint src/**","prepare":"pnpm run lint && pnpm test","build":"pnpx webpack --config _develop/webpack.config.prod.js --env NODE_ENV=prod","preversion":"npm run prepare","version":"npm run build && git add -A dist"},"browserslist":["defaults"],"keywords":["typography","curly quotes","dashes","hyphens"],"author":{"name":"Cactuslab"},"license":"Apache-2.0","devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-transform-runtime":"^7.14.3","@babel/preset-env":"^7.14.2","babel-jest":"^27.0.2","babel-loader":"^8.2.2","browserlist":"^1.0.1","eslint":"^7.27.0","eslint-config-airbnb":"^18.2.1","eslint-plugin-import":"^2.23.3","eslint-plugin-jest":"^24.3.6","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.23.2","eslint-plugin-react-hooks":"^4.2.0","jest":"^27.0.3","webpack":"^5.38.1","webpack-cli":"^4.7.0","webpack-merge":"^5.7.3"},"dependencies":{"@babel/runtime":"^7.14.0","core-js":"^3.13.0"},"directories":{"test":"tests"},"repository":{"type":"git","url":"git+https://github.com/cactuslab/nicetype.git"},"bugs":{"url":"https://github.com/cactuslab/nicetype/issues"},"homepage":"https://github.com/cactuslab/nicetype#readme","gitHead":"1679a0bd571bb489f50099dc39505bb0665ef0b7","_id":"@cactuslab/nicetype@1.0.1","_nodeVersion":"14.16.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-0WpSfa1FlQq6Y6DJl4IsAeAOZ1LAYi2nhBsiYhTMqztar1cdK1rAVVHGzTD34hiSj4BTA5+3x72qjCasyBM5ng==","shasum":"76b6784d570258c6fcbe84c1433118eade1cb009","tarball":"https://registry.npmjs.org/@cactuslab/nicetype/-/nicetype-1.0.1.tgz","fileCount":11,"unpackedSize":60547,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg+hsaCRA9TVsSAnZWagAAqzUP/RyqNBImJAYdQdE1iXHN\n7H03dfSVJ2VwLOMFm+VEue922DUQRcK0xdC9mWk/+EN8tffUaJRzhv8IETDf\n6qmhm1GoxKVSCIMLuQVl2g2pXkg/62hMu2KX/8+8Q3zr9t3BgRH/Gp8IlTq4\n0IJ+hPvKyvaPTx0vfe4LrdEwFVlr6B5XtpHR0RKm/z54NH1pWyjKegZe73n1\nI8+coq4lo9MPZ20fFk4KoNlnDCc8DrjfN4JNe/G3ElM6oJwziSYh8+GGKKAS\nZ037Aoe+maTQgpYI5yBnZ1VY3C9u/oMbG5rodqX/6nVqRUHNm4qGQayxaqpm\n2Fbz3V7f/IGu7LOhoBYbV7B14Ehm2fs9AsmfuL9F8kx/Is4QfN8PI5jQaqhq\nAYpAnbpkwmuz/B80AmlFhlvLm7HlZujirUkIqPqX6s+g75mY6g4TduEbpRAK\nklPtUImyOQIDwpJRkKHRU8KCpnZUSqO1ZDmdPnwKhh/uNhNDCx8ulNyuAYXy\nLNUIvIT1tNiXOjArqb2P0JFPQHlWE9foONbHGc8ha8RC2gVIiYvXiZgNYK2L\n/Dj/En/xYajUZdtnWjLY2wLp7tJoFbLIw+ZcHMrjOJPLO+D6jITvc53Rybdj\no1Rzgd6jN3dGBvlNeoPrOAevR2VakSEcxznmfRo9AbqR8iv/cB783CaWPF/x\nIMCM\r\n=7sl+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEBBtr8NYRYFoNHL8U6CReShG2hcIG9hZZu+ndpkCWuwIgM5c6FJP/a0AEpah2MwNwuZg/pStiVPgt/Clgw3sqPlE="}]},"_npmUser":{"name":"hydnhntr","email":"hydnhntr+npmjs@gmail.com"},"maintainers":[{"name":"hydnhntr","email":"hydnhntr+npmjs@gmail.com"},{"name":"karlvr","email":"karl@xk72.com"},{"name":"tomcarey","email":"tom@cactuslab.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nicetype_1.0.1_1627003674410_0.10488480539517298"},"_hasShrinkwrap":false}},"time":{"created":"2021-07-23T00:43:03.005Z","1.0.0":"2021-07-23T00:43:03.224Z","modified":"2022-04-04T21:28:41.147Z","1.0.1":"2021-07-23T01:27:54.604Z"},"maintainers":[{"name":"hydnhntr","email":"hydnhntr+npmjs@gmail.com"},{"name":"karlvr","email":"karl@xk72.com"},{"name":"tomcarey","email":"tom@cactuslab.com"}],"description":"Transform plain ASCII punctuation into “smart” Unicode equivalents.","homepage":"https://github.com/cactuslab/nicetype#readme","keywords":["typography","curly quotes","dashes","hyphens"],"repository":{"type":"git","url":"git+https://github.com/cactuslab/nicetype.git"},"author":{"name":"Cactuslab"},"bugs":{"url":"https://github.com/cactuslab/nicetype/issues"},"license":"Apache-2.0","readme":"# Nicetype\n\nTouch up copy by converting plain ASCII punctuation into “smart” Unicode equivalents. Transformations include:\n\n* Straight to curly quotes.\n* Hyphen-dashes to em and endashes\n* Two, three or more dots to horizontal ellipsis\n\n> Please note these transforms are intended for English locales.\n\n---\n\nNicetype is an ES6 port of the abandoned [jsPrettify](http://code.google.com/archive/p/jsprettify) library.\n\nWhile jsPrettify’s rules aren’t the most thorough—this is also its strength as it reduces false positives and possible conflicts with the original input’s style.\n\n## Installation\n\n```shell\npnpm add @cactuslab/nicetype\nnpm install --save @cactuslab/nicetype\n```\n\n## Usage\n\n```js\nimport nicetype from 'nicetype'\n\nconst exampleString = 'Fish \\'n\\' Chips';\nconsole.log(nicetype.formatString(exampleString)); // 'Fish ’n’ Chips'\n\nconst exampleElement = document.createElement('div');\nexampleElement.innerText = exampleString;\nnicetype.formatElement(exampleElement, {\n  // exclusionAttribute: String,\n  // tagNameExclusions: []\n}); // HTMLElement or Node of type: TEXT_NODE\n```\n\n## API\n\n### nicetype.formatString(string)\n\nReturns transformed string\n\n#### Parameters\n\n* **string**: `String` to transform\n\n### nicetype.formatElement(element, options)\n\nApplies transformations to an element and its childrens’ [text nodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType). If an element has the `exclusionAttribute` or is of a [tagName](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName) listed in `tagNameExclusions`—that branch’s replacement will stop.\n\n#### Parameters\n\n* **element**: An `HTMLElement`\n* **options**: Optional `Object` for customising defaults\n\n  ```js\n  {\n    exclusionAttribute: 'data-nicetype-disable',\n    tagNameExclusions: ['base', 'command', 'link', 'meta', 'noscript', 'script', 'style', 'title', 'audio', 'br', 'code', 'command', 'datalist', 'embed', 'hr', 'iframe', 'img', 'input', 'kbd', 'keygen', 'map', 'math', 'meter', 'object', 'output', 'picture', 'progress', 'ruby', 'samp', 'script', 'select', 'svg', 'template', 'textarea', 'video', 'wbr', 'area', 'audio', 'canvas', 'embed', 'iframe', 'img', 'math', 'object', 'picture', 'svg', 'video', 'input', 'keygen', 'label', 'meter', 'object', 'output', 'progress', 'select', 'textarea', 'script', 'template']\n  }\n  ```\n\n### Roadmap\n\n* Non-breaking space: Short words/widow prevention\n* Expose advanced/opinionated dash options…, or remove entirely?\n* TypeScript\n\n### Development/Builds\n\n```shell\nnvm use\npnpm install\n```\n\n### See Also\n\n* [string-apostrophes](https://www.npmjs.com/package/string-apostrophes) ([comparison](https://codsen.com/os/string-apostrophes/#compared-to-others))\n* [textr](https://www.npmjs.com/package/textr)\n* [Richtypo (node.js)](https://github.com/sapegin/richtypo.js)\n* [Typopo](https://github.com/surfinzap/typopo)\n","readmeFilename":"README.md"}