+1
-1
| { | ||
| "name": "righto", | ||
| "version": "2.5.2", | ||
| "version": "2.5.3", | ||
| "main": "index.js", | ||
@@ -5,0 +5,0 @@ "directories": { |
+7
-92
@@ -17,2 +17,8 @@ # Righto | ||
| ## Who's using it? | ||
| <img src="https://s.yimg.com/ao/i/mp/properties/multipass/img/plus7/channel-logo-seven.png" alt="7Tennis" height="70px"/> Used in the backend of https://7tennis.com.au/, which handled 800k concurrent users for the early 2017 season. | ||
| <img src="https://securetenant.com.au/images/st-logo4.svg" alt="Secure tenent" height="70px"/> Used everywhere in the backend and frontend of https://securetenant.com.au/ | ||
| ## example: | ||
@@ -153,38 +159,2 @@ | ||
| ## Immediately execute | ||
| You can force a righto task for run at any time without dealing with the results (or error) by calling | ||
| it with no arguments: | ||
| ``` | ||
| // Lazily resolve (won't run untill called) | ||
| var something = righto(getSomething); | ||
| // Force something to start resolving *now* | ||
| something(); | ||
| // later ... | ||
| something(function(error, result){ | ||
| // handle error or use result. | ||
| }); | ||
| ``` | ||
| Also, since righto tasks return themselves when called, you can do this a little more shorthand, like so: | ||
| ``` | ||
| // Immediately force the righto to begin resolving. | ||
| var something = righto(getSomething)(); // <= note the call with no arguments. | ||
| // later ... | ||
| something(function(error, result){ | ||
| // handle error or use result. | ||
| }); | ||
| ``` | ||
| ## Take / Multiple results | ||
@@ -288,58 +258,3 @@ | ||
| ## All | ||
| righto.reduce takes N tasks, or an Array of tasks as the first argument, | ||
| resolves them from left-to-right, optionally passing the result of the last, and the next task to a reducer. | ||
| If no reducer is passed, the tasks will be resolved in series, and the final tasks result will be passed as the result from reduce. | ||
| If a reducer is used, a seed can optionally be passed as the third parameter. | ||
| No reducer passed: | ||
| ```javascript | ||
| function a(callback){ | ||
| aCalled = true; | ||
| t.pass('a called'); | ||
| callback(null, 1); | ||
| } | ||
| function b(callback){ | ||
| t.ok(aCalled, 'b called after a'); | ||
| callback(null, 2); | ||
| } | ||
| var result = righto.reduce([a, b]); | ||
| result(function(error, finalResult){ | ||
| // finalResult === 2 | ||
| }); | ||
| ``` | ||
| With a custom reducer, and seed. | ||
| ``` | ||
| function a(last, callback){ | ||
| aCalled = true; | ||
| t.pass('a called'); | ||
| callback(null, last); | ||
| } | ||
| function b(last, callback){ | ||
| t.ok(aCalled, 'b called after a'); | ||
| callback(null, last + 2); | ||
| } | ||
| // Passes previous eventual result to next reducer call. | ||
| var result = righto.reduce( | ||
| [a, b], | ||
| function(result, next){ // Reducer | ||
| return righto(next, result); | ||
| }, | ||
| 5 // Seed | ||
| ); | ||
| result(function(error, finalResult){ | ||
| // finalResult === 7 | ||
| }); | ||
| ``` | ||
| ## Sync | ||
@@ -729,2 +644,2 @@ | ||
| ``` | ||
| ``` |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
62165
-2.43%642
-11.57%