{"_id":"ot-text","_rev":"8-2dfc7ff4fd2a7b67b99e2a448b9e6341","name":"ot-text","description":"OT type for plaintext","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"ot-text","version":"1.0.0","description":"OT type for plaintext","main":"lib/index.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"ot-fuzzer":"~1.0.0","mocha":"^1.20.1","coffee-script":"^1.7.1"},"scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/ottypes/text.git"},"keywords":["ot","text","sharejs"],"author":{"name":"Joseph Gentle","email":"me@josephg.com"},"license":"ISC","bugs":{"url":"https://github.com/ottypes/text/issues"},"homepage":"https://github.com/ottypes/text","_id":"ot-text@1.0.0","dist":{"shasum":"7930e8f1953dc4bb07c45301b09640bb2165ce0d","tarball":"https://registry.npmjs.org/ot-text/-/ot-text-1.0.0.tgz","integrity":"sha512-d8/Q89Qe5k+JQbPP2Qo/bnai/LyYAhGxo2Q9/Fl04N95iI2cQoHrgKtjnk3qWGnPfzG2Gif3JZFanOw29VQy3g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCyY+azxbsc5NlR3G9Kg8DKOoV4EmILxJ4L7vQytd8TvgIhAJ5uB8XeILkmsRpkadLldv1YdUfyt/M/5JwfvY3NVWi6"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"josephg","email":"me@josephg.com"},"maintainers":[{"name":"josephg","email":"me@josephg.com"}]},"1.0.1":{"name":"ot-text","version":"1.0.1","description":"OT type for plaintext","main":"lib/index.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"ot-fuzzer":"~1.0.0","mocha":"^1.20.1","coffee-script":"^1.7.1"},"scripts":{"test":"mocha test"},"repository":{"type":"git","url":"https://github.com/ottypes/text.git"},"keywords":["ot","text","sharejs"],"author":{"name":"Joseph Gentle","email":"me@josephg.com"},"license":"ISC","bugs":{"url":"https://github.com/ottypes/text/issues"},"homepage":"https://github.com/ottypes/text","_id":"ot-text@1.0.1","dist":{"shasum":"3f850f6ee858bc36ef45ac9aa51d06c77e78dfcf","tarball":"https://registry.npmjs.org/ot-text/-/ot-text-1.0.1.tgz","integrity":"sha512-0syAFGaPKz6Ek38HNBTrTF6xkdqdjsF7TPARolvQTUH8aYP2mlCKeaFd/nL40emAHXOmCi7qx334BuQVBZB/EQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCO6djoPuzMGoQe1c8iyE+XR2HQeWVTdOH3VRFH74c1yQIgMHn1boetlrKwpUHztINxMxksC3XvgkSvzpbfY2gKn3E="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"josephg","email":"me@josephg.com"},"maintainers":[{"name":"josephg","email":"me@josephg.com"}]},"1.0.2":{"name":"ot-text","version":"1.0.2","description":"OT type for plaintext","main":"lib/index.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"coffeescript":"^2.3.2","mocha":"5","ot-fuzzer":"~1.0.0"},"scripts":{"test":"mocha test/*.coffee"},"repository":{"type":"git","url":"git+https://github.com/ottypes/text.git"},"keywords":["ot","text","sharejs"],"author":{"name":"Joseph Gentle","email":"me@josephg.com"},"license":"ISC","bugs":{"url":"https://github.com/ottypes/text/issues"},"homepage":"https://github.com/ottypes/text","gitHead":"ca574947496e29d8fa5ad4dd6d6e042b918c4ff4","_id":"ot-text@1.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"josephg","email":"me@josephg.com"},"dist":{"integrity":"sha512-1xjcAjB57tYtv722j8J+IaYe4fKZOeaQ3zDa0clUlkhboawrq+dk1cpDfe4+TBSb9NNe7Yra9+tJKsw+8q4H9A==","shasum":"fc27c12b07a93b13c328c833bf94c9c24ac46231","tarball":"https://registry.npmjs.org/ot-text/-/ot-text-1.0.2.tgz","fileCount":12,"unpackedSize":32192,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCNu+CRA9TVsSAnZWagAAFwYP+QDAAEjgtBoDu6glzfXq\ntO49pV76zzmAJQfSsBXqkmqCZ84+WwYp6+ebTFEhtufVQDhLEx6wWh4wBKvX\nmNc2hzVba7Yi3QX8EuWK46f6xDYyO/u8Ek/IlGuf/QWB2VQ2+pqYIFCfqV5t\nZsvlfxiY16Zxbzvk5uBHRvxmduVzPUJCsg5mxaXjhQR24zyrzpcszMJgNnAW\n0sBHM6APtIQvim3SuY4JMl0BBTP4R6TcrokHCTcMI2iy/sT+Flm60NgafTxd\nT3byq8GPiZT+V0ft+xZvjpK9T+VpPRxJ1lUUKDAKlqHDstDSHe5jMsWHPS3i\nICmwW7CwH8hMtdA8CDatk9zaZ9oZhpgKSnpjolhV2ThtTP/003hJLn2bP5Q7\nRe/HdQ7eMD4psEMkfSuZmaomN2mYE5Hw1OQ9lvCd3PjE7Vxo8rD0fSuKEFjZ\nU9fF7D16flNXrU6ftrY7nLD6/woTCOSqdVx1S+ZintYMtZtr1zAKQF61jPdZ\n9cvdP6Vc/wnM9sr6T22fEb1/187IO3zFWp5WTA9s/jgkeXGkhlb4L1c2mKET\nfTJFIS8Tz5oK2V1WrBR3m930gpWbkoF0vNjvRyMdrsd+HzUp457XSUza4Fw6\naceGY8+YzUvyTRLLwPKYVWFxjhzI3q5PLbLf16EFLnSgb9CeovnDNDuKH3Eh\nMZY9\r\n=XrEU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB83XnTeQidqQTsIoCRNR+OLVGPWeQHjlfddS51/lGLGAiEAi/bU1xWoJVwOEk9UeHaFl2+8LD1iNL+1u1Sc+2DGBgc="}]},"maintainers":[{"name":"josephg","email":"me@josephg.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ot-text_1.0.2_1544084414065_0.006698178391830956"},"_hasShrinkwrap":false}},"readme":"# The Plaintext OT Type\n\n**NOTE**: This OT type counts characters using UTF16 offsets instead of\nunicode codepoints. This is slightly faster in javascript, but its\nincompatible with ot implementations in other languages. For future\nprojects I recommend that you use\n[ot-text-unicode](https://github.com/ottypes/text-unicode) instead.\not-text-unicode also has full typescript type information and it supports ropes\nfor better performance string editing.\n\n\nThis OT type can be used to edit plaintext documents, like sourcecode or\nmarkdown.\n\nThis project's [history is here](https://github.com/share/ShareJS/blob/0.6/src/types/text2.coffee).\n\nFor documentation on the spec this type implements, see [ottypes/docs](/ottypes/docs).\n\n## Spec\n\nThe plaintext OT type thinks of the document as a giant string, and edits index\ninto the string directly. This is different from most text editors, which break\nup a document into an array of lines. For small documents on modern computers,\nthe conversion isn't particularly expensive. However, if you have giant\ndocuments you should be using a rope library like\n[jumprope](https://github.com/josephg/jumprope) or\n[librope](https://github.com/josephg/librope).\n\nEach operation describes a traversal over the document. The traveral can edit\nthe document as it goes.\n\nFor example, given the document:\n\n```\n\"ABCDEFG\"\n```\n\nYou could apply the operation\n\n```\n[1, ' hi ', 2, {d:3}]\n```\n\nThis operation will skip the first character, insert ' hi ', skip 2 more\ncharacters then delete the next 3 characters. The result would be:\n\n```\n\"A hi BCG\"\n```\n\n### Operations\n\nOperations are lists of components, which move along the document. Each\ncomponent is one of\n\n- **Number N**: Skip forward *N* characters in the document\n- **\"str\"**: Insert *\"str\"* at the current position in the document\n- **{d:N}**: Delete *N* characters at the current position in the document\n\nThe operation does not have to skip the last characters in the document.\n\n### Selections\n\nThe text type also has methods for manipulating selections.\n\nSelection ranges are either a single number (the cursor position) or a pair of\n[anchor, focus] numbers (aka [start, end]) of the selection range. Be aware\nthat end can be before start.\n\n---\n\n# Commentary\n\nThis is the 3rd iteration of ShareJS's plaintext type. It hasn't been changed\nin a long time now.\n\nThe first iteration was similar, except it is invertable. Invertability is\nnice, but I want to eventually build an arbitrary P2P OT system, and in a p2p\nsetting invertibillity becomes impractical to achieve. I don't want systems to\ndepend on it.\n\nThe second iteration made each component specify a location and an edit there.\nOperations were lists of these edits. Because the components were not sorted,\nif you transform two big operations by one another it requires M\\*N\ntime to transform. The components could be sorted to fix this, but if you're\ngoing to do that you may as well just make them sorted by design - which is\nwhat the current text implementation does. I thought the individual edits style\nwas better because I expected it to be simpler, but when I implemented it I\nfound the implementation of each method was almost identical in size.\n\nThere is also a [C implementation of this\ntype](https://github.com/share/libot/blob/master/text.h) which is [insanely](h\nttps://dl.dropboxusercontent.com/u/2494815/ot%20apply%20bench%201.png) [fast](\nhttps://dl.dropboxusercontent.com/u/2494815/ot%20apply%20bench%202.png). The\nimplementations are almost the same, except this javascript implemention\ncounts characters using 16 bit words and the C implementation counts\ncharacters using unicode codepoints. If you have any characters in the astral\nplane in your document (like emoji 😅), edit & cursor positions will be\nmisaligned between implementations. See [here for more\ninformation](http://josephg.com/blog/string-length-lies). If you are building\na cross-platform application, use the newer [ot-text-\nunicode](https://github.com/ottypes/text-unicode) instead.\n\n---\n\n# License\n\nAll code contributed to this repository is licensed under the standard MIT license:\n\nCopyright 2011 ottypes library contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following condition:\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n\n","maintainers":[{"name":"josephg","email":"me@josephg.com"}],"time":{"modified":"2022-06-23T03:59:27.543Z","created":"2014-07-17T23:36:03.289Z","1.0.0":"2014-07-17T23:36:03.289Z","1.0.1":"2014-07-20T17:14:13.210Z","1.0.2":"2018-12-06T08:20:14.295Z"},"homepage":"https://github.com/ottypes/text","keywords":["ot","text","sharejs"],"repository":{"type":"git","url":"git+https://github.com/ottypes/text.git"},"author":{"name":"Joseph Gentle","email":"me@josephg.com"},"bugs":{"url":"https://github.com/ottypes/text/issues"},"license":"ISC","readmeFilename":"README.md"}