Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@ansi-art/async-context
Advanced tools
Readme
A construct for chainable contexts which use async functions compatible with callbacks or promises.
Assuming we have an object with a function that takes an object and returns a transformed version of that object:
let str ='';
const myObject = {
foo: (item, callback)=>{
str += `foo ${str}`
callback(null, str);
}
};
Take that object and make a context using it:
import { asyncContext } from '@ansi-art/async-context';
const context = asyncContext(myObject);
const value = await context.foo().foo().foo();
// value === "foo foo foo"
kitchen-sync
kitchen-sync
allows you to support both callbacks and promises with no stack fragmentation in the event callbacks are used, allowing for simpler debugging internally to a set of libraries, for example, but allowing external use of more modern idioms.
import { kitchenSync } from `@ansi-art/async-context/kitchen-sync`;
(async ()=>{
const fn = (arg, cb){
const callback = kitchenSync(cb);
someFunctionThatTakesCallbacks(callback);
return callback.return;
}
const result = await fn(someArgValue);
})();
That's all.
Run the es module tests to test the root modules
npm run import-test
to run the same test inside the browser:
npm run browser-test
to run the same test headless in chrome, firefox and safari:
npm run headless-browser-test
to run the same test inside docker:
npm run container-test
Run the commonjs tests against the /dist
commonjs source (generated with the build-commonjs
target).
npm run require-test
All work is done in the .mjs files and will be transpiled on commit to commonjs and tested.
If the above tests pass, then attempt a commit which will generate .d.ts files alongside the src
files and commonjs classes in dist
FAQs
A construct for chainable contexts
The npm package @ansi-art/async-context receives a total of 1 weekly downloads. As such, @ansi-art/async-context popularity was classified as not popular.
We found that @ansi-art/async-context demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.