{"_id":"@ambassify/twitter-text","_rev":"5-fb4610af8e73b33a41300a3e38d4930e","name":"@ambassify/twitter-text","dist-tags":{"latest":"4.0.0"},"versions":{"3.1.0":{"name":"@ambassify/twitter-text","version":"3.1.0","author":{"name":"Twitter Inc."},"_id":"@ambassify/twitter-text@3.1.0","maintainers":[{"name":"ambassify","email":"dev@ambassify.com"}],"homepage":"https://github.com/ambassify/twitter-text","bugs":{"url":"https://github.com/ambassify/twitter-text/issues"},"dist":{"shasum":"0c6454eac3f35fb1a89281ee7f6db86d530d1db5","tarball":"https://registry.npmjs.org/@ambassify/twitter-text/-/twitter-text-3.1.0.tgz","fileCount":269,"integrity":"sha512-EMXIDXsj0uTxCUQpYMEev3dp2v79mjNlYDMc3xoClhslRNMRwM14FOcfiIrtlFcfzlZaWjc8xNfc0SMWU0ciYQ==","signatures":[{"sig":"MEQCICnw/2/CcMEPX1lCMD+PJl1j72vMdDQ3UR0X1ToPacblAiAPJ9pWkgLYMJwuxER05VNinQJKG80T1hrzp9hQGrZlxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":316442,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzFNJCRA9TVsSAnZWagAA590QAIHM8BDw4rcSPUarBF1I\nN3OxvTkOn9I2ERaCJHGdFvo9ovnmvII3z4ztQOP0eelVh4CGB+H0bdrj8Unm\ngkK+hWo8pHu2S1Xy8CgidEVp/tAsOl9X8CbLrVcg0Khx/e9RkvfmHtxRwI3p\nvdHiftBKwfP4VblMT6N+MjxnX6eBE616F/BnCCerm9tBUkVm2kR8oEgyRC2L\nV30vz3LRv5ssVzaHwS2iQ/7GM3w0mI4nMEtNgrcbvkhsvzem9RfNLKcldHgk\nWatvWofJS7/Cbd915QPitnORGpBNVO8zYoD0yCnnwX7LX+P7YhYbqDIL5miL\nBN98a6Ope47f8TqyuzFiKBtINXQkFZ212MaBasYz89apq7wEIqph5YGKqmA6\nnxPAgM+RamDoi7dvze2ndvwDPQCsxIxkaxdl/yA3AeRynKiquhBSyL2KEpFa\neKQIyZPb2tkaq9kXPs606ZrO9LAJkcnCNAcUIoQbNM7tf/+ZTO/8Y9EkgEuV\nd8kFfFpimWtiWaEP6K+UBZ2MquIQ5ArA6ouX3mxYFx2yu4thTjqEIuFQ2ap4\n3GeepqAcn0FVEXy5RXN9cvtbeOIj8BDCnDAbuxLRVfXYr6Q7VCekH0dcYLAu\nJm7i0oJPC8yRccprKKegasb9K1tjWwThznCgBEgXbL/rk5DgyaDy75JusbSo\n0iQi\r\n=R4/p\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","module":"dist/esm","gitHead":"e68dbf41567e791402abb4ea751736347fd86ce0","scripts":{"lint":"npm run lint:check -- --fix","test":"npm run build:prepare && npm run build && rake test && rake test:conformance","build":"rimraf dist && rollup -c","build:prod":"npm run lint:check && rimraf dist && NODE_ENV=production babel src --out-dir dist/esm && NODE_ENV=production BABEL_ENV=commonjs babel src --out-dir dist","lint:check":"eslint src rollup.config.js scripts","build:watch":"npm run build -- -w","build:config":"node scripts/buildConfig.js","build:prepare":"npm run build:config && rake test:conformance:prepare","prepublishOnly":"npm run build:prod"},"_npmUser":{"name":"ambassify","email":"dev@ambassify.com"},"repository":{"url":"git+https://github.com/ambassify/twitter-text.git","type":"git"},"_npmVersion":"7.22.0","description":"Ambassify's for of the official twitter text linkification library","directories":{},"_nodeVersion":"16.5.0","dependencies":{"punycode":"1.4.1","core-js-pure":"^3.19.0","@babel/runtime":"^7.3.1","twemoji-parser":"^11.0.2"},"_hasShrinkwrap":false,"devDependencies":{"grunt":"^0.4.5","eslint":"^4.18.1","rimraf":"^2.6.2","rollup":"^1.4.1","qunitjs":"^1.23.1","fs-extra":"^4.0.2","optimist":"^0.6.1","prettier":"^1.10.2","uglify-js":"~2.4.3","@babel/cli":"^7.4.0","@babel/core":"^7.4.0","babel-eslint":"^10.0.1","@babel/preset-env":"^7.4.0","rollup-plugin-json":"^3.1.0","grunt-contrib-qunit":"~2.0.0","rollup-plugin-babel":"^4.3.2","rollup-plugin-license":"^0.8.1","eslint-config-prettier":"^2.9.0","eslint-plugin-prettier":"^2.6.0","rollup-plugin-commonjs":"^8.2.6","rollup-plugin-node-resolve":"^4.0.1","babel-plugin-polyfill-corejs3":"^0.3.0","@babel/plugin-transform-spread":"^7.2.2","@babel/plugin-transform-runtime":"^7.4.0","babel-plugin-add-module-exports":"^1.0.2","@babel/plugin-syntax-dynamic-import":"^7.7.4","@babel/plugin-proposal-class-properties":"^7.4.0","@babel/plugin-transform-flow-strip-types":"^7.3.4","@babel/plugin-proposal-export-default-from":"^7.7.4","@babel/plugin-proposal-export-namespace-from":"^7.7.4"},"_npmOperationalInternal":{"tmp":"tmp/twitter-text_3.1.0_1636015446766_0.41872313477349987","host":"s3://npm-registry-packages"}},"4.0.0":{"name":"@ambassify/twitter-text","version":"4.0.0","author":{"name":"Twitter Inc."},"_id":"@ambassify/twitter-text@4.0.0","maintainers":[{"name":"ambassify","email":"dev@ambassify.com"}],"homepage":"https://github.com/ambassify/twitter-text","bugs":{"url":"https://github.com/ambassify/twitter-text/issues"},"dist":{"shasum":"ee3b4132049c0364e8431440fd68c4e9adca8550","tarball":"https://registry.npmjs.org/@ambassify/twitter-text/-/twitter-text-4.0.0.tgz","fileCount":269,"integrity":"sha512-x3SJCQjp6yUAIL7GaZWVZrhVLWe3tmGKCNYvi66KzB4bQIAfLSZh36mH7gg/0vEudzdt+egh1wBQK97X783PIw==","signatures":[{"sig":"MEYCIQCxme5bIEJZs1lMt0iEKgnY78UdGhd4hu1ockJ1CNtc9wIhAL0D9nhsuSV3qTV7IPkOcW/x2WmOejsI4PGQ0McHYeCE","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":315855},"main":"dist/index.js","module":"dist/esm","gitHead":"b5d5cbf24a225b2cdf86d6b59d6a5e38d5e788e9","scripts":{"lint":"npm run lint:check -- --fix","test":"npm run lint:check","build:prod":"npm run lint:check && rimraf dist && NODE_ENV=production babel src --out-dir dist/esm && NODE_ENV=production BABEL_ENV=commonjs babel src --out-dir dist","lint:check":"eslint src","prepublishOnly":"npm run build:prod"},"_npmUser":{"name":"ambassify","email":"dev@ambassify.com"},"repository":{"url":"git+https://github.com/ambassify/twitter-text.git","type":"git"},"_npmVersion":"9.8.1","description":"Ambassify's for of the official twitter text linkification library","directories":{},"_nodeVersion":"20.6.1","dependencies":{"punycode":"1.4.1","core-js-pure":"^3.19.0","@babel/runtime":"^7.3.1","twemoji-parser":"^11.0.2"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.48.0","rimraf":"^2.6.2","prettier":"^1.10.2","@babel/cli":"^7.4.0","@babel/core":"^7.4.0","@babel/preset-env":"^7.4.0","@babel/eslint-parser":"^7.22.15","eslint-config-prettier":"^2.9.0","eslint-plugin-prettier":"^2.6.0","babel-plugin-polyfill-corejs3":"^0.3.0","@babel/plugin-transform-spread":"^7.2.2","@babel/plugin-transform-runtime":"^7.4.0","babel-plugin-add-module-exports":"^1.0.2","@babel/plugin-syntax-dynamic-import":"^7.7.4","@babel/plugin-proposal-class-properties":"^7.4.0","@babel/plugin-transform-flow-strip-types":"^7.3.4","@babel/plugin-proposal-export-default-from":"^7.7.4","@babel/plugin-proposal-export-namespace-from":"^7.7.4"},"_npmOperationalInternal":{"tmp":"tmp/twitter-text_4.0.0_1695054128973_0.5009713345637665","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-11-04T08:44:06.720Z","modified":"2025-10-09T08:36:39.954Z","3.1.0":"2021-11-04T08:44:06.945Z","4.0.0":"2023-09-18T16:22:09.189Z"},"bugs":{"url":"https://github.com/ambassify/twitter-text/issues"},"author":{"name":"Twitter Inc."},"homepage":"https://github.com/ambassify/twitter-text","repository":{"url":"git+https://github.com/ambassify/twitter-text.git","type":"git"},"description":"Ambassify's for of the official twitter text linkification library","maintainers":[{"email":"dev@ambassify.com","name":"ambassify-admin"}],"readme":"# @ambassify/twitter-text\n\nThis is Ambassify's fork of the twitter-text library.\n\nWe extracted the JS portion of the library as we don't need other languages and their dependencies trigger dependabot alerts which are required to be fixed on Ambassify repositories. The effort required to fix them for those languages we don't use is too high.\n\nOur hope is that if there are ever any changes to the upstream package, they'll also fix their security issues and outdated builds.\n\nIt's available on NPM as `npm install @ambassify/twitter-text`\n\n## Changes we made\n\n- [Updated core-js and polyfill strategy](https://github.com/twitter/twitter-text/pull/363)\n- Removed unit tests\n- Updated babel-eslint to @babel/eslint-parser\n- Removed UMD build (using rollup)\n\n# Orginal README\n\n## NPM Users\n\nInstall it with: `npm install twitter-text`\n\nThe `twttr.txt` namespace is exported, making it available as such:\n\n``` js\nvar twitter = require('twitter-text')\ntwitter.autoLink(twitter.htmlEscape('#hello < @world >'))\n```\n\n## Extraction Examples\n\n    // basic extraction\n    var usernames = twttr.txt.extractMentions(\"Mentioning @twitter and @jack\")\n    // usernames == [\"twitter\", \"jack\"]\n\n## Auto-linking Examples\n\n    twttr.txt.autoLink(\"link @user, please #request\");\n\n    twttr.txt.autoLink(\"link @user, and expand url... http://t.co/0JG5Mcq\", {\n        urlEntities: [\n            {\n              \"url\": \"http://t.co/0JG5Mcq\",\n              \"display_url\": \"blog.twitter.com/2011/05/twitte…\",\n              \"expanded_url\": \"http://blog.twitter.com/2011/05/twitter-for-mac-update.html\",\n              \"indices\": [\n                30,\n                48\n              ]\n            }\n        ]});\n\nSee [Tweet Entities](https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/overview/entities-object) for more info getting url entities from Twitter's API.\n\n## Tweet Parsing\nPrevious versions of Twitter-Text provided different helper methods for Tweet validation, Tweet length, and remaining characters calculation. To simplify the API and obtain this information with just one call, Twitter-Text now exposes a new “parseTweet” method that will return the following fields:\n\n* **weightedLength:** Integer that indicates the weighted length calculated by the algorithm above.\n* **permillage:** Integer value corresponding to the ratio of consumed weighted length to the maximum weighted length.\n* **valid:** Boolean indicating whether it is a valid Tweet.\n* **dispayRangeStart:** Integer with start index on the Tweet string\n* **displayRangeEnd:** Integer with end index on the Tweet string (inclusive)\n* **validDisplayRangeStart:** Integer indicating the valid start index on the Tweet string\n* **validDisplayRangeEnd:** Integer indicating the valid end index on the Tweet string. This can be lesser than displayRangeEnd (inclusive).\n\n```js\nvar tweet = \"This is a test Tweet\";\ntwttr.txt.parseTweet(tweet);\n/* Returns:\n  {\n    weightedLength: 20,\n    permillage: 71,\n    valid: true,\n    displayRangeEnd: 19,\n    displayRangeStart: 0,\n    validRangeEnd: 19,\n    validRangeStart: 0\n  }\n*/\n```\nDetails about Twitter's weighted counting scheme are available on the [official developer website](https://developer.twitter.com/en/docs/counting-characters).\n\n### Marked for Deprecation\n\n`getTweetLength` returns the weighted length of a Tweet that is calculated by parseTweet. It will be removed in a subsequent release. Please use parseTweet instead.\n\n## Usernames\n\nUsername extraction and linking matches all valid Twitter usernames but does\nnot verify that the username is a valid Twitter account.\n\n## Lists\n\nAuto-link and extract list names when they are written in @user/list-name\nformat.\n\n## Hashtags\n\nAuto-link and extract hashtags, where a hashtag contains any latin letter or\nnumber but cannot be solely numbers.\n\n## URLs\n\nAsian languages like Chinese, Japanese or Korean may not use a delimiter such as\na space to separate normal text from URLs making it difficult to identify where\nthe URL ends and the text starts.\n\nFor this reason Twitter-Text currently does not support extracting or auto-linking\nof URLs immediately followed by non-Latin characters.\n\nExample: \"http://twitter.com/は素晴らしい\" .\nThe normal text is \"は素晴らしい\" and is not part of the URL even though\nit isn't space separated.\n\n## International\n\nSpecial care has been taken to be sure that auto-linking and extraction work\nin Tweets of all languages. This means that languages without spaces between\nwords should work equally well.\n\n## Hit Highlighting\n\nUse to provide emphasis around the \"hits\" returned from the Search API, built\nto work against text that has been auto-linked already.\n\n## Testing\n\nFor all Twitter-Text tests, run:\n\n    npm run test\n\nThis will run conformance and javascript tests.\n\n### Conformance\n\nThe main test suite is twitter-text-conformance. Tests are run in your browser, using QUnit.  To run the conformance suite, from the project root, run:\n\n    rake test:conformance\n\nYour default browser will open the test suite.  You should open the test suite in your other browsers as you see fit.\n\n### Other Tests\n\nThere are a few tests specific to twitter-text-js that are not part of the conformance suite.  To run these, from the project root, run:\n\n    rake test\n\nYour default browser will open the test suite.\n\n## Packaging\n\nOfficial versions are kept in the `pkg/` directory.  To roll a new version, (ex. v1.1.0), run the following from project root:\n\n    rake package[1.1.0]\n\nThis will make a new file at `pkg/twitter-text-1.1.0.js`.\n\n## Reporting Bugs\n\nPlease direct bug reports to the [twitter-text issue tracker on GitHub](https://github.com/twitter/twitter-text/issues)\n\n## Copyright and License\n\nCopyright 2012-2020 Twitter, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this work except in compliance with the License.\nYou may obtain a copy of the License in the LICENSE file, or at:\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","readmeFilename":"README.md"}