{"name":"mori","version":"0.2.8","description":"Persistent Data Structures for JavaScript","homepage":"https://github.com/swannodette/mori","author":{"name":"David Nolen","url":"https://github.com/swannodette"},"keywords":["data","structure","persistent","clojure","clojurescript","map","filter","reduce"],"contributors":[{"name":"David Nolen","url":"https://github.com/swannodette"}],"bugs":{"url":"https://github.com/swannodette/mori/issues"},"licenses":[{"type":"EPL","url":"https://raw.github.com/swannodette/mori/master/epl-v10.html"}],"main":"./mori.js","repository":{"type":"git","url":"git://github.com/swannodette/mori.git"},"engines":{"node":">=0.8.22"},"dependencies":{},"devDependencies":{"jasmine-node":"1.7.0"},"scripts":{"build":"./scripts/build.sh","build-clean":"./scripts/build_clean.sh","clean":"./scripts/clean.sh","prepublish":"npm run-script build-clean"},"directories":{"test":"./spec"},"_id":"mori@0.2.8","_shasum":"37ec89292322d53d1e4535bbbc527d5ed2366941","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"dnolen","email":"david.nolen@gmail.com"},"maintainers":[{"name":"dnolen","email":"david.nolen@gmail.com"}],"dist":{"shasum":"37ec89292322d53d1e4535bbbc527d5ed2366941","tarball":"http://registry-npm.ywwl.com/mori/download/mori-0.2.8.tgz","integrity":"sha512-WmQZuWDo++KvgkiE+B8/CHCBUZC+57OcUaPMXPteTtWmuSXYjEmhA1orQ3etypjbXCCT1L7HtrzjzWlIFoLctg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDd5lVtFIFSstELm3LfiwQp5VSoGbQgoLh6YASrtdy6ZAIgfogRxgCRuqWnL8+qmhjqdb0l2/wXCMB2nXn7hY+bFdQ="}],"size":40872,"noattachment":false,"key":"/mori/-/mori-0.2.8.tgz"},"readme":"# mori\n\n<img src=\"http://cloud.github.com/downloads/swannodette/mori/mori.png\" alt=\"Mori\" title=\"Mori\"/>\n\nA simple bridge to ClojureScript's persistent data structures and [supporting APIs](http://swannodette.github.io/mori/) for vanilla JavaScript. Pull requests welcome.\n\n## Breaking changes in 0.3.0 \n\nThis release includes several breaking changes:\n\n* More idiomatic JavaScript API naming scheme\n* No EDN reader\n* No zippers\n* No data diffing\n\nThese missing options will likely find their way back into Mori when\nMori builds can leverage Google Closure Modules.\n\n## Getting it\n\nYou can install the latest release via npm:\n\n```shell\nnpm install mori\n```\n\nThe installed package contains a single optimized JavaScript file `mori.js`.\n\nLoad `mori` in your Node.js programs as you would any other module:\n\n```javascript\nvar mori = require(\"mori\");\n```\n\nIn a browser, you can load mori with a script tag, as you would any other JavaScript library:\n\n```html\n<script src=\"mori.js\" type=\"text/javascript\"></script>\n```\n\nYou can also load it as an AMD module, e.g. with [RequireJS](http://requirejs.org/).\n\n## Build\n\n### Prerequisites\n\nYou will first need to install the [Java](http://www.oracle.com/technetwork/java/javase/downloads/index.html) SDK, if it's not already installed on your system.\n\nOn Windows, you will need to manually install [Leiningen](http://github.com/technomancy/leiningen). On UNIX-like systems, Leiningen will be installed within the project automatically if the `lein` executable is not found on your path or if your `lein` version predates `2.0.0`.\n\n### Clone the repo\n\n```shell\ngit clone https://github.com/swannodette/mori.git\ncd mori\n```\n\n### On a UNIX-like system build with\n\n```shell\n./scripts/build.sh\n```\n\n### Alternatively using npm\n\n```shell\nnpm run-script build\n```\n\n### On Windows\n\n```shell\n./scripts/build.ps1\n```\n\nThe build process will generate an optimized JavaScript file `mori.js`, which is suitable for use with Node.js, or in a Web browser or other JavaScript environments. You can also load it as an AMD module.\n\n## Usage\n\nYou can use it from your projects like so:\n\n```javascript\nvar inc = function(n) {\n  return n+1;\n};\n\nmori.intoArray(mori.map(inc, mori.vector(1,2,3,4,5)));\n// => [2,3,4,5,6]\n```\n\nEfficient non-destructive updates!\n\n```javascript\nvar v1 = mori.vector(1,2,3);\nvar v2 = mori.conj(v1, 4);\nv1.toString(); // => '[1 2 3]'\nv2.toString(); // => '[1 2 3 4]'\n```\n\n```javascript\nvar sum = function(a, b) {\n  return a + b;\n};\nmori.reduce(sum, mori.vector(1, 2, 3, 4)); // => 10\n```\n\nLazy sequences!\n\n```javascript\nvar _ = mori;\n_.intoArray(_.interpose(\"foo\", _.vector(1, 2, 3, 4)));\n// => [1, \"foo\", 2, \"foo\", 3, \"foo\", 4]\n```\n\nOr if it's more your speed, use it from CoffeeScript!\n\n```coffeescript\ninc = (x) -> x+1  \nr = mori.map inc, mori.vector(1,2,3,4,5)\nmori.intoArray r\n```\n\n### Documentation\n\nYou can find extensive [documentation and examples](http://swannodette.github.io/mori/) here.\n\n## More Examples\n\n### Efficient Freeze/Thaw\n\nFor vectors and maps we provide an efficient thaw and freeze\noperations:\n\n```javascript\nvar m = mori;\n\n// ~220ms with V8 version 3.29.80 MBP 2.26ghz\nfor(var j = 0; j < 10; j++) {\n  var s = new Date();\n  var arr = [];\n  for(var i = 0; i < 10000000; i++) {\n    arr.push(i);\n  }\n  print(\"Array push \" + arr.length + \" items \" + ((new Date())-s));\n  gc();\n}\n\n// ~70ms\nfor(var j = 0; j < 10; j++) {\n  s = new Date();\n  var mv = m.mutable.thaw(m.vector());\n  for(var i = 0; i < 10000000; i++) {\n    mv = m.mutable.conj.f2(mv, i);\n  }\n  var v = m.mutable.freeze(mv);\n  print(\"Mutable vector conj \" + m.count(v) + \" items \" + ((new Date())-s));\n  gc();\n}\n```\n\n### ES6 Map/Set inspired interfaces\n\nAll Mori maps and sets support all the non-mutating methods of the\nproposed ES6\n[Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)\nand\n[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\ninterfaces. The main difference with the spec is that key lookup is\nbased on value not reference. `keys`, `values`, and `entries` methods\nreturn the proposed mutable iterators:\n\n```javascript\nvar m = mori;\nvar h = m.hashMap(\"foo\", 1, \"bar\", 2);\n\nh.has(\"foo\"); // => true\nh.get(\"foo\"); // => 1\n\nvar iter = h.keys();\niter.next(); // => {done: false, value: \"foo\"}\n```\n\nThis feature is subject to changes in the ES6 proposal.\n\n### Transducers\n\nMori includes Transducers. Zero allocation collection operations FTW:\n\n```javascript\nvar m = mori;\nvar a = [];\n\nfor(var i = 0; i < 1000000; i++) {\n  a.push(i);\n}\n\n// make it immutable\nvar v = m.into(m.vector(), a);\n\nfunction time(f) {\n  var s = new Date();\n  f();\n  console.log(((new Date())-s)+\"ms\");\n}\n\n// ~190ms V8 version 3.29.80 MBP 2.26ghz\ntime(function() {\n  var xf = m.comp(m.map(m.inc), m.map(m.inc), m.map(m.inc));\n  return m.transduce(xf, m.completing(m.sum), 0, v);\n}, 10);\n\n// ~440ms\ntime(function() {\n  return a.map(m.inc).map(m.inc).map(m.inc).reduce(function(a,b){return a+b;}, 0);\n}, 10);\n```\n\nCopyright (C) 2012-2015 David Nolen and contributors\n\nDistributed under the [Eclipse Public License](https://raw.github.com/swannodette/mori/master/epl-v10.html), the same as Clojure.\n","publish_time":1405095417165,"_cnpm_publish_time":1405095417165,"dist-tags":{"latest":"0.3.2"}}