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

objob

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

objob - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

4

.jsdoc.json
{
"version": "2.1.1",
"version": "2.2.0",
"tags": {

@@ -17,3 +17,3 @@ "allowUnknownTags" : true

"recurse": true,
"template": "./doc-template"
"template": "./node_modules/minimal-jsdoc"
},

@@ -20,0 +20,0 @@ "templates": {

@@ -0,1 +1,7 @@

## <sub>v2.2.0</sub>
#### *Jan.2, 2016* — [Docs](https://rawgit.com/chiedolabs/objob/c60ab4664b3a545b2c74f51a6109834906df1741/docs/ob.html)
* Removed 'many' function as it didn't fit with the rest of the library.
## <sub>v2.0.1</sub>

@@ -2,0 +8,0 @@

@@ -386,36 +386,2 @@ 'use strict';

/**
* Returns many of the object. If an array is passed, it will just return
* the given array.
*
* @example
* let x = {
* a: 1,
* b: 2,
* c: 3
* }
*
* ob.many(x)
* // → [{a:1,b:2,c:3},{a:1,b:2,c:3}]
*
*
* @param {object} subject The object you would like many of
* @param {integer} num the number of desired objects
* @returns {object[]} An array with n copies of your object.
*/
many: function many(subject) {
var num = arguments.length <= 1 || arguments[1] === undefined ? 2 : arguments[1];
var arr = [];
if ((0, _typeOf2.default)(subject) === 'array') {
return subject;
} else {
for (var i = 0; i < num; i++) {
arr.push(subject);
}
}
return arr;
},
/**
* Removes all keys with undefined values from an object.

@@ -422,0 +388,0 @@ *

{
"name": "objob",
"version": "2.1.1",
"version": "2.2.0",
"description": "A tool for controlling and manipulating javascript object fields and output.",

@@ -35,4 +35,5 @@ "main": "lib/objob.js",

"jsdoc": "^3.4.0",
"minimal-jsdoc": "0.0.1",
"mocha": "^2.3.4"
}
}
# Ob Job
A library of functions for advanced object manipulation.
A library of deep recursive object operations. Many functions will be similar to lodash except deeper.

@@ -5,0 +5,0 @@ ```bash

@@ -261,34 +261,2 @@ 'use strict';

/**
* Returns many of the object. If an array is passed, it will just return
* the given array.
*
* @example
* let x = {
* a: 1,
* b: 2,
* c: 3
* }
*
* ob.many(x)
* // → [{a:1,b:2,c:3},{a:1,b:2,c:3}]
*
*
* @param {object} subject The object you would like many of
* @param {integer} num the number of desired objects
* @returns {object[]} An array with n copies of your object.
*/
many: (subject, num = 2) => {
let arr = [];
if(type(subject) === 'array') {
return subject;
} else {
for(let i = 0; i < num; i++){
arr.push(subject);
}
}
return arr;
},
/**
* Removes all keys with undefined values from an object.

@@ -295,0 +263,0 @@ *

@@ -74,15 +74,2 @@ /* eslint max-nested-callbacks: 0*/

describe('many', () => {
it('should return the correct number of objects', (done) => {
expect(ob.many(ob1)).to.deep.equal([ob1,ob1]);
expect(ob.many(ob1, 5)).to.deep.equal([ob1,ob1,ob1,ob1,ob1]);
done();
});
it('should return the array if an array', (done) => {
expect(ob.many(obArr1)).to.equal(obArr1);
done();
});
});
describe('select', () => {

@@ -183,14 +170,2 @@ it('should return the object only select the given keys', (done) => {

});
describe('Chaining', () => {
it('should return many of an object after filtering select select', (done) => {
expect(ob.many(ob.select(ob1, ['name', 'age']),3))
.to.deep.equal([
{age: ob1.age, name: ob1.name},
{age: ob1.age, name: ob1.name},
{age: ob1.age, name: ob1.name},
]);
done();
});
});
});

Sorry, the diff of this file is not supported yet

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