Socket
Socket
Sign inDemoInstall

mz

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mz - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

coverage/coverage.json

44

_promisify.js
var promisify
try {
promisify = require('bluebird').promisify
} catch (_) {}
var Promise = require('native-or-bluebird')
if (promisify) {
module.exports = function mz_promisify(name, fn) {
return promisify(fn)
}
} else {
if (typeof Promise !== 'function') {
console.error()
console.error('mz: a `Promise` implementation could not be found.')
console.error('mz: please use a version of node that has native Promises')
console.error('mz: or `npm i bluebird`')
console.error()
process.exit(1)
}
module.exports = function mz_promisify(name, fn) {
return eval('(function ' + name + '() {\n'
+ 'var len = arguments.length\n'
+ 'var args = new Array(len + 1)\n'
+ 'for (var i = 0; i < len; ++i) args[i] = arguments[i]\n'
+ 'var lastIndex = i\n'
+ 'return new Promise(function (resolve, reject) {\n'
+ 'args[lastIndex] = makeCallback(resolve, reject)\n'
+ 'fn.apply(null, args)\n'
+ '})\n'
+ '})')
}
module.exports = function mz_promisify(name, fn) {
return eval('(function ' + name + '() {\n'
+ 'var len = arguments.length\n'
+ 'var args = new Array(len + 1)\n'
+ 'for (var i = 0; i < len; ++i) args[i] = arguments[i]\n'
+ 'var lastIndex = i\n'
+ 'return new Promise(function (resolve, reject) {\n'
+ 'args[lastIndex] = makeCallback(resolve, reject)\n'
+ 'fn.apply(null, args)\n'
+ '})\n'
+ '})')
}
module.exports.bluebird = !!promisify
function makeCallback(resolve, reject) {

@@ -38,0 +18,0 @@ return function(err, value) {

{
"name": "mz",
"description": "modernize node.js to current ECMAScript standards",
"version": "1.0.0",
"version": "1.0.1",
"author": {

@@ -13,3 +13,7 @@ "name": "Jonathan Ong",

"repository": "normalize/mz",
"dependencies": {
"native-or-bluebird": "1"
},
"devDependencies": {
"istanbul": "0",
"bluebird": "2",

@@ -19,4 +23,6 @@ "mocha": "1"

"scripts": {
"test": "mocha --reporter spec --bail"
"test": "mocha --reporter spec",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
}
}
# MZ - Modernize node.js
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![Gittip][gittip-image]][gittip-url]
Modernize node.js to current ECMAScript specifications!

@@ -90,1 +98,18 @@ node.js will not update their API to ES6+ [for a while](https://github.com/joyent/node/issues/7549).

[bluebird]: https://github.com/petkaantonov/bluebird
[npm-image]: https://img.shields.io/npm/v/mz.svg?style=flat-square
[npm-url]: https://npmjs.org/package/mz
[github-tag]: http://img.shields.io/github/tag/normalize/mz.svg?style=flat-square
[github-url]: https://github.com/normalize/mz/tags
[travis-image]: https://img.shields.io/travis/normalize/mz.svg?style=flat-square
[travis-url]: https://travis-ci.org/normalize/mz
[coveralls-image]: https://img.shields.io/coveralls/normalize/mz.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/normalize/mz?branch=master
[david-image]: http://img.shields.io/david/normalize/mz.svg?style=flat-square
[david-url]: https://david-dm.org/normalize/mz
[license-image]: http://img.shields.io/npm/l/mz.svg?style=flat-square
[license-url]: LICENSE.md
[downloads-image]: http://img.shields.io/npm/dm/mz.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/mz
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
[gittip-url]: https://www.gittip.com/jonathanong/

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc