-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.json
More file actions
30 lines (30 loc) · 2.15 KB
/
Copy pathpackage.json
File metadata and controls
30 lines (30 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
"name": "try",
"version": "0.13.3",
"description": "Async try / catch",
"main": "Try.js",
"scripts": {
"test": "jasmine-node spec/"
},
"repository": {
"type": "git",
"url": "git@github.com:finalclass/try.js.git"
},
"author": {
"name": "Szymon Wygnański",
"email": "s@finalclass.net"
},
"license": "MIT",
"dependencies": {},
"devDependencies": {
"jasmine-node": "~1.10.2"
},
"readme": "# Try.js\r\n\r\nExamples are the best source of documentation - read spec/ directory content to find some of those.\r\n\r\n## install\r\n\r\n```bash\r\nnpm install try\r\n```\r\n\r\n## async usage (read directory content)\r\n\r\n```js\r\n\r\nvar Try = require('try'),\r\n fs = require('fs');\r\n\r\nnew Try\r\n (function () {\r\n //this.pause() method returns a \"resume\" callback and pauses current execution.\r\n fs.readdir('./spec', this.pause());\r\n })\r\n (function (err, files) {\r\n if (err) { throw err; }\r\n var next = this.pause(files.length);\r\n\r\n files.forEach(function (file) {\r\n console.log('file', file);\r\n fs.readFile('./spec/' + file, next);\r\n });\r\n })\r\n (function () {\r\n return Array.prototype.map.call(arguments, function (args) {\r\n return args[1].toString();\r\n }).join('');\r\n })\r\n (function (result) {\r\n dirContent = result;\r\n })\r\n .catch(function (err) {\r\n console.log('catch', err.stack);\r\n })\r\n .run();\r\n```\r\n\r\n## sync usage\r\n\r\n```js\r\nvar Try = require('try'),\r\n result = 0;\r\n\r\nnew Try\r\n (function () {\r\n return 1;\r\n })\r\n (function (n) {\r\n return n + 1;\r\n })\r\n (function (n) {\r\n return n * 2;\r\n })\r\n (function (n) {\r\n result = n;\r\n })();\r\n\r\nexpect(result).toBe(4);\r\n```\r\n\r\n## more examples\r\n\r\nFor more examples check out the spec/ directory",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/finalclass/try.js/issues"
},
"homepage": "https://github.com/finalclass/try.js",
"_id": "try@0.4.0",
"_from": "try@"
}