New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

man

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

man - npm Package Compare versions

Comparing version 0.0.4 to 1.0.0

.npmignore

72

lib/index.js

@@ -1,44 +0,30 @@

var CallbackMan = require('./callback'),
LineMan = require('./line'),
ParallelMan = require('./parallel'),
ListMan = require('./list'),
AsyncListMan = require('./async_list'),
NamesMan = require('./names');
'use strict';
module.exports = {
callback: function () {
return new CallbackMan();
},
do: function (handler) {
var self = this,
m = new LineMan();
m.do(handler);
return m;
},
doAsync: function (handler) {
var self = this,
m = new ParallelMan();
m.do(handler);
return m;
},
for: function () {
var self = this,
args = Array.prototype.slice.call(arguments, 0),
m = new ListMan();
m.for.apply(m, args);
return m;
},
forAsync: function () {
var self = this,
args = Array.prototype.slice.call(arguments, 0),
m = new AsyncListMan();
m.for.apply(m, args);
return m;
},
};
var modules = [
require('./cli'),
require('./code'),
require('./collections'),
require('./events'),
require('./fs'),
require('./functions'),
require('./logic'),
require('./math'),
require('./objects'),
require('./strings'),
require('./templates'),
require('./util')
];
modules.forEach(function (mod) {
extend(exports, mod);
});
function extend(target, source) {
Object.keys(source).forEach(function (name) {
if (target[name] && typeof target[name] === 'object') {
extend(target[name], source[name]);
return;
}
target[name] = source[name];
});
}
{
"name": "man",
"version": "0.0.4",
"description": "Provides a series of helper functions that allow you to perform asynchronous iteration and flow control.",
"version": "1.0.0",
"main": "./lib/index.js",
"directories": {
"test": "test"
"homepage": "https://tech.sencort.com",
"author": {
"name": "Denis Ivanov",
"email": "admin@sencort.com",
"url": "https://sencort.com"
},
"devDependencies": {
"tap": "*"
"dependencies": {
"babel-core": "^6.7.2",
"babel-preset-es2015": "^6.6.0",
"dot": "^1.0.3",
"jade": "^1.11.0",
"md5": "^2.1.0",
"os-tmpdir": "^1.0.1",
"stylus": "^0.54.2",
"uglify-js": "^2.6.2"
},
"repository": "https://github.com/jf7/man.git",
"keywords": [
"javascript",
"flow",
"callback"
],
"author": "jf7",
"license": "BSD"
"scripts": {
"build": "node --use_strict --harmony ./tools/build.js"
},
"repository": {
"type": "git",
"url": "git@dev.sencort.com:cort/man.git"
}
}

@@ -1,94 +0,1 @@

man
================================================================================
Node.js package. Provides a series of helper functions that allow you to perform asynchronous iteration and flow control.
Installation
--------------------------------------------------------------------------------
npm install man
Callbacks aggregation
--------------------------------------------------------------------------------
If you want to receive results of several callbacks at the same time, use `callback()` method:
```js
var fs = require('fs'),
man = require('man'),
cb = man.callback();
fs.readFile('file1.txt', cb.callback);
fs.readFile('file2.txt', cb.callback);
cb.on(function (err, content) {
// On each callback.
});
cb.done(function (result1, result2) {
// When all callbacks have received the results.
});
```
Serial execution
--------------------------------------------------------------------------------
```js
var man = require('man');
man.do(function () {
fs.readFile('file1.txt', this.next);
}).do(function (err, content) {
fs.readFile('file2.txt', this.next);
}).do(function (err, content) {
// ...
});
```
Parallel execution
--------------------------------------------------------------------------------
```js
var man = require('man');
man.doAsync(function () {
// ...
this.done(result1);
}).do(function () {
// ...
this.done(result2);
}).then(function (result1, result2) {
// ...
});
```
Iterations
--------------------------------------------------------------------------------
### Serial iterations
```js
var man = require('man');
man.for([1, 2, 3, 4, 5]).do(function (number) {
// On each item.
this.done(number + 1);
}).then(function (results) {
// When all items have processed.
console.log(results); // [2, 3, 4, 5, 6]
});
```
### Parallel iterations
```js
var man = require('man');
man.forAsync([1, 2, 3, 4, 5]).do(function (number) {
// On each item.
this.done(number + 1);
}).then(function (results) {
// When all items have processed.
console.log(results); // [2, 3, 4, 5, 6]
});
```
# Man
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