Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

utile

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utile - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

56

lib/index.js

@@ -10,7 +10,21 @@ /*

var fs = require('fs'),
path = require('path');
path = require('path'),
util = require('util');
var utile = exports;
var utile = module.exports;
//
// Extend the `utile` object with all methods from the
// core node `util` methods.
//
// Remark: Somehow copying `util.inspect` makes the `utile`
// object `2`. See: https://github.com/joyent/node/issues/2225
//
Object.keys(util).forEach(function (key) {
if (key !== 'inspect') {
utile[key] = util[key];
}
});
//
// @async {Object}

@@ -69,3 +83,3 @@ // Simple wrapper to `require('async')`.

//
exports.each = function (obj, iterator) {
utile.each = function (obj, iterator) {
Object.keys(obj).forEach(function (key) {

@@ -80,3 +94,3 @@ iterator(obj[key], key, obj);

//
exports.find = function (obj, pred) {
utile.find = function (obj, pred) {
var value, key;

@@ -149,2 +163,3 @@

});
return target;

@@ -154,14 +169,2 @@ };

//
// ### function clone (object)
// #### @object {Object} Object to clone
// Shallow clones the specified object.
//
utile.clone = function (object) {
return Object.keys(object).reduce(function (obj, k) {
obj[k] = object[k];
return obj;
}, {});
};
//
// ### function capitalize (str)

@@ -212,5 +215,5 @@ // #### @str {string} String to capitalize

//
exports.filter = function (obj, pred) {
utile.filter = function (obj, pred) {
var copy = Array.isArray(obj) ? [] : {};
exports.each(obj, function (val, key) {
utile.each(obj, function (val, key) {
if (pred(val, key, obj)) {

@@ -231,3 +234,3 @@ copy[key] = val;

//
exports.requireDir = function (directory) {
utile.requireDir = function (directory) {
var result = {},

@@ -252,3 +255,3 @@ files = fs.readdirSync(directory);

//
exports.requireDirLazy = function (directory) {
utile.requireDirLazy = function (directory) {
var result = {},

@@ -269,6 +272,11 @@ files = fs.readdirSync(directory);

//
// Extend the `utile` object with all methods from the
// core node `util` methods
// ### function clone (object)
// #### @object {Object} Object to clone
// Shallow clones the specified object.
//
utile.mixin(utile, require('util'));
utile.clone = function (object) {
return Object.keys(object).reduce(function (obj, k) {
obj[k] = object[k];
return obj;
}, {});
};
{
"name": "utile",
"description": "A drop-in replacement for `util` with some additional advantageous functions",
"version": "0.0.8",
"version": "0.0.9",
"author": "Nodejitsu Inc <info@nodejitsu.com>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -28,4 +28,4 @@ # utile [![Build Status](https://secure.travis-ci.org/flatiron/utile.png)](http://travis-ci.org/flatiron/utile)

utile.each utile.error utile.exec utile.file utile.filter utile.find
utile.inherits utile.inspect utile.log utile.mixin utile.mkdirp utile.p
utile.path utile.print utile.pump utile.puts utile.randomString utile.rimraf
utile.inherits utile.log utile.mixin utile.mkdirp utile.p utile.path
utile.print utile.pump utile.puts utile.randomString utile.rimraf
```

@@ -35,2 +35,4 @@

**Remark:** The `util.inspect` method is not exposed in `utile` [until this issue is resolved](https://github.com/joyent/node/issues/2225).
## Methods

@@ -82,2 +84,2 @@ The `utile` modules exposes some simple utility methods:

[4]: https://vowsjs.org
[5]: https://npmjs.or
[5]: https://npmjs.org

@@ -32,3 +32,5 @@ /*

Object.keys(require('util')).forEach(function (fn) {
assert.isFunction(utile[fn]);
if (fn !== 'inspect') {
assert.isFunction(utile[fn]);
}
});

@@ -35,0 +37,0 @@ },

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