{"name":"bower-endpoint-parser","version":"0.2.1","description":"Little module that helps with endpoints parsing.","author":{"name":"Twitter"},"licenses":[{"type":"MIT","url":"https://github.com/bower/endpoint-parser/blob/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/bower/endpoint-parser.git"},"main":"index.js","engines":{"node":">=0.8.0"},"devDependencies":{"expect.js":"~0.2.0","mocha":"~1.12.0","mout":"~0.6.0"},"scripts":{"test":"mocha -R spec"},"bugs":{"url":"https://github.com/bower/endpoint-parser/issues"},"_id":"bower-endpoint-parser@0.2.1","dist":{"shasum":"8c4010a2900cdab07ea5d38f0bd03e9bbccef90f","tarball":"http://registry-npm.ywwl.com/bower-endpoint-parser/download/bower-endpoint-parser-0.2.1.tgz","integrity":"sha512-Hn0mrtju2JFNMLDrseDbcc17kSJyj/KrkrrjIb1gPinqx2Nr3g/J5j43clUdQLOvT3QeuhpP1C29qTACSJKI5Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5PoAbp34AeBeDhGUB0z/D1TRWLepK3cQ74a3mKq6MEAIgdxkiFxTRECllhUI8ohxc6YLEYhFtXneLAUABiooW0Gg="}],"size":4854,"noattachment":false,"key":"/bower-endpoint-parser/-/bower-endpoint-parser-0.2.1.tgz"},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"directories":{},"readme":"# endpoint-parser [![Build Status](https://secure.travis-ci.org/bower/endpoint-parser.png?branch=master)](http://travis-ci.org/bower/endpoint-parser)\n\nLittle module that helps with endpoints parsing.\n\n\n## API\n\n### .decompose(endpoint)\n\nDecomposes a endpoint into `name`, `source` and `target`.\n\n```js\nvar endpointParser = require('bower-endpoint-parser');\n\nendpointParser.decompose('jquery#~2.0.0');\n// { name: '', source: 'jquery', target: '~2.0.0' }\n\nendpointParser.decompose('backbone=backbone-amd#~1.0.0');\n// { name: 'backbone', source: 'backbone-amd', target: '~1.0.0' }\n\nendpointParser.decompose('http://twitter.github.io/bootstrap/assets/bootstrap.zip');\n// { name: '', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' }\n\nendpointParser.decompose('bootstrap=http://twitter.github.io/bootstrap/assets/bootstrap.zip');\n// { name: 'bootstrap', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' }\n```\n\n### .compose(decEndpoint)\n\nInverse of `decompose()`.   \nTakes a decomposed endpoint and composes it back into a string.\n\n```js\nvar endpointParser = require('bower-endpoint-parser');\n\nendpointParser.compose({ name: '', source: 'jquery', target: '~2.0.0' });\n// jquery#~2.0.0\n\nendpointParser.compose({ name: 'backbone', source: 'backbone-amd', target: '~1.0.0' });\n// backbone=backbone-amd#~1.0.0\n\nendpointParser.compose({ name: '', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' });\n// http://twitter.github.io/bootstrap/assets/bootstrap.zip\n\nendpointParser.compose({ name: 'bootstrap', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' });\n// bootstrap=http://twitter.github.io/bootstrap/assets/bootstrap.zip\n```\n\n### .json2decomposed(key, value)\n\nSimilar to `decompose()` but specially designed to be used when parsing `bower.json` dependencies.\nFor instance, in a `bower.json` like this:\n\n```js\n{\n    \"name\": \"foo\",\n    \"version\": \"0.1.0\",\n    \"dependencies\": {\n        \"jquery\": \"~1.9.1\",\n        \"backbone\": \"backbone-amd#~1.0.0\",\n        \"bootstrap\": \"http://twitter.github.io/bootstrap/assets/bootstrap\"\n    }\n}\n```\n\nYou would call `json2decomposed` like so:\n\n```js\nendpointParser.json2decomposed('jquery', '~1.9.1');\n// { name: 'jquery', source: 'jquery', target: '~1.9.1' }\n\nendpointParser.json2decomposed('backbone', 'backbone-amd#~1.0.0');\n// { name: 'backbone', source: 'backbone-amd', target: '~1.0.0' }\n\nendpointParser.json2decomposed('bootstrap', 'http://twitter.github.io/bootstrap/assets/bootstrap');\n// { name: 'bootstrap', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' }\n```\n\n### .decomposed2json(decEndpoint)\n\nInverse of `json2decomposed()`.   \nTakes a decomposed endpoint and composes it to be saved to `bower.json`.\n\n```js\nvar endpointParser = require('bower-endpoint-parser');\n\nendpointParser.decomposed2json({ name: 'jquery', source: 'jquery', target: '~2.0.0' });\n// { jquery: '~2.0.0' }\n\nendpointParser.decomposed2json({ name: 'backbone', source: 'backbone-amd', target: '~1.0.0' });\n// { backbone: 'backbone-amd#~2.0.0' }\n\nendpointParser.decomposed2json({ name: 'bootstrap', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' });\n// { bootstrap: 'http://twitter.github.io/bootstrap/assets/bootstrap' }\n```\n\nThis function throws an exception if the `name` from the decomposed endpoint is empty.\n\n\n## License\n\nReleased under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n","publish_time":1377031758786,"_cnpm_publish_time":1377031758786,"dist-tags":{"latest":"0.2.2"}}