Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Types
var _ = require('man');
_.type(null); // => null
Collections
var _ = require('man');
// Convert to array
_.arr(arguments);
// Filter values with certain type
_.filterType(list, 'string');
_.filterTypes(list, ['number', 'undefined']);
// Remove values with certain type
_.removeType(list, 'string');
_.removeTypes(list, ['number', 'undefined']);
// Create object with all properties set to true
_.flagger(['prop1', 'prop2']); // => { prop1: true, prop2: true }
// Improved iteration
_.for(list)
.check(function (value, i) {
if (_.type(value) === 'string') {
return false;
}
return true;
})
.catch(function (err) {
console.log(err.stack);
})
.each(function (value, i) {
// ...
})
.done(function () {
});
// Map collection to object
_.mapToObject(list, function (value, i) {
return {
name: 'item' + i,
value: value
};
});
Events
var _ = require('man');
var obj = {};
_.initEvents(obj);
obj.on('test', function (a, b) {
// ...
});
obj.emit('test', 1, 2);
Math
var _ = require('man');
// Random number
_.rand(min, max);
// Generates random unique key
_.randomKey([prefix]);
// Generates counter-based unique id
_.id([prefix]);
// Rounds number to top or bottom margin
_.roundMin(85, 20); // => 80
_.roundMax(85, 20); // => 100
Objects
var _ = require('man');
// Create new object with properties of received objects
_.collect(obj1, obj2, obj3);
// Extends `target` object with properties of `source`, replacing only undefined values
_.extendUndefined(target, source);
// Set `name` property of `obj` object recursively
var obj = {};
_.set(obj, 'prop1.prop2.prop3', true);
obj // => { prop1: { prop2: { prop3: true } } }
// Returns `name` property of `obj` object recursively
var obj = {
prop1: {
prop2: {
prop3: true
}
}
};
_.get(obj, 'prop1.prop2.prop3'); // => true
// Flattens object to flat structure
var obj = {
prop1: {
prop2: {
prop3: true
}
}
};
_.flat(obj);
obj // => { 'prop1.prop2.prop3': true }
// Defines object's properties (same as Object.defineProperty and Object.defineProperties)
_.define(obj, name, prop);
_.define(obj, props);
Strings
var _ = require('man');
// Removes HTML-tags from string
_.removeTags(str);
// Trim string by specified symbol
_.trim(str, symbol);
_.trimLeft(str, symbol);
_.trimRight(str, symbol);
/*
Search `sub` in `str` and returns array with objects {
content: String,
groups: Array,
length: Number,
start: Number,
finish: Number
}
*/
_.search(str, sub, ignoreCase);
// Replace all found `sub` in `str` with `source`
_.replace(str, sub, source, ignoreCase)
// Same as `search` but returns `false` if nothing found
_.find(str, sub, ignoreCase);
// Capitalizes string
_.capitalize(str);
// Decode ASCII string
_.decodeChars(buffer);
// Decode Unicode string
_.decodeUnicode(buffer);
Builder
var _ = require('man');
_.buildClient('index.js', {
// Output filename
output: 'app.min.js',
// Babel-transform ECMAScript6-features
transform: true,
// Minify source
min: true
}).then(function (source) {
// ...
});
FS
var _ = require('man');
// Create new random temp directory name
_.tmpDir()
// Create new random temp filename
_.tmpFile(prefix)
// Read & write files
_.read(filename, isBin)
_.readb(filename)
_.write(filename, content)
_.copy(from, to)
_.copyStream(from, to).then
_.remove(filename)
// Test filenames
_.exists(filename)
_.isFile(filename)
_.isDir(filename)
_.firstExists(filenames, dirname, onlyFiles)
_.firstExistsFile(filenames, dirname)
CML
var _ = require('man');
_.cmlDump(dir, {
output: filename
});
_.cmlDir(dir);
_.cmlFile(filename);
CML
_.cmlLoadUrl(url).then(function (data) {
// ...
});
Request
_.get(url)
.then(function (content) {
// ...
});
_.getJSON(url)
.then(function (data) {
// ...
});
FAQs
Web Manager for Github Projects and Issues
The npm package man receives a total of 31 weekly downloads. As such, man popularity was classified as not popular.
We found that man demonstrated a not healthy version release cadence and project activity because the last version was released 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.