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.7.0 to 2.7.1

2

.jsdoc.json
{
"version": "2.5.0",
"version": "2.7.1",
"tags": {

@@ -4,0 +4,0 @@ "allowUnknownTags" : true

@@ -0,1 +1,15 @@

## <sub>v2.7.1</sub>
#### *Jan.8, 2016* — [Docs](https://rawgit.com/chiedolabs/objob/e70e409c4cd1e89dfc4bc0c56fc412c9680aee66/docs/index.html)
- Fixed minor bug with expand
- Better Map Values Tests and bug fix
## <sub>v2.7.0</sub>
#### *Jan.7, 2016* — [Docs](https://rawgit.com/chiedolabs/objob/8a8ec54420d8a00b573805faeceb77e8dfcbb60a/docs/index.html)
- Added mapValues function
## <sub>v2.5.0</sub>

@@ -42,2 +56,2 @@

* Initial release
* Initial release

@@ -292,3 +292,3 @@ 'use strict';

// if a top level array, things need to be handled just a little bit differently
// if array, things need to be handled just a little bit differently
if (isArray) {

@@ -364,3 +364,3 @@ res = [];

if (count === keys.length) {
tmp[key] = value;
tmp[key.replace('[]', '')] = value;
} else {

@@ -609,3 +609,3 @@ var _isArray = (0, _stringContains2.default)(key, '[]');

* a: 1,
* d: {f: 4}
* d: {f: 4, g: [1,2,3]}
* }

@@ -616,3 +616,3 @@ *

* // a: 3,
* // d: {f: 12}
* // d: {f: 12, g: [3,6,9]}
* //}

@@ -635,3 +635,5 @@ * @param {object|any[]} subject The object or array to compare to

shallowSubject[key] = func(shallowSubject[key]);
if ((0, _typeOf2.default)(shallowSubject[key]) !== 'object' && (0, _typeOf2.default)(shallowSubject[key]) !== 'array') {
shallowSubject[key] = func(shallowSubject[key]);
}
}

@@ -638,0 +640,0 @@ } catch (err) {

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

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

@@ -15,2 +15,3 @@ # Ob Job (beta)

* keys
* mapValues
* merge

@@ -17,0 +18,0 @@ * omit

@@ -213,3 +213,3 @@ 'use strict';

// if a top level array, things need to be handled just a little bit differently
// if array, things need to be handled just a little bit differently
if(isArray) {

@@ -257,3 +257,3 @@ res = [];

if(count === keys.length) {
tmp[key] = value;
tmp[key.replace('[]','')] = value;
} else {

@@ -464,3 +464,3 @@ let isArray = contains(key, '[]');

* a: 1,
* d: {f: 4}
* d: {f: 4, g: [1,2,3]}
* }

@@ -471,3 +471,3 @@ *

* // a: 3,
* // d: {f: 12}
* // d: {f: 12, g: [3,6,9]}
* //}

@@ -483,3 +483,5 @@ * @param {object|any[]} subject The object or array to compare to

for(let key of Object.keys(shallowSubject)) {
shallowSubject[key] = func(shallowSubject[key]);
if(type(shallowSubject[key]) !== 'object' && type(shallowSubject[key]) !== 'array') {
shallowSubject[key] = func(shallowSubject[key]);
}
}

@@ -486,0 +488,0 @@

@@ -7,3 +7,3 @@ /* eslint max-nested-callbacks: 0*/

describe('expand', () => {
let ob1, ob2, ob3, ob4;
let ob1, ob2, ob3, ob4, ob5;
let arr2, arr1, arr3, arr4;

@@ -48,2 +48,9 @@

ob5 = {
name: 'Bob',
feet: 5,
age: {'bar': 100, 'foo': [{},{bar: [1,{},[{cool: []}]]}]},
weight: 170,
};
arr1 = [3, 1];

@@ -61,2 +68,3 @@ arr2 = [ob1, ob2];

expect(ob.expand(ob.flatten(ob4))).to.deep.equal(ob4);
expect(ob.expand(ob.flatten(ob5))).to.deep.equal(ob5);
expect(ob.expand(ob.flatten({tmp: arr4}))).to.deep.equal({tmp: arr4});

@@ -63,0 +71,0 @@ done();

@@ -7,4 +7,3 @@ /* eslint max-nested-callbacks: 0*/

describe('clone', () => {
let ob1, ob2, ob3;
let arr2, arr1;
let ob1, ob3;

@@ -16,11 +15,6 @@ before((done) => {

weight: 170,
ob: {},
arr: [],
};
ob2 = {
name: 'Bob',
feet: 5,
age: 100,
weight: 170,
};
ob3 = {

@@ -34,8 +28,5 @@ name: 'Bob',

},
eyes: [{location: 'left', color: 'blue'}, {location: 'right', color: 'red'}],
eyes: [{location: 'left', color: 'blue'}, {location: 'right', color: 'red'}, 1,2],
};
arr1 = [3, 1];
arr2 = [ob1, ob2];
done();

@@ -49,4 +40,15 @@ });

weight: ob1.weight * 3,
ob: {},
arr: [],
});
//TODO write more tests
expect(ob.mapValues(ob3, (x) => x*3)).to.deep.equal({
name: NaN,
feet: 15,
body: {
feet: {
toes: 6,
},
},
eyes: [{location: NaN, color: NaN}, {location: NaN, color: NaN}, 3,6],
});
done();

@@ -56,6 +58,20 @@ });

it('should return an array with the correct mapped values', (done) => {
//expect(ob.clone(arr4)).to.deep.equal(arr4);
//TODO write more tests
expect(ob.mapValues([ob3, ob1], (x) => x*3)).to.deep.equal([{
name: NaN,
feet: 15,
body: {
feet: {
toes: 6,
},
},
eyes: [{location: NaN, color: NaN}, {location: NaN, color: NaN}, 3,6],
},{
name: ob1.name * 3,
age: ob1.age * 3,
weight: ob1.weight * 3,
ob: {},
arr: [],
}]);
done();
});
});

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