{"_id":"or","_rev":"7-37c06606cfe9351c6980369728d49110","name":"or","description":"Returns an element from an array when it matches a condition","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"or","description":"Returns an element from an array when it matches a condition","version":"0.1.0","keywords":["array","utils"],"author":{"name":"Florian Margaine","email":"florian@margaine.com","url":"http://margaine.com"},"main":"lib/or","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/Ralt/or.git"},"bugs":{"url":"https://github.com/Ralt/or/issues"},"readme":"Returns the element of an array when the callback returns true.\n\nPurpose\n---\n\nThis module provides a similar function as `Array.prototype.filter`, but\nit returns the element, not an array. And it stops looping as soon as it\nfinds a result.\n\nUsage\n---\n\n```javascript\nvar arr = ['item', 'other', 'finally'];\n\nvar item = or(arr, function(item) {\n    return item === 'other';\n});\n\nconsole.log(item); // \"other\"\n\n// Real world example\nvar matchesSelector = function() {\n    var shims = ['matchesSelector', 'mozMatchesSelector',\n        'webkitMatchesSelector', 'oMatchesSelector', 'msMatchesSelector'];\n\n    return or(shims, function(shim) {\n        return shim in document;\n    });\n}();\n\ndocument.getElementById('some')[matchesSelector]('#some'); // true\n```\n\nAPI\n---\n\nThe module returns a function accepting the following arguments:\n\n- `array`: the array on which to iterate\n- `callback`: the function being called\n- `context`: the context on which to call the callback\n\nContributors\n---\n\n- [Florian Margaine](http://margaine.com)\n\nLicense\n---\n\nMIT License.\n","readmeFilename":"README.md","_id":"or@0.1.0","dist":{"shasum":"314ea1bd9cceec03a1a72ffccffd832080990eda","tarball":"https://registry.npmjs.org/or/-/or-0.1.0.tgz","integrity":"sha512-syHctjhyszZm10TK0Bod5N6zKxOrxCV1JkynpAXDyST96+cqrikCTHijVLDEGDRyz7rbmv4jquOWbMxfBvWsNA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFfGrpBCOzx5PrNoJhW0k0BHeqosf/xC/J0HlW1RmPIJAiEAyM0zL1a4653J9bCPsgdYZ2Q4VOgDg+jFd7F7vFVG8/M="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"ralt","email":"florian@margaine.com"},"maintainers":[{"name":"ralt","email":"florian@margaine.com"}]},"0.2.0":{"name":"or","description":"Returns an element from an array when it matches a condition","version":"0.2.0","keywords":["array","utils"],"author":{"name":"Florian Margaine","email":"florian@margaine.com","url":"http://margaine.com"},"main":"lib/or","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/Ralt/or.git"},"bugs":{"url":"https://github.com/Ralt/or/issues"},"readme":"Returns the element of an array when the callback returns true.\n\nPurpose\n---\n\nThis module provides a similar function as `Array.prototype.filter`, but\nit returns the element, not an array. And it stops looping as soon as it\nfinds a result.\n\nUsage\n---\n\n```javascript\nvar arr = ['item', 'other', 'finally'];\n\nvar item = or(arr, function(item) {\n    return item === 'other';\n});\n\nconsole.log(item); // \"other\"\n\n// Real world example\nvar matchesSelector = or(['matchesSelector', 'mozMatchesSelector',\n    'webkitMatchesSelector', 'oMatchesSelector',\n    'msMatchesSelector'], function(shim) {\n    return shim in document.documentElement;\n});\n\ndocument.getElementById('some')[matchesSelector]('#some'); // true\n```\n\nAPI\n---\n\nThe module returns a function accepting the following arguments:\n\n- `array`: the array on which to iterate\n- `callback`: the function being called\n- `context`: the context on which to call the callback\n\nContributors\n---\n\n- [Florian Margaine](http://margaine.com)\n\nLicense\n---\n\nMIT License.\n","_id":"or@0.2.0","dist":{"shasum":"9904ea61e25943f935e20f4f4749e0a141a82b6a","tarball":"https://registry.npmjs.org/or/-/or-0.2.0.tgz","integrity":"sha512-BHB8VZq2isxkyRaCBZ6CZCbQBzCT+gy8LPiqdbMH1+Fd6biFj3v8ebjeYzzL51PbsApsPYnGegGTO6KLQMxxDw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCY7SMG+8QxFpTQg55sap8+tgyJMRQtGhVhOZQt2MyLkwIgHu2T57sy5q40nXcGAPSjkF9HGYrwBMOGETZnh8axStQ="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"ralt","email":"florian@margaine.com"},"maintainers":[{"name":"ralt","email":"florian@margaine.com"}]}},"readme":"Returns the element of an array when the callback returns true.\n\nPurpose\n---\n\nThis module provides a similar function as `Array.prototype.filter`, but\nit returns the element, not an array. And it stops looping as soon as it\nfinds a result.\n\nUsage\n---\n\n```javascript\nvar arr = ['item', 'other', 'finally'];\n\nvar item = or(arr, function(item) {\n    return item === 'other';\n});\n\nconsole.log(item); // \"other\"\n\n// Real world example\nvar matchesSelector = function() {\n    var shims = ['matchesSelector', 'mozMatchesSelector',\n        'webkitMatchesSelector', 'oMatchesSelector', 'msMatchesSelector'];\n\n    return or(shims, function(shim) {\n        return shim in document;\n    });\n}();\n\ndocument.getElementById('some')[matchesSelector]('#some'); // true\n```\n\nAPI\n---\n\nThe module returns a function accepting the following arguments:\n\n- `array`: the array on which to iterate\n- `callback`: the function being called\n- `context`: the context on which to call the callback\n\nContributors\n---\n\n- [Florian Margaine](http://margaine.com)\n\nLicense\n---\n\nMIT License.\n","maintainers":[{"name":"ralt","email":"florian@margaine.com"}],"time":{"modified":"2022-06-23T01:30:57.692Z","created":"2013-02-26T20:57:58.952Z","0.1.0":"2013-02-26T20:58:01.062Z","0.2.0":"2013-02-27T08:03:46.625Z"},"author":{"name":"Florian Margaine","email":"florian@margaine.com","url":"http://margaine.com"},"repository":{"type":"git","url":"https://github.com/Ralt/or.git"}}