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

wodge

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wodge - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

boil.hbs

82

lib/wodge.js

@@ -15,6 +15,3 @@ "use strict";

exports.each = each;
exports.symbol = {
tick: process.platform === "win32" ? "\u221A" : "✔︎",
cross: process.platform === "win32" ? "\u00D7": "✖"
};
exports.symbol = symbol;
exports.bytesToSize = bytesToSize;

@@ -34,3 +31,3 @@ exports.getHomeDir = getHomeDir;

Merge a list of objects, left to right, into one.
@method
@param {...Object} object - a sequence of Object instances to be extended
@example

@@ -51,2 +48,7 @@ w.extend({}, { one: 1, three: 3 }, { one: "one", two: 2 }, { four: 4 });

/**
Returns a copy of the input object
@param {Object} input - the object to clone
@returns {Object}
*/
function clone(obj){

@@ -60,8 +62,17 @@ var output = {};

/**
Returns a clone of the input object, minus the specified properties
@param {Object} input - the object to clone
@param {string[]} toOmit - an array of property names to omit from the clone
@returns {Object}
@example
w.omit({ one: 1, two: 2, three: 3, four: 4 }, [ "two", "four" ]);
// { one: 1, three: 3 }
*/
function omit(obj, toOmit){
toOmit = arrayify(toOmit);
var output = clone(obj);
for (var prop in toOmit){
delete output[prop];
}
toOmit.forEach(function(omit){
delete output[omit];
});
return output;

@@ -72,5 +83,5 @@ }

escape special regular expression characters
@method
@example
w.escapeRegExp("(.*)"); // => '\\(\\.\\*\\)'
w.escapeRegExp("(.*)");
// '\\(\\.\\*\\)'
*/

@@ -83,24 +94,22 @@ function escapeRegExp(string){

/**
THIS IS AWFUL.. what difference to Object.keys(array.filter(test))?
return an array containing the property names of `object` which pass the test function
@method
/**
Plucks the value of the specified property from each object in the input array
@param {Object[]} arrayOfObjects - the input array of objects
@param {...string} the property to pluck
@returns {Array}
@example
var obj = {
clive: 1,
hater: 3
};
var list = w.pluck(obj, function(val){ return val === 1});
// list is [ "clive" ]
*/
function pluck1(object, fn){
var output = [];
for (var prop in object){
if (fn(object[prop])) output.push(prop);
}
return output;
}
var data = [
{one: 1, two: 2},
{two: "two"},
{one: "one", two: "zwei"},
];
w.pluck(data, "one");
// [ 1, "one" ]
/**
return the first existing property
w.pluck(data, "two");
// [ 2, "two", "zwei" ]
w.pluck(data, "one", "two");
// [ 1, "two", "one" ]
*/

@@ -138,5 +147,7 @@ function pluck(arrayOfObjects, property, property2, property3){

Either:
* puts a single scalar in an array
* converts array-like object to a real array
* converts null or undefined to an empty array
- puts a single scalar in an array
- converts array-like object to a real array
- converts null or undefined to an empty array
*/

@@ -310,1 +321,6 @@ function arrayify(arr){

}
var symbol = {
tick: process.platform === "win32" ? "\u221A" : "✔︎",
cross: process.platform === "win32" ? "\u00D7": "✖"
};
{
"name": "wodge",
"version": "0.6.0",
"version": "0.6.1",
"description": "a wodge of functional dough",

@@ -13,3 +13,16 @@ "main": "lib/wodge.js",

"test": "tape test/*.js"
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/6..latest",
"chrome/22..latest",
"firefox/16..latest",
"safari/latest",
"opera/11.0..latest",
"iphone/6",
"ipad/6",
"android-browser/latest"
]
}
}

@@ -0,1 +1,111 @@

[![view on npm](http://img.shields.io/npm/v/wodge.svg)](https://www.npmjs.org/package/wodge)
![npm module downloads per month](http://img.shields.io/npm/dm/wodge.svg)
[![Dependency Status](https://david-dm.org/75lb/wodge.svg)](https://david-dm.org/75lb/wodge)
![Analytics](https://ga-beacon.appspot.com/UA-27725889-25/wodge/README.md?pixel)
[![browser support](https://ci.testling.com/75lb/wodge.png)](https://ci.testling.com/75lb/wodge)
#wodge
A collection of useful functions.
#API Documentation
Generated jsdoc documentation.
##extend
Merge a list of objects, left to right, into one.
###Parameters
object {Object} - a sequence of Object instances to be extended
###Example
```js
w.extend({}, { one: 1, three: 3 }, { one: "one", two: 2 }, { four: 4 });
// { one: "one", two: 2, three: 3, four: 4 }
```
##clone
Returns a copy of the input object
###Parameters
input {Object} - the object to clone
**Returns** Object
##omit
Returns a clone of the input object, minus the specified properties
###Parameters
input {Object} - the object to clone
toOmit {string[]} - an array of property names to omit from the clone
###Example
```js
w.omit({ one: 1, two: 2, three: 3, four: 4 }, [ "two", "four" ]);
// { one: 1, three: 3 }
```
**Returns** Object
##escapeRegExp
escape special regular expression characters
###Example
```js
w.escapeRegExp("(.*)");
// '\\(\\.\\*\\)'
```
##pluck
Plucks the value of the specified property from each object in the input array
###Parameters
arrayOfObjects {Object[]} - the input array of objects
the {string} - property to pluck
###Example
```js
var data = [
{one: 1, two: 2},
{two: "two"},
{one: "one", two: "zwei"},
];
w.pluck(data, "one");
// [ 1, "one" ]
w.pluck(data, "two");
// [ 2, "two", "zwei" ]
w.pluck(data, "one", "two");
// [ 1, "two", "one" ]
```
**Returns** Array
##arrayify
Either:
- puts a single scalar in an array
- converts array-like object to a real array
- converts null or undefined to an empty array
##getHomeDir
Cross-platform home directory retriever
##exists
###Example
```js
exists([ 1, 2, 3 ], 2) // true
exists([
{ result: false, number: 1 },
{ result: false, number: 2 }
], { result: true }) // false
```
##first
Works on an array of objects. Returns the first object with `property` set to `value`.
##commonDir
commonDir returns the directory common to each path in the list
###Parameters
files {Array} - An array of file paths to inspect
**Returns** string - A single path ending with the path separator, e.g. "/user/some/folder/"

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