{"_id":"jumprope","_rev":"14-7ab71c5022544016625cee7606c0dff7","name":"jumprope","description":"Fast string editing in Javascript using skip lists","dist-tags":{"latest":"1.2.1","rc":"1.1.1"},"versions":{"1.0.0":{"name":"jumprope","description":"Fast string editing in Javascript using skip lists","version":"1.0.0","author":{"name":"Joseph Gentle","email":"josephg@gmail.com","url":"josephgentle.com"},"keywords":["rope","string","algorithm"],"files":["lib/Rope.js","lib","example","package.json"],"main":"lib/Rope.js","directories":{"lib":"lib","example":"example"},"scripts":{"test":"nodeunit test/test.coffee"},"engines":{"node":"*"},"licenses":[{"type":"MIT","url":"https://github.com/josephg/jumprope/blob/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/josephg/jumprope.git"},"devDependencies":{"coffee-script":"~1.0.1","nodeunit":"~0.5.1"},"tag":"rc","_id":"jumprope@1.0.0","_engineSupported":true,"_npmVersion":"0.3.18","_nodeVersion":"v0.4.5","_defaultsLoaded":true,"dist":{"shasum":"20791c15dc030a0897f45b26445610f7c0e0fa21","tarball":"https://registry.npmjs.org/jumprope/-/jumprope-1.0.0.tgz","integrity":"sha512-MOXHWuXMtmS+eCej0AghPvO59ulp/KD94YdZIdqVNl5C6AabE97qFJsqs21PVRqROiFHatE7aMvsmUwjHiZ6gQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdgUndCV7SQ9afdzVN3Ap8bxV1GATx+aEzX0fgdkUwhgIgXmAMm0Rd3LocbFfgfmCWR67yzOxr4rBkSNDOLU8UT7c="}]}},"1.0.1":{"name":"jumprope","description":"Fast string editing in Javascript using skip lists","version":"1.0.1","author":{"name":"Joseph Gentle","email":"josephg@gmail.com","url":"josephgentle.com"},"keywords":["rope","string","algorithm"],"files":["lib/Rope.js"],"main":"lib/Rope.js","directories":{"lib":"lib","example":"example"},"scripts":{"test":"nodeunit test/test.coffee"},"engines":{"node":"*"},"licenses":[{"type":"MIT","url":"https://github.com/josephg/jumprope/blob/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/josephg/jumprope.git"},"devDependencies":{"coffee-script":"*","nodeunit":"*"},"tag":"rc","_id":"jumprope@1.0.1","dist":{"shasum":"e759cc39273f6c166017a81d74bc11a1051b6d9c","tarball":"https://registry.npmjs.org/jumprope/-/jumprope-1.0.1.tgz","integrity":"sha512-oiRP57i820YxfNF8TfXjyav+Gm37GAklWaXSg+UwhUgyqvXOdPFxtu8bkl30qVU77QvQDnH2GTlqvlaphj27JQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCH2yOt2L8AurbKQM+Ws2a68Qmiqu32fms8L0IuqKexnICIQCOW6+9Ad/ByGcUeh1SwEqF5SDUBTqKRZbTILeJ7jgqkQ=="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}]},"1.1.0":{"name":"jumprope","description":"Fast string editing in Javascript using skip lists","version":"1.1.0","author":{"name":"Joseph Gentle","email":"josephg@gmail.com","url":"josephgentle.com"},"keywords":["rope","string","algorithm"],"main":"rope.js","directories":{"lib":"lib","example":"example"},"scripts":{"test":"mocha --compilers coffee:coffee-script/register --reporter spec test/test.coffee"},"engines":{"node":"*"},"licenses":[{"type":"MIT","url":"https://github.com/josephg/jumprope/blob/master/LICENSE"}],"repository":{"type":"git","url":"git+ssh://git@github.com/josephg/jumprope.git"},"devDependencies":{"coffee-script":"*","mocha":"^2.4.5"},"tag":"rc","gitHead":"a99b04d540c37b72109e51670c3db83048f14632","bugs":{"url":"https://github.com/josephg/jumprope/issues"},"homepage":"https://github.com/josephg/jumprope#readme","_id":"jumprope@1.1.0","_shasum":"591beeebfc69c41bafe90493c68a8006121c4cf0","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.7.0","_npmUser":{"name":"josephg","email":"me@josephg.com"},"dist":{"shasum":"591beeebfc69c41bafe90493c68a8006121c4cf0","tarball":"https://registry.npmjs.org/jumprope/-/jumprope-1.1.0.tgz","integrity":"sha512-Ew5W3CIv4WG1capuxPpKcCpYy3JwJLQOQRyobKvVX5jcBJ7ff+RqwgWFJgi2b/6a71otsza0ynYXqvV/rUsWow==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICcyrxXcGUVW+yT1mv9HHbH+46tQy8HILi/0Y86o03vaAiEAglBg/XEq5+ZXpCiGroHi85l/Qi9EMVVMzhKCg/iMkmw="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/jumprope-1.1.0.tgz_1458955145833_0.5770541066303849"}},"1.1.1":{"name":"jumprope","description":"Fast string editing in Javascript using skip lists","version":"1.1.1","author":{"name":"Joseph Gentle","email":"josephg@gmail.com","url":"josephgentle.com"},"keywords":["rope","string","algorithm"],"main":"rope.js","directories":{"lib":"lib","example":"example"},"scripts":{"test":"mocha --compilers coffee:coffee-script/register --reporter spec test/test.coffee"},"engines":{"node":">=4.4.1"},"licenses":[{"type":"MIT","url":"https://github.com/josephg/jumprope/blob/master/LICENSE"}],"repository":{"type":"git","url":"git+ssh://git@github.com/josephg/jumprope.git"},"devDependencies":{"coffee-script":"*","mocha":"^2.4.5"},"tag":"rc","gitHead":"12fd8084691cc0b4f97f553aa6c1623708afc17c","bugs":{"url":"https://github.com/josephg/jumprope/issues"},"homepage":"https://github.com/josephg/jumprope#readme","_id":"jumprope@1.1.1","_shasum":"1388d74b9dc6a96cb29048c07eaad8a6cd26ca44","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.7.0","_npmUser":{"name":"josephg","email":"me@josephg.com"},"dist":{"shasum":"1388d74b9dc6a96cb29048c07eaad8a6cd26ca44","tarball":"https://registry.npmjs.org/jumprope/-/jumprope-1.1.1.tgz","integrity":"sha512-YN+NWUasdJ4ae3tSEUVWniuvGjy940PSiXkL0B7bZyz/LoVCwrrdDEvYigQEh2WIijHtSN13Xjn6+/H5W/jmDA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDJj4XNsiKn8JQamvn/FQ6dplkfh/ajnvkXufvj1wJKCgIge3qPX6zwz5NNMOALrGK4kbrs1VTXDivu8RRnldPHzvg="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/jumprope-1.1.1.tgz_1459120410160_0.03823395958170295"}},"1.0.0-rc1":{"name":"jumprope","description":"Fast string editing in Javascript using skip lists","version":"1.0.0-rc1","author":{"name":"Joseph Gentle","email":"josephg@gmail.com","url":"josephgentle.com"},"keywords":["rope","string","algorithm"],"files":["lib/Rope.js"],"main":"lib/Rope","directories":{"lib":"lib","example":"example"},"scripts":{"test":"nodeunit test/test.coffee"},"engines":{"node":"*"},"licenses":[{"type":"BSD","url":"http://www.freebsd.org/copyright/freebsd-license.html"}],"repository":{"type":"git","url":"http://github.com/josephg/jumprope.git"},"devDependencies":{"coffee-script":"~1.0.1","nodeunit":"~0.5.1"},"tag":"rc","_id":"jumprope@1.0.0-rc1","_nodeSupported":true,"_npmVersion":"0.2.11-5","_nodeVersion":"v0.4.3","dist":{"shasum":"93b71dc94e6e95ed52ffb4af40669ea2b8cf605f","tarball":"https://registry.npmjs.org/jumprope/-/jumprope-1.0.0rc1.tgz","integrity":"sha512-IB1TQk6hGdSAqKNd9/D/TwEWKvlr9kS078QonJbzNMvNcribgmelrl5sa+Dvxbkjvvx5ZXVOmm9zEyS1MGvo7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgZvkmby8Et5mJnlTHqBjq9iD48XdDT+uQTn9Z7kGZqQIhAJTIlqIYrYBduiUzzpeCpvlWNHv9ArltyYyzEoqdXcYA"}]}},"1.2.0":{"name":"jumprope","description":"Fast string editing in Javascript using skip lists","version":"1.2.0","author":{"name":"Joseph Gentle","email":"me@josephg.com","url":"josephgentle.com"},"keywords":["rope","string","algorithm"],"main":"rope.js","directories":{"lib":"lib","example":"example"},"scripts":{"test":"mocha test/test.coffee"},"licenses":[{"type":"MIT","url":"https://github.com/josephg/jumprope/blob/master/LICENSE"}],"repository":{"type":"git","url":"git+ssh://git@github.com/josephg/jumprope.git"},"devDependencies":{"coffeescript":"^2.3.2","mocha":"5"},"gitHead":"e55505a0a8e45c795076ca1b6567de95d96567d8","bugs":{"url":"https://github.com/josephg/jumprope/issues"},"homepage":"https://github.com/josephg/jumprope#readme","_id":"jumprope@1.2.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"josephg","email":"me@josephg.com"},"dist":{"integrity":"sha512-3Jga1yKAAcgK09shc+/RERdEh+yguBtfnMMQ8fidFBKKzFfHV6xRTBU1mEKRTQ0LDZ54/Q+h3BEi4o8iWQuwhA==","shasum":"8bdb7abcc1c9d5dfdaa1376ba347af24bf260ad4","tarball":"https://registry.npmjs.org/jumprope/-/jumprope-1.2.0.tgz","fileCount":7,"unpackedSize":20803,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCG7VCRA9TVsSAnZWagAAaEMQAJ/m13cnkSFUziZP/kBm\n74SxbRVvW4qGqZE44/6hRilFJgyNYmiCh+/8BAHyTlxaCJsS9DaeLpftLjG4\nQLOwSFQN7NU7viHDs2QAEwOPcRT7hGnvbRq5ZpzreRBVyRbMu48Q7URTbu9I\nGHt7R0tDUpHt4P1JIHDU0VPu3yKeakkrAxAaz+d0rOe2FH+KVZLKVW5NqFhm\ndCO4eZvhB5bnd8jOytqJQfyu9T5eJf869WMoqiv02aL+TnFTA7dqx+4STHSl\nJzcfZ8oY3m3rIUilq6Qg7IPGHlOfpwVrV/8ifruBCKUfPCqQhgVBj8IjRCcU\nf7ZS4kwx1+E/6bwRlhd0wcChzWIx6AuuKqa7+0yR1eEyuJEhdqZfS6bvZFiM\nM7NRUI+URUESgQjs6OUlBqU4Ef/pcRXT0tYHVW2N3quyU+5btLuzjm8u2h6/\noavEu9OXUUsI2JuOhJwT6RssNh3t3OhalrvTnnArypReZtDdazMoZTDxhoWm\nsPQVCbensxqEG7WJACzxy0BuF8HmbuyylK3ObEazw2+BKgTMz+bM2wJG6wT3\ndbqshnxHlSRQQ2MVhAPNIpnxQHsj/kxlUcTDL34BTiCh16xcaJzqEerMeRNL\nZNkgy6H3JcUvdUKdfszZ+1L/f37W36B9KhZxmG1bH+Ze5iQm4NFR5ZSFPvhn\nZUPw\r\n=tmBf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEphRicYSOap8kS+w63RpBghZIyfbiApVxEU4IcgUwcCAiEArtQUqgXjcshSilq/s0SFn2ZMxps710wXdiAIVMSMpZ0="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jumprope_1.2.0_1544056532431_0.0317866359324952"},"_hasShrinkwrap":false},"1.2.1":{"name":"jumprope","description":"Fast string editing in Javascript using skip lists","version":"1.2.1","author":{"name":"Joseph Gentle","email":"me@josephg.com","url":"josephgentle.com"},"keywords":["rope","string","algorithm"],"main":"rope.js","directories":{"lib":"lib","example":"example"},"scripts":{"test":"mocha test/test.coffee"},"licenses":[{"type":"MIT","url":"https://github.com/josephg/jumprope/blob/master/LICENSE"}],"repository":{"type":"git","url":"git+ssh://git@github.com/josephg/jumprope.git"},"devDependencies":{"coffeescript":"^2.3.2","mocha":"5"},"gitHead":"89b47ac5c48a2faad698ffbec93d2fc2fdfc1676","bugs":{"url":"https://github.com/josephg/jumprope/issues"},"homepage":"https://github.com/josephg/jumprope#readme","_id":"jumprope@1.2.1","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"josephg","email":"me@josephg.com"},"dist":{"integrity":"sha512-EX3AY3etlYxq6VNQ+Jg7QvnS14N7HmZobFIuDWO/AxH/jnRLLSJ0RO8yS2OBw3YpigrOk0ScIBsii0Rm3+Xp4w==","shasum":"0ebd00d2e0b7d6f9496cac8e84f22f0e7fe3cdf4","tarball":"https://registry.npmjs.org/jumprope/-/jumprope-1.2.1.tgz","fileCount":7,"unpackedSize":20842,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCG/CCRA9TVsSAnZWagAAM3YQAJDuJH4aQer15i7Lmz9L\n/pfw0mb7I0LXaa3ci4F/ZuVoMcxmBm3sfuaz1fhozxz4sgrwd+72Vp4pNIhn\nCYauuYc9ZcHV7DkLQFn9Hd5/wpjh9SrpP7FhS5wCLkSkfpkOkixyCAH3MV6G\n3ecwgPEdCY5Y0zVDyofM6T29qfkHWr9sFZXMHUiWCX1oA5g+WsSxlu7hCPQ/\nVTOPv+ARtTxZP4qB9aUsLbGSvsV0KqbsQreZ3mM8ECRutBKom6V7ydaW8rH3\nOucEhEs4l4oyQjteBpndw+6rXCRHrP8oJR1qJ5AB13w7FUcRd9ZRxCU0fOtJ\nlKQGJSUFH01N/WsMof4gisXs5Vf+2tBVwPDsRiz0E8JZQy9ClNsbs3CTqIWK\n049LSpN5wzmGFuiEKz/Xs/Taa/o0oLzhlVFPAoa9Ei4wIwEKEEzE/8UFSAtd\ndAn0c1YtaNe1UcNyj4SyOPyKmDyyDad5rznn0eYENqALVoIyJ92YM33qZSks\nqXlol4Z/z6tAovdYCbavR1kHUcZQy/ga/Ov0pqyauvl7F5IdmAVCRN4GW3KD\nA3vkGIq1NR4NDBkJCV+zE/p2wcPST/ZCdSrvQ/ba64Nk3SRhoR02aiR6CDBk\naRZaa8K5PJ79Ha5LZv0elVnVMhZDOajlbNipp0UGmlWxjDH7UTS0/eJzxw2Q\n3cDT\r\n=JiHK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHVLIgSsRs0kSywz+CrhttWCndJ1a3cEjxszgzdaMaRAIgazwjI8PuUshgipvzWNXnw0YWD106pW3HnckVdcjGzZE="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jumprope_1.2.1_1544056769960_0.19501946201204534"},"_hasShrinkwrap":false}},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"time":{"modified":"2022-06-19T07:19:56.551Z","created":"2011-03-29T10:01:01.415Z","1.0.0":"2011-05-03T04:46:18.251Z","1.0.1":"2012-07-14T04:11:07.393Z","1.1.0":"2016-03-26T01:19:07.962Z","1.1.1":"2016-03-27T23:13:30.552Z","1.0.0-rc1":"2011-03-29T10:01:02.498Z","1.2.0":"2018-12-06T00:35:32.537Z","1.2.1":"2018-12-06T00:39:30.090Z"},"author":{"name":"Joseph Gentle","email":"me@josephg.com","url":"josephgentle.com"},"repository":{"type":"git","url":"git+ssh://git@github.com/josephg/jumprope.git"},"keywords":["rope","string","algorithm"],"readme":"JumpRope\n========\n\nJumprope is a fun little library for efficiently editing strings in Javascript. If you have long strings and you need to insert or delete into them, you should use jumprope. Its faster than splicing strings all the time if the strings are big:\n\n    5000000 random inserts on an empty string, resulting in the string of size 6M chars long:\n\n    Rope took 5610 ms. 0.001122 ms per iteration, 891k iterations per second\n    JS toString took 3463 ms. 0.003463 ms per iteration, 288k iterations per second\n\n    (Tested on node v10.13.0)\n\n\nRopes have insertion and deletion time of O(|s| * log(N)) where\n|s| is the length of the inserted / deleted region\nN is the length of the string\n\nIn comparison, naive strings have insertion time of O(N + s) and deletion time of O(N - s). Javascript strings are special and complicated, and much fancier than naive strings. This library was written several years ago. NodeJS strings have gotten faster in the intervening time, and using pure JS strings is a reasonable choice for recent applications.\n\n\nInstalling\n----------\n\n    npm install jumprope\n\nUsage\n-----\n\n```javascript\nRope = require('jumprope');\n\nvar r = new Rope('initial string');\nr.insert(4, 'some text'); // Insert 'some text' at position 4 in the string\nr.del(4, 9); // Delete 9 characters from the string at position 4\nconsole.log(\"String contains: \" + r.toString() + \" length: \" + r.length);\n```\n\nOutput:\n\n    String contains: 'initial string' length: 14\n\nAPI\n---\n\n* `new Rope([initial text])`\n\nCreate a new rope, optionally with the specified initial text.\n\n```javascript\nRope = require('jumprope');\n\nvar r = new Rope(); // Create a new Rope\nvar r = new Rope('str'); // Create a new Rope with initial string 'str'\n```\n\n* `r.insert(position, text)`\n\nInsert text into the rope at the specified position.\n\n```javascript\nr.insert(4, 'some text'); // Insert 'some text' at position 4. Position must be inside the string.\n```\n\n* `r.del(position, count, [callback])`\n\nDelete `count` characters from the rope at `position`. Delete can optionally take a callback, which is called with the deleted substring.\n\n```javascript\nr.del(4, 10); // Delete 10 characters at position 4\nr.del(4, 10, function(str) { console.log(str); }); // Delete 10 characters, and print them out.\n```\n\n* `r.forEach(callback)`\n\nIterate through the rope. The callback will be passed the whole string, a few characters at a time. This is the fastest way to read the string if you want to write it over a network stream, for example.\n\n```javascript\n// Print the string out, a few characters at a time.\nr.forEach(function(str) { console.log(str); })\n```\n\n* `r.toString()`\n\nConvert the rope into a javascript string.\n\nInternally, this just calls `forEach()` and `.join`'s the result.\n\n```javascript\nconsole.log(r.toString());\n```\n\n* `r.length`\n\nGet the number of characters in the rope.\n\n```javascript\nr.del(r.length - 4, 4); // Delete the last 4 characters in the string.\n```\n\n* `r.substring(position, length)`\n\nGet a substring of the string. Kinda like splice, I guess. Maybe I should copy the JS API.\n\n```javascript\nconsole.log(r.substring(4, 10)); // Print out 10 characters from position 4 onwards.\n```\n\nSpeed\n-----\n\nAt least in V8 (Node / Chrome) it seems like the cross-over point where it becomes worth using jumpropes is when you're dealing with strings longer than about 5000 characters. Until then, the overheads of jumpropes makes them slower than just dealing with normal javascript strings.\n\nOf course, when your strings are that small it doesn't matter that much how you're using them.\n\nOnce your strings get long, jumpropes become a lot faster.\n\n\nLicense\n-------\n\nMIT licensed, so do what you want with it.\n\n\nAcknowledgements\n----------------\n\nThanks to Ben Weaver for his node [closure library](https://github.com/weaver/scribbles/tree/master/node/google-closure/)\n","readmeFilename":"README.md","homepage":"https://github.com/josephg/jumprope#readme","bugs":{"url":"https://github.com/josephg/jumprope/issues"}}