Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "asyncy", | ||
"version": "0.0.5", | ||
"description": "A utility for creating aysnc functions", | ||
"engines": {}, | ||
"license": "MIT", | ||
"version": "0.0.6", | ||
"description": "The Asyncy node module. Helpers library to interact with the asyncy ecosystem", | ||
"main": "asyncy.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/anywhichway/asyncy.git" | ||
"url": "git+https://github.com/asyncy/asyncy-node.git" | ||
}, | ||
"keywords": [ | ||
"asyncy", | ||
"node" | ||
], | ||
"author": "Simon Y. Blackwell <syblackwell@anywhichway.com> (http://www.github.com/anywhichway)", | ||
"author": "Asyncy", | ||
"license": "", | ||
"bugs": { | ||
"url": "https://github.com/anywhichway/asyncy/issues" | ||
"url": "https://github.com/asyncy/asyncy-node/issues" | ||
}, | ||
"homepage": "https://github.com/anywhichway/asyncy#readme", | ||
"devDependencies": { | ||
}, | ||
"dependencies": { | ||
} | ||
} | ||
"homepage": "https://github.com/asyncy/asyncy-node#readme" | ||
} |
104
README.md
@@ -1,100 +0,8 @@ | ||
# asyncy | ||
A utility for creating aysnc functions. | ||
# Push Events To Asyncy in Node | ||
NOTE: There is now a company called Asyncy. They are doing pretty cool stuff with microservices. To avoid confusion and trademark issues, this GitHUb repository and the associated NPM packages are being moved over to their control. | ||
# Usage | ||
npm install asyncy | ||
The code is not transpiled for ES5 or lower and requires support of async/await ... which is kind of the point. The intent is to support converting callback or Promise based code to async/await code. If your target environment does not support async/await, you could use this as part of a project that you would then transpile in its entirety. | ||
The current releases of Chrome, Firefox, Edge, and Node.js support the raw, un-transpiled code. | ||
## Inline Usage | ||
For the highest performance you can use `asyncy` inline like this: | ||
```javascript | ||
const asyncy = require('asyncy'); | ||
let output = asyncy.runSync(...); // synchronous | ||
// or | ||
let output = await asyncy.runAsyncy(...) // asynchronous | ||
``` | ||
const {err,result,args} = await asyncy.inline(fs,fs.readFile,"mystuff.json"); | ||
``` | ||
The first argument can either be `null` or the scope in which the function should be invoked, i.e. the `this` context. | ||
`err` will be `null` or an `Error` instance | ||
`result` will be `undefined` or an `Array` (in order to support callbacks that tak emultiple arguments). In most cases, the calling code will access result[0]. | ||
`args` will be the arguments that were provided. This is useful for debugging why an `Error` was generated. | ||
As should be evident from the above, `asyncy` is designed to `return` rather than `throw` errors in order to keep application logic a little cleaner. | ||
For those desiring `throw` behavior, just insert a throw below the `await`, e.g: | ||
``` | ||
const {err,result,args} = await asyncy.inline(fs,fs.readFile,"mystuff.json"); | ||
if(err) throw err; | ||
``` | ||
If the last argument to `asyncy.inline` is a function, it will be treated like a callback and called prior to `await` returning, e.g.: | ||
``` | ||
const {err,result,args} = await asyncy.inline(fs,fs.readFile,"mystuff.json",(err,arg1[,arg2...]) => { console.log(arg1,"allocated"); }); | ||
``` | ||
Note how the "normal" call signature will be used for the callback, if there are multiple arguments. | ||
For highly standardized functions that invoke callbacks with the signature `<cb>(err,result)`, like `fs.readFile`, it is unlikely one would do the above; however, if | ||
there is an existing code-base with complex code in a callback, it may be more convenient to execute the code in the callback rather | ||
that move it to a sequential step after the await like the below: | ||
``` | ||
const {err,result,args} = await asyncy.inline(fs,fs.readFile,"mystuff.json"); | ||
if(err) ... handle error ... | ||
console.log(result[0],"allocated"); | ||
``` | ||
## Redefining Functions | ||
To redefine functions, you can use `asyncy` like this: | ||
``` | ||
const readFile = asyncy(fs.readFile), | ||
{err,result,args} = await readFile("mystuff.json"); | ||
``` | ||
There is no contect provided at re-define time; however, it can be provided at invocation time, e.g. `readFile.call(scope,fileName)`. | ||
You can also `async` an entire object (`asyncy` will skip functions with names that end in the token "Sync", where "S" is capitalized.): | ||
``` | ||
fs = asyncy(fs,true), | ||
{err,result,args} = await fs.readFile("mystuff.json"); | ||
``` | ||
you can optionallly provide an output target when asyncing objects so as not to overwrite the methods on the object being asynced: | ||
``` | ||
const myfs = {}; | ||
asyncy(fs,true,myfs), | ||
{err,result,args} = await myfs.readFile("mystuff.json"); | ||
``` | ||
# Release History (reverse chronological order) | ||
2018-06-23 v0.0.5 Transfering ownership to asyncy.com | ||
2017-07-07 v0.0.4 Codacy driven style, error and security improvements. | ||
2017-06-03 v0.0.3 improved documentation | ||
2017-06-03 v0.0.2 Simplified code, added documentation | ||
2017-06-02 Initial public release |
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
async |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
764
2
1
1
0
3
9
1
2