Skip to content

Commit 577f529

Browse files
committed
formatting
1 parent a990186 commit 577f529

File tree

5 files changed

+44
-50
lines changed

5 files changed

+44
-50
lines changed

CHANGELOG.md

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
1-
<a name="1.0.1"></a>
2-
31
## <small>1.0.1 (2020-07-25)</small>
42

5-
* add prettier and `npm run build` ([1f34461](https://github.com/skratchdot/object-path-set/commit/1f34461))
6-
* adding contributors ([5bf6e83](https://github.com/skratchdot/object-path-set/commit/5bf6e83))
7-
* Bump eslint from 4.18.1 to 4.18.2 ([1756583](https://github.com/skratchdot/object-path-set/commit/1756583))
8-
* fix prototype pollution vulnerability ([e3108fe](https://github.com/skratchdot/object-path-set/commit/e3108fe))
9-
* rename tonic to runkit ([9c2f1ea](https://github.com/skratchdot/object-path-set/commit/9c2f1ea))
10-
* small readme tweaks ([9750b7a](https://github.com/skratchdot/object-path-set/commit/9750b7a))
11-
* travis runs node 6+ ([ac1969b](https://github.com/skratchdot/object-path-set/commit/ac1969b))
12-
* update travis config ([9c5a14e](https://github.com/skratchdot/object-path-set/commit/9c5a14e))
13-
* updating changelog and changelog generator ([216d2e7](https://github.com/skratchdot/object-path-set/commit/216d2e7))
14-
* updating libs and moving to jest ([2ac8e26](https://github.com/skratchdot/object-path-set/commit/2ac8e26))
15-
* use prettier on markdown files ([d43fa07](https://github.com/skratchdot/object-path-set/commit/d43fa07))
16-
17-
<a name="1.0.0"></a>
3+
- add prettier and `npm run build` ([1f34461](https://github.com/skratchdot/object-path-set/commit/1f34461))
4+
- adding contributors ([5bf6e83](https://github.com/skratchdot/object-path-set/commit/5bf6e83))
5+
- Bump eslint from 4.18.1 to 4.18.2 ([1756583](https://github.com/skratchdot/object-path-set/commit/1756583))
6+
- fix prototype pollution vulnerability ([55f06d7](https://github.com/skratchdot/object-path-set/commit/55f06d7))
7+
- formatting ([6bddc79](https://github.com/skratchdot/object-path-set/commit/6bddc79))
8+
- rename tonic to runkit ([9c2f1ea](https://github.com/skratchdot/object-path-set/commit/9c2f1ea))
9+
- small readme tweaks ([9750b7a](https://github.com/skratchdot/object-path-set/commit/9750b7a))
10+
- travis runs node 6+ ([ac1969b](https://github.com/skratchdot/object-path-set/commit/ac1969b))
11+
- update libs ([a990186](https://github.com/skratchdot/object-path-set/commit/a990186))
12+
- update travis config ([9c5a14e](https://github.com/skratchdot/object-path-set/commit/9c5a14e))
13+
- updating changelog and changelog generator ([216d2e7](https://github.com/skratchdot/object-path-set/commit/216d2e7))
14+
- updating libs and moving to jest ([2ac8e26](https://github.com/skratchdot/object-path-set/commit/2ac8e26))
15+
- use prettier on markdown files ([d43fa07](https://github.com/skratchdot/object-path-set/commit/d43fa07))
1816

1917
## 1.0.0 (2016-09-10)
2018

21-
* add support for array paths. ([0c0694e](https://github.com/skratchdot/object-path-set/commit/0c0694e))
22-
* adding `npm run watch` ([c631f34](https://github.com/skratchdot/object-path-set/commit/c631f34))
23-
* adding CHANGELOG.md ([8567c15](https://github.com/skratchdot/object-path-set/commit/8567c15))
24-
* bumping version and publishing ([0de8ede](https://github.com/skratchdot/object-path-set/commit/0de8ede))
25-
* updating changelog ([ca6b3de](https://github.com/skratchdot/object-path-set/commit/ca6b3de))
26-
* updating devDependency versions ([96b8b9d](https://github.com/skratchdot/object-path-set/commit/96b8b9d))
27-
* using npm-scripts instead of gulp ([c8a691a](https://github.com/skratchdot/object-path-set/commit/c8a691a))
28-
29-
<a name="0.0.2"></a>
19+
- add support for array paths. ([0c0694e](https://github.com/skratchdot/object-path-set/commit/0c0694e))
20+
- adding `npm run watch` ([c631f34](https://github.com/skratchdot/object-path-set/commit/c631f34))
21+
- adding CHANGELOG.md ([8567c15](https://github.com/skratchdot/object-path-set/commit/8567c15))
22+
- bumping version and publishing ([0de8ede](https://github.com/skratchdot/object-path-set/commit/0de8ede))
23+
- updating changelog ([ca6b3de](https://github.com/skratchdot/object-path-set/commit/ca6b3de))
24+
- updating devDependency versions ([96b8b9d](https://github.com/skratchdot/object-path-set/commit/96b8b9d))
25+
- using npm-scripts instead of gulp ([c8a691a](https://github.com/skratchdot/object-path-set/commit/c8a691a))
3026

3127
## <small>0.0.2 (2015-11-20)</small>
3228

33-
* adding mocha and test coverage ([8b5ac54](https://github.com/skratchdot/object-path-set/commit/8b5ac54))
34-
35-
<a name="0.0.1"></a>
29+
- adding mocha and test coverage ([8b5ac54](https://github.com/skratchdot/object-path-set/commit/8b5ac54))
3630

3731
## <small>0.0.1 (2014-09-15)</small>
3832

39-
* initial commit ([61877a2](https://github.com/skratchdot/object-path-set/commit/61877a2))
33+
- initial commit ([61877a2](https://github.com/skratchdot/object-path-set/commit/61877a2))

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ obj = setPath(obj, 'foo|bar', 'again', '|'); // result: {foo:{bar:'again',invali
3838

3939
## Links
4040

41-
* [Source Code](https://github.com/skratchdot/object-path-set)
42-
* [Changelog](https://github.com/skratchdot/object-path-set/blob/master/CHANGELOG.md)
43-
* [Live example on Runkit](https://npm.runkit.com/object-path-set)
41+
- [Source Code](https://github.com/skratchdot/object-path-set)
42+
- [Changelog](https://github.com/skratchdot/object-path-set/blob/master/CHANGELOG.md)
43+
- [Live example on Runkit](https://npm.runkit.com/object-path-set)
4444

4545
## Contributors
4646

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
22

33
// https://github.com/jonschlinkert/assign-deep/commit/90bf1c551d05940898168d04066bbf15060f50cc
4-
var isValidKey = function(key) {
4+
var isValidKey = function (key) {
55
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
66
};
77

8-
var setPath = function(obj, path, value, delimiter) {
8+
var setPath = function (obj, path, value, delimiter) {
99
var arr;
1010
var key;
1111
if (!obj || typeof obj !== 'object') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"contributors:generate": "all-contributors generate",
1212
"cover": "npm test -- --coverage",
1313
"coveralls": "cat coverage/lcov.info | coveralls --verbose",
14-
"format": "prettier --single-quote --write '*{.js,.md}' '.*.js'",
14+
"format": "prettier --single-quote --trailing-comma=none --write '*{.js,.md}' '.*.js'",
1515
"lint": "eslint *.js",
1616
"prepublish": "npm run build",
1717
"test": "jest test.js",

test.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var setPath = require('./index.js');
33
var now = new Date();
44
var obj;
5-
var getDefaultObject = function() {
5+
var getDefaultObject = function () {
66
return {
77
nested: {
88
thing: {
@@ -21,11 +21,11 @@ var getDefaultObject = function() {
2121
};
2222
};
2323

24-
describe('object-path-set', function() {
25-
beforeEach(function() {
24+
describe('object-path-set', function () {
25+
beforeEach(function () {
2626
obj = getDefaultObject();
2727
});
28-
it('should be able to set and overwrite types', function() {
28+
it('should be able to set and overwrite types', function () {
2929
var newValue = 'newValue';
3030

3131
obj = setPath(obj, 'dataUndefined', newValue);
@@ -45,7 +45,7 @@ describe('object-path-set', function() {
4545
expect(typeof obj.nested.foo).toBe('string');
4646
expect(obj.nested.foo).toBe(newValue);
4747
});
48-
it('should covert things to objects', function() {
48+
it('should covert things to objects', function () {
4949
expect(setPath(1234, 'a', 42)).toEqual({ a: 42 });
5050
expect(setPath(null, 'a', 42)).toEqual({ a: 42 });
5151
expect(setPath(true, 'a', 42)).toEqual({ a: 42 });
@@ -54,26 +54,26 @@ describe('object-path-set', function() {
5454
a: { b: { c: { d: null } } }
5555
});
5656
});
57-
it('should be able to use custom delimiters', function() {
57+
it('should be able to use custom delimiters', function () {
5858
expect(setPath({}, 'a|b|c|d', 42)).toEqual({ 'a|b|c|d': 42 });
5959
expect(setPath({}, 'a|b|c|d', 42, '|')).toEqual({
6060
a: { b: { c: { d: 42 } } }
6161
});
6262
expect(setPath({}, 'a.b.c.d', 42, '|')).toEqual({ 'a.b.c.d': 42 });
6363
});
64-
it('should set the correct values', function() {
64+
it('should set the correct values', function () {
6565
expect(setPath({}, 'a.b', 42)).toEqual({ a: { b: 42 } });
6666
expect(setPath({}, 'a.b', undefined)).toEqual({ a: { b: undefined } });
6767
expect(setPath({}, 'a.b', true)).toEqual({ a: { b: true } });
6868
expect(setPath({}, 'a.b', 'wow')).toEqual({ a: { b: 'wow' } });
6969
});
70-
it('should handle arrays as paths', function() {
70+
it('should handle arrays as paths', function () {
7171
expect(setPath({}, ['a', 'b'], 42)).toEqual({ a: { b: 42 } });
7272
expect(setPath({}, ['a', 'b'], undefined)).toEqual({ a: { c: undefined } });
7373
expect(setPath({}, ['a', 'b'], true)).toEqual({ a: { b: true } });
7474
expect(setPath({}, ['a', 'b'], 'wow')).toEqual({ a: { b: 'wow' } });
7575
});
76-
it('should be able to be called multiple times', function() {
76+
it('should be able to be called multiple times', function () {
7777
obj = {};
7878
obj = setPath(obj, 'a', 42);
7979
obj = setPath(obj, 'b', true);
@@ -82,41 +82,41 @@ describe('object-path-set', function() {
8282
obj = setPath(obj, 'c.d.f', 'foo');
8383
expect(obj).toEqual({ a: 42, b: true, c: { d: { e: {}, f: 'foo' } } });
8484
});
85-
it('should return the default object when key is not a string or array', function() {
85+
it('should return the default object when key is not a string or array', function () {
8686
var defaultValue = Math.random();
87-
[{}, null, 42, undefined, true].forEach(function(path) {
87+
[{}, null, 42, undefined, true].forEach(function (path) {
8888
expect(setPath(getDefaultObject(), path, defaultValue)).toEqual(
8989
getDefaultObject()
9090
);
9191
});
9292
});
93-
it('should return the default object when key is an empty array', function() {
93+
it('should return the default object when key is an empty array', function () {
9494
var defaultValue = Math.random();
9595
expect(setPath(obj, [], defaultValue)).toEqual(getDefaultObject());
9696
});
97-
it('should allow empty strings as a path', function() {
97+
it('should allow empty strings as a path', function () {
9898
var defaultValue = Math.random();
9999
var obj2 = getDefaultObject();
100100
obj2[''] = defaultValue;
101101
expect(setPath(obj, '', defaultValue)).toEqual(obj2);
102102
});
103-
it('should not pollute __proto__', function() {
103+
it('should not pollute __proto__', function () {
104104
var obj = {};
105105
expect(obj.polluted).toBeUndefined();
106106
setPath(obj, '__proto__.polluted', 'yes');
107107
var obj2 = {};
108108
expect(obj.polluted).toBeUndefined();
109109
expect(obj2.polluted).toBeUndefined();
110110
});
111-
it('should not pollute constructor', function() {
111+
it('should not pollute constructor', function () {
112112
var obj = {};
113113
expect(obj.polluted).toBeUndefined();
114114
setPath(obj, 'constructor.polluted', 'yes');
115115
var obj2 = {};
116116
expect(obj.polluted).toBeUndefined();
117117
expect(obj2.polluted).toBeUndefined();
118118
});
119-
it('should not pollute prototype', function() {
119+
it('should not pollute prototype', function () {
120120
var obj = {};
121121
expect(obj.polluted).toBeUndefined();
122122
setPath(obj, 'prototype.polluted', 'yes');

0 commit comments

Comments
 (0)