Skip to content

Commit 31d2821

Browse files
committed
Bump package versions and deprecate node 6
Signed-off-by: João Ferreira <[email protected]>
1 parent e94725f commit 31d2821

File tree

7 files changed

+752
-490
lines changed

7 files changed

+752
-490
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "airbnb-base",
2+
"extends": "conversio",
33
"env": {
44
"node": true,
55
"es6": true

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: node_js
22
node_js:
3+
- '12'
34
- '10'
45
- '8'
5-
- '6'
66
script:
77
- npm run lint
88
- npm test

lib/objectOps.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,10 @@ const move = (obj, ...args) => ObjectOps.prototype.move.apply(obj, args);
129129
const remove = (obj, ...args) => ObjectOps.prototype.remove.apply(obj, args);
130130
const transform = (obj, ...args) => ObjectOps.prototype.transform.apply(obj, args);
131131

132-
module.exports = Object.assign(wrap, { clone, move, remove, transform, ObjectOps });
132+
module.exports = Object.assign(wrap, {
133+
clone,
134+
move,
135+
remove,
136+
transform,
137+
ObjectOps
138+
});

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "object-ops",
3-
"version": "1.0.1",
3+
"version": "2.0.0",
44
"description": "Chainable, path-based modifying operations for JavaScript Objects.",
55
"main": "index.js",
66
"scripts": {
7-
"lint": "NODE_ENV=test node_modules/.bin/eslint lib test",
7+
"lint": "node_modules/.bin/eslint lib test",
88
"test": "NODE_ENV=test node_modules/.bin/ava"
99
},
1010
"repository": {
@@ -24,11 +24,10 @@
2424
},
2525
"homepage": "https://github.com/getconversio/object-ops#readme",
2626
"devDependencies": {
27-
"ava": "^0.18.2",
28-
"eslint": "^5",
29-
"eslint-config-airbnb-base": "^11.1.0",
30-
"eslint-plugin-import": "^2.2.0",
27+
"ava": "^0.25.0",
28+
"eslint": "^5.9.0",
29+
"eslint-config-conversio": "^5.1.0",
3130
"should": "^11.2.0",
32-
"sinon": "^1.17.7"
31+
"sinon": "^7.3.2"
3332
}
3433
}

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const test = require('ava').test,
3+
const { test } = require('ava'),
44
index = require('../'),
55
objOps = require('../lib/objectOps');
66

test/lib/objectOps.js

Lines changed: 70 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,87 +2,112 @@
22

33
const should = require('should'),
44
sinon = require('sinon'),
5-
test = require('ava').test,
6-
objOps = require('../../lib/objectOps');
7-
8-
const ObjectOps = objOps.ObjectOps;
9-
10-
test('#constructor can initialize from another object', () => {
11-
should(new ObjectOps({ a: 1, b: { c: 2 } }))
12-
.containEql({ a: 1, b: { c: 2 } });
5+
{ test } = require('ava'),
6+
{ ObjectOps } = require('../../lib/objectOps');
7+
8+
test('#constructor can initialize from another object', t => {
9+
t.deepEqual(
10+
new ObjectOps({ a: 1, b: { c: 2 } }),
11+
{ a: 1, b: { c: 2 } }
12+
);
1313
});
1414

15-
test('#clone returns a deep copy of the object', () => {
15+
test('#clone returns a deep copy of the object', t => {
1616
const base = new ObjectOps({ a: 1, b: { c: 2 } });
1717
const clone = base.clone();
1818

19-
should(base).eql(clone);
20-
should(base).not.equal(clone);
21-
should(base.b).not.equal(clone.b);
19+
t.deepEqual(base, clone);
20+
t.not(base, clone);
21+
t.not(base.b, clone.b);
2222
});
2323

24-
test('#move copies the value from one path to another', () => {
25-
should(new ObjectOps({ a: 1, b: { c: 2 } }).move('b.c', 'b.d'))
26-
.eql(new ObjectOps({ a: 1, b: { d: 2 } }));
24+
test('#move copies the value from one path to another', t => {
25+
t.deepEqual(
26+
new ObjectOps({ a: 1, b: { c: 2 } }).move('b.c', 'b.d'),
27+
new ObjectOps({ a: 1, b: { d: 2 } })
28+
);
2729
});
2830

29-
test('#move errors out if source path does not exist', () => {
30-
should(() => new ObjectOps({ a: 1, b: { c: 2 } }).move('c.c', 'b.c'))
31-
.throw(TypeError, { message: 'Path is invalid at depth 0.' });
31+
test('#move errors out if source path does not exist', t => {
32+
t.throws(
33+
() => new ObjectOps({ a: 1, b: { c: 2 } }).move('c.c', 'b.c'),
34+
TypeError,
35+
'Path is invalid at depth 0.'
36+
);
3237
});
3338

34-
test('#move builds the new path as needed', () => {
35-
should(new ObjectOps({ a: 1, b: { c: 2 } }).move('b.c', 'c.b'))
36-
.containEql({ c: { b: 2 } });
39+
test('#move builds the new path as needed', t => {
40+
t.deepEqual(
41+
new ObjectOps({ a: 1, b: { c: 2 } }).move('b.c', 'c.b').c,
42+
{ b: 2 }
43+
);
3744
});
3845

39-
test('#move fails if destination path exists and is not traversable', () => {
40-
should(() => new ObjectOps({ a: 1, b: { c: 2 } }).move('b.c', 'a.b'))
41-
.throw(TypeError, { message: 'Path not traversable on step "a". Expected Object, got "1".' });
46+
test('#move fails if destination path exists and is not traversable', t => {
47+
t.throws(
48+
() => new ObjectOps({ a: 1, b: { c: 2 } }).move('b.c', 'a.b'),
49+
TypeError,
50+
'Path not traversable on step "a". Expected Object, got "1".'
51+
);
4252
});
4353

44-
test('#move removes the source value', () => {
45-
should(new ObjectOps({ a: 1, b: { c: 2 } }).move('b.c', 'c.b'))
46-
.containEql({ b: {} });
54+
test('#move removes the source value', t => {
55+
t.deepEqual(
56+
new ObjectOps({ a: 1, b: { c: 2 } }).move('b.c', 'c.b').b,
57+
{}
58+
);
4759
});
4860

49-
test('#move leaves the object untouched if an error occurs', () => {
61+
test('#move leaves the object untouched if an error occurs', t => {
5062
const obj = new ObjectOps({ a: 1, b: { c: 2 } });
5163

5264
try {
5365
obj.move('b.c', 'a.b');
5466
} catch (err) {
55-
should(obj).eql(new ObjectOps({ a: 1, b: { c: 2 } }));
67+
t.deepEqual(obj, new ObjectOps({ a: 1, b: { c: 2 } }));
5668
}
5769
});
5870

59-
test('#remove removes a path from the object', () => {
60-
should(new ObjectOps({ a: 1, b: { c: 2 } }).remove('b.c'))
61-
.eql(new ObjectOps({ a: 1, b: { } }));
71+
test('#remove removes a path from the object', t => {
72+
t.deepEqual(
73+
new ObjectOps({ a: 1, b: { c: 2 } }).remove('b.c'),
74+
new ObjectOps({ a: 1, b: { } })
75+
);
6276
});
6377

64-
test('#remove errors out if path doesn\'t exist', () => {
65-
should(() => new ObjectOps({ a: 1, b: { c: 2 } }).remove('a.b'))
66-
.throw(TypeError, { message: 'Expected object, got "1".' });
78+
test('#remove errors out if path doesn\'t exist', t => {
79+
t.throws(
80+
() => new ObjectOps({ a: 1, b: { c: 2 } }).remove('a.b'),
81+
TypeError,
82+
'Expected object, got "1".'
83+
);
6784
});
6885

69-
test('#remove takes multiple paths', () => {
70-
should(new ObjectOps({ a: 1, b: { c: 2 } }).remove('a', 'b'))
71-
.eql(new ObjectOps());
86+
test('#remove takes multiple paths', t => {
87+
t.deepEqual(
88+
new ObjectOps({ a: 1, b: { c: 2 } }).remove('a', 'b'),
89+
new ObjectOps()
90+
);
7291
});
7392

74-
test('#transform calls a function with the value at path', () => {
93+
test('#transform calls a function with the value at path', t => {
7594
const spy = sinon.spy(() => {});
7695
new ObjectOps({ a: 1, b: { c: 2 } }).transform('b.c', spy);
7796
sinon.assert.calledWith(spy, 2);
97+
t.pass();
7898
});
7999

80-
test('#transform sets the value returned from the function', () => {
81-
should(new ObjectOps({ a: 1, b: { c: 2 } }).transform('b.c', () => 3))
82-
.eql(new ObjectOps({ a: 1, b: { c: 3 } }));
100+
test('#transform sets the value returned from the function', t => {
101+
t.deepEqual(
102+
new ObjectOps({ a: 1, b: { c: 2 } }).transform('b.c', () => 3),
103+
new ObjectOps({ a: 1, b: { c: 3 } })
104+
);
83105
});
84106

85-
test('#transform errors out if path doesn\'t exist', () => {
86-
should(() => new ObjectOps({ a: 1, b: { c: 2 } }).transform('a.b', () => {}))
87-
.throw(TypeError, { message: 'Path is invalid at depth 0.' });
107+
test('#transform errors out if path doesn\'t exist', t => {
108+
t.throws(
109+
() => new ObjectOps({ a: 1, b: { c: 2 } }).transform('a.b', () => {}),
110+
TypeError,
111+
'Path is invalid at depth 0.'
112+
);
88113
});

0 commit comments

Comments
 (0)