Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Execute a function ambidextrously (normalizes the differences between synchronous and asynchronous functions). Useful for treating synchronous functions as asynchronous functions (like supporting both synchronous and asynchronous event definitions automat
Execute a function ambidextrously (normalizes the differences between synchronous and asynchronous functions). Useful for treating synchronous functions as asynchronous functions (like supporting both synchronous and asynchronous event definitions automatically).
npm install --save ambi
require('ambi')
npm install --save ambi
require('ambi')
//wzrd.in/bundle/ambi@3.2.0
ender add ambi
require('ambi')
This package is published with the following editions:
ambi
aliases ambi/index.js
which uses Editions to automatically select the correct edition for the consumers environmentambi/source/index.js
is esnext source code with require for modulesambi/edition-browsers/index.js
is esnext compiled for browsers with require for modulesambi/edition-node-0.8/index.js
is esnext compiled for node.js 0.8 with require for modules// Import
const ambi = require('ambi')
let result = null
// Sample methods
function syncMethod (x, y) {
return x * y
}
function asyncMethod (x, y, next) {
return setTimeout(function () {
next(null, x * y)
}, 0)
}
// Call the synchronous function asynchronously
// ambi adds support for this asynchronous callback automatically
result = ambi(syncMethod, 5, 2, function (err, result) {
console.log(err, result) // null, 10
})
console.log(result) // 10 - just like normal
// Call the asynchronous function asynchronously
// ambi doesn't do anything special here
result = ambi(asyncMethod, 5, 2, function (err, result) {
console.log(err, result) // null, 10
})
console.log(result) // setTimeout - just like normal
(method, ...args)
method
is the function to execute...args
is the arguments to send to the method
(err, ...results)
err
argumenterr
argument equal to null, and a result
argument equal to the returned result of the synchronous methodDiscover the release history by heading on over to the HISTORY.md
file.
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
Unless stated otherwise all works are:
and licensed under:
v3.2.0 2018 December 7
FAQs
Ambi lets you execute any function ambidextrously; providing you the ability to execute any function (be it synchronous, asynchronous, returns, callbacks, promises) as if it returned a promise.
The npm package ambi receives a total of 68,417 weekly downloads. As such, ambi popularity was classified as popular.
We found that ambi 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.