UNPKG

kitchensink

Version:

Dispatch's awesome components and style guide

75 lines (74 loc) 2.68 kB
{ "_args": [ [ "tryor@~0.1.2", "/Users/derekcaneja/Git/dispatch.me/kitchen/examples/node_modules/defs" ] ], "_from": "tryor@>=0.1.2 <0.2.0", "_id": "tryor@0.1.2", "_inCache": true, "_installable": true, "_location": "/tryor", "_npmUser": { "email": "olov.lassus@gmail.com", "name": "olov" }, "_npmVersion": "1.2.18", "_phantomChildren": {}, "_requested": { "name": "tryor", "raw": "tryor@~0.1.2", "rawSpec": "~0.1.2", "scope": null, "spec": ">=0.1.2 <0.2.0", "type": "range" }, "_requiredBy": [ "/defs" ], "_resolved": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz", "_shasum": "8145e4ca7caff40acde3ccf946e8b8bb75b4172b", "_shrinkwrap": null, "_spec": "tryor@~0.1.2", "_where": "/Users/derekcaneja/Git/dispatch.me/kitchen/examples/node_modules/defs", "author": { "email": "olov.lassus@gmail.com", "name": "Olov Lassus" }, "bugs": { "url": "https://github.com/olov/tryor/issues" }, "dependencies": {}, "description": "return fn() or default value (in case of exception)", "devDependencies": {}, "directories": {}, "dist": { "shasum": "8145e4ca7caff40acde3ccf946e8b8bb75b4172b", "tarball": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz" }, "homepage": "https://github.com/olov/tryor#readme", "keywords": [ "catch", "default", "try" ], "license": "MIT", "main": "tryor.js", "maintainers": [ { "name": "olov", "email": "olov.lassus@gmail.com" } ], "name": "tryor", "optionalDependencies": {}, "readme": "# tryor.js\nGive it a function and a default value. `tryor` will give you back the return value of\nthe function or, in case the function threw an exception, the default value.\nWorks in node and browsers.\n\n\n\n## Usage\n```javascript\n // do this\n var config = tryor(function() {\n return JSON.parse(userProvidedConfigString);\n }, {});\n\n // instead of\n var config; // or var config = {}; and empty catch\n try {\n config = JSON.parse(userProvidedConfigString);\n } catch (e) {\n config = {};\n }\n```\n\nWorks extra well with ES6-style `const` variables.\n\n\n\n## Installation\n\n### Node\nInstall using npm\n\n npm install tryor\n\n```javascript\nvar tryor = require(\"tryor\");\n```\n\n### Browser\nClone the repo and include it in a script tag\n\n git clone https://github.com/olov/tryor.git\n\n```html\n<script src=\"tryor/tryor.js\"></script>\n```\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/olov/tryor.git" }, "scripts": {}, "version": "0.1.2" }