{"_id":"traverser","_rev":"19-c46d62354c21784b6ba1ec139ce5ae69","name":"traverser","description":"lib for traversing trees and graphs","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.0":{"name":"traverser","description":"lib for traversing trees and graphs","version":"0.0.0","homepage":"https://github.com/dominictarr/traverser","repository":"git://github.com/dominictarr/traverser.git","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"main":"./index","directories":{"lib":"."},"devDependencies":{"expresso":">=0.6.0","nodeunit":">=0.5.0"},"dependencies":{"curry":"*"},"engines":{"node":"*"},"scripts":{"test":"expresso test/*.expresso.js && nodeunit test/*.asynct.js"},"_id":"traverser@0.0.0","_engineSupported":true,"_npmVersion":"0.2.17","_nodeVersion":"v0.3.0","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"b828dad6d39834b9e8880659f7ba22a4d68fe864","tarball":"https://registry.npmjs.org/traverser/-/traverser-0.0.0.tgz","integrity":"sha512-AVDcN/mrmLDcj751IgVik7RoGwhRNQB1/wIPcnM7Hmk1YpgffOYy529QY/IIYqMoEVa99wr9bl15emMd46D0Qg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/r5EwVFdWbdKaSimyRtHVVCqmPFqI1xXevxC4WH1UpAIgBKcqk2JwwEAH8koSj3sIpsxrJz10Vx4X+CYxolgqwfQ="}]}},"0.0.1":{"name":"traverser","description":"lib for traversing trees and graphs","version":"0.0.1","homepage":"https://github.com/dominictarr/traverser","repository":"git://github.com/dominictarr/traverser.git","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"main":"./index","directories":{"lib":"."},"devDependencies":{"expresso":">=0.6.0","nodeunit":">=0.5.0"},"dependencies":{"curry":"*"},"engines":{"node":"*"},"scripts":{"test":"expresso test/*.expresso.js && nodeunit test/*.asynct.js"},"_id":"traverser@0.0.1","_engineSupported":true,"_npmVersion":"0.2.17","_nodeVersion":"v0.3.0","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"0cb72bf7a68291d1c960979bf75fae62c497d34a","tarball":"https://registry.npmjs.org/traverser/-/traverser-0.0.1.tgz","integrity":"sha512-qR5ss6EJXnQxvDJNz7ZAkPaLT+NX1FSzzDnLf05Qgov6+fzwtXmLH/A0CdJIkpW9yQHPTEOGh39Oh9lOpfxTOA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC76v75LozmDoa0vXtB9FXrbqeXW4BQ4ubuiX1hJC3oRAIhANEt67FYg/la/41chWZAIQP2z082NS+yhThBbA3ZEP5U"}]}},"0.0.2-1":{"name":"traverser","description":"lib for traversing trees and graphs","version":"0.0.2-1","homepage":"https://github.com/dominictarr/traverser","repository":{"type":"git","url":"git://github.com/dominictarr/traverser.git"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"main":"./index","directories":{"lib":".","example":"examples"},"dependencies":{"curry":"0.0.x"},"engines":{"node":"*"},"devDependencies":{},"_id":"traverser@0.0.2-1","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"2cfd45b2040f37f887c2ff9c265dda27393ad49b","tarball":"https://registry.npmjs.org/traverser/-/traverser-0.0.2-1.tgz","integrity":"sha512-FT/Gn7hXFdEdHZyVQvaWVnLIcl0n02BAnbcue8lZ6O+AWZH0MN9p96BJKun6FLLTmMZPEJdCJ3WTejWj0HXf+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFfZyd4NyHKT9RgLppPQ6dck+LO2RGnmdlIyBONos6GUAiEAgsiDRoR3UQa4D5AhQq28vIO2bfqDGiMhf0KTl4n+C0o="}]},"scripts":{}},"0.0.2-2":{"name":"traverser","description":"lib for traversing trees and graphs","version":"0.0.2-2","homepage":"https://github.com/dominictarr/traverser","repository":{"type":"git","url":"git://github.com/dominictarr/traverser.git"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"main":"./index","directories":{"lib":".","example":"examples"},"dependencies":{"curry":"0.0.x"},"engines":{"node":"*"},"devDependencies":{},"_id":"traverser@0.0.2-2","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"8945eb79410c008730694dc58fec96f09470c1ff","tarball":"https://registry.npmjs.org/traverser/-/traverser-0.0.2-2.tgz","integrity":"sha512-QHcAgQ4OxArUnqJ10bevDqRM+zjizcQ7SoSc/aNY/b3k+XoTnwKcSsXeEWe7ee+umiut+tFjiyvGiWSMFdNUjg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEfNog88QmN9W/GmkRU3qrQbUGqpafPkXhbJSqezfN17AiEAxe8jj456wNAw3UWP8mlkuWye84Bmz3oYp0G97Hl8yHU="}]},"scripts":{}},"1.0.0":{"name":"traverser","description":"lib for traversing trees and graphs","version":"1.0.0","homepage":"https://github.com/dominictarr/traverser","repository":{"type":"git","url":"git://github.com/dominictarr/traverser.git"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"main":"./traverser.sync","directories":{"lib":".","example":"examples"},"dependencies":{"curry":"0.0.x"},"engines":{"node":"*"},"_npmJsonOpts":{"file":"/home/dominic/.npm/traverser/1.0.0/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"traverser@1.0.0","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.13","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"6f59e5813759aeeab3646b8f4513fd4a62e4fe20","tarball":"https://registry.npmjs.org/traverser/-/traverser-1.0.0.tgz","integrity":"sha512-SIf4FiM5y4l03O5VKN/VbnswgIK9gHJKmLK/wiWjgdxPsj2VGcS7hOinjKMFv4r8QIUK+5MXsyXzJhc0bmaB0A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICKE6OcJ9LzbB9SxF6z9AguLOlK9b371di2wGPI/jbJ9AiEA6oRj3u8eRFjhH33VTF8cKd7GdQRQ/+8LglBhqYOfoB4="}]},"scripts":{}},"0.0.4":{"name":"traverser","description":"lib for traversing trees and graphs","version":"0.0.4","homepage":"https://github.com/dominictarr/traverser","repository":{"type":"git","url":"git://github.com/dominictarr/traverser.git"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"main":"./traverser.sync","directories":{"lib":".","example":"examples"},"dependencies":{"curry":"0.0.x"},"engines":{"node":"*"},"_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"_id":"traverser@0.0.4","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.23","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"d3b6eb3da89a896463088385ecd7e53b9bbce5ac","tarball":"https://registry.npmjs.org/traverser/-/traverser-0.0.4.tgz","integrity":"sha512-DODiieNEQgFbO1Xqj/+A9c5rYfccBPTvaUt0pRv+h09U0l6YZTvCOlvCIU43W+rLG4+6WOU7NzS4OcqlErmMxg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQChUKo6MBHaCHxef/qRhdX/eCvUH85Aur57zubZfa6NwQIgcMvXcUNA9fjAKT7hsPkSgcnSy7C25BE1ZDuORX13i2s="}]},"readme":"\n#Traverser#\n\nsearch through a complex object (nearly) as easily as forEach\n\nall the nitty-gritty stuff is taken care of.\n\nincluding:\n  # checking for repeats.\n  # checking for cycles.\n  # getting the path the the current object. etc!\n\n#simple example#\ncollect all branches in a tree.\n\n    var traverser = require('traverser')\n      , branches = []\n\n    function branch(props){\n      if(!props.reference) //since we check for references with will work in cyclic graphs, without stackoverflows.\n        branches.push(props.value)\n\n      props.each()//continue working through the children of this object.\n    }\n\n    traverser([1,2,{},3,[\"x\"]],{branch: branch})\n    \n    console.log(branches)\n\n#simple example2#\ncollect all leaves in a tree. (only functions and primitives)\n\n    var traverser = require('traverser')\n\n    exports.leaves = leaves\n\n    function leaves (obj){\n        var leaves = []\n\n        function leaf(props){\n          leaves.push(props.value)\n        }\n\n        traverser(obj,{leaf: leaf})\n        return leaves\n    }\n\n    traverser([1,2,{},3,[\"x\"]],{leaf: leaves})\n\n    console.log(leaves([1,2,{},3,[\"x\"]]))\n    //[1,2,3,'x']\n    \n#complex example#\neven quite complex things like a topological sort are now achivable in ~30 lines.\nsee `traverser/examples/topo-sort`\n\n\n#API#\n\n  `traverser (obj, options)`\n  \n  obj: graph/tree to traverse\n  \n    options: (each of the following is optional)\n    {\n      branch: function to call on a branch of the tree (by default, where typeof == 'object'\n    , leaf: function to call on primitives and functions\n    , isBranch: return true if current value should be treated as a branch\n    }\n    \neach function is passed one arg, a properties object which describes the state of the traverse.\n  \n    {\n      value: this object\n    , parent: object which this item is a property of. (null if your on the root object)\n    , key: key of this item on parent. (null if your on the root object)\n    , path: [list of keys from root object to current item]\n    , reference: true if this object is a repeat\n    , circular: true if this object is in the ancestors list.\n    , seen: list of objects seen so far\n    , ancestors: list of objects between value and root object.\n\n    //when your in the branch function, you need to call one of the following to iterate over the children.\n    //none of these require an argument.\n\n    , each: iterate over each property\n    , find: iterate untill the first truthy return, returns the item.\n    , map: collects return values into an Array\n    , copy: copies objects, preserving whether it's a {} or a []\n    , max: iterate over all properties and return max return value\n    , min: iterate over all properties and return min return value\n    }\n\n###feel free to ask me questions if you need help!###\n\n###see https://github.com/dominictarr/trees for more examples.###\n\n##License\n\nMit/Apache2\n","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}]},"0.0.5":{"name":"traverser","description":"lib for traversing trees and graphs","version":"0.0.5","homepage":"https://github.com/dominictarr/traverser","repository":{"type":"git","url":"git://github.com/dominictarr/traverser.git"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"dependencies":{"curry":"0.0.x"},"engines":{"node":"*"},"_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"_id":"traverser@0.0.5","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.23","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"c66f38c456a0c21a88014b1223580c7ebe0631eb","tarball":"https://registry.npmjs.org/traverser/-/traverser-0.0.5.tgz","integrity":"sha512-8wq1H/gNr1PwGhmflklBTvZlY3aOgUmurSYD8PueKn1Btq01REtupQ8nY7VpcG4v2YPKBODxYKIdTt36W+Scwg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFy6KfhbR7d1RXEzYL5isrSrlL1753n8YSXW7cDVBTTqAiAXm/lZvniTAoTl2RSvOKpOl8FDdLv2CHp0tPYoqeadtg=="}]},"readme":"\n#Traverser#\n\nsearch through a complex object (nearly) as easily as forEach\n\nall the nitty-gritty stuff is taken care of.\n\nincluding:\n  # checking for repeats.\n  # checking for cycles.\n  # getting the path the the current object. etc!\n\n#simple example#\ncollect all branches in a tree.\n\n    var traverser = require('traverser')\n      , branches = []\n\n    function branch(props){\n      if(!props.reference) //since we check for references with will work in cyclic graphs, without stackoverflows.\n        branches.push(props.value)\n\n      props.each()//continue working through the children of this object.\n    }\n\n    traverser([1,2,{},3,[\"x\"]],{branch: branch})\n    \n    console.log(branches)\n\n#simple example2#\ncollect all leaves in a tree. (only functions and primitives)\n\n    var traverser = require('traverser')\n\n    exports.leaves = leaves\n\n    function leaves (obj){\n        var leaves = []\n\n        function leaf(props){\n          leaves.push(props.value)\n        }\n\n        traverser(obj,{leaf: leaf})\n        return leaves\n    }\n\n    traverser([1,2,{},3,[\"x\"]],{leaf: leaves})\n\n    console.log(leaves([1,2,{},3,[\"x\"]]))\n    //[1,2,3,'x']\n    \n#complex example#\neven quite complex things like a topological sort are now achivable in ~30 lines.\nsee `traverser/examples/topo-sort`\n\n\n#API#\n\n  `traverser (obj, options)`\n  \n  obj: graph/tree to traverse\n  \n    options: (each of the following is optional)\n    {\n      branch: function to call on a branch of the tree (by default, where typeof == 'object'\n    , leaf: function to call on primitives and functions\n    , isBranch: return true if current value should be treated as a branch\n    }\n    \neach function is passed one arg, a properties object which describes the state of the traverse.\n  \n    {\n      value: this object\n    , parent: object which this item is a property of. (null if your on the root object)\n    , key: key of this item on parent. (null if your on the root object)\n    , path: [list of keys from root object to current item]\n    , reference: true if this object is a repeat\n    , circular: true if this object is in the ancestors list.\n    , seen: list of objects seen so far\n    , ancestors: list of objects between value and root object.\n\n    //when your in the branch function, you need to call one of the following to iterate over the children.\n    //none of these require an argument.\n\n    , each: iterate over each property\n    , find: iterate untill the first truthy return, returns the item.\n    , map: collects return values into an Array\n    , copy: copies objects, preserving whether it's a {} or a []\n    , max: iterate over all properties and return max return value\n    , min: iterate over all properties and return min return value\n    }\n\n###feel free to ask me questions if you need help!###\n\n###see https://github.com/dominictarr/trees for more examples.###\n\n##License\n\nMit/Apache2\n","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{}}},"maintainers":[{"email":"nopersonsmodules@gmail.com","name":"nopersonsmodules"}],"time":{"modified":"2022-06-27T20:37:36.328Z","created":"2011-02-07T11:07:09.785Z","0.0.0":"2011-02-07T11:07:10.532Z","0.0.1":"2011-02-07T11:08:18.951Z","0.0.2-1":"2011-05-24T06:25:56.241Z","0.0.2-2":"2011-05-24T16:59:26.419Z","1.0.0":"2011-06-25T16:27:48.336Z","0.0.4":"2012-06-13T03:24:35.007Z","0.0.5":"2012-06-13T03:29:28.023Z"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"repository":{"type":"git","url":"git://github.com/dominictarr/traverser.git"}}