Skip to content

Commit bc79ecc

Browse files
committed
feat: drop Safari 14 support
1 parent 99467ea commit bc79ecc

File tree

4 files changed

+3
-89
lines changed

4 files changed

+3
-89
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ The script does **not** include any polyfills.
115115
| Google Chrome | >= 96 |
116116
| Edge | >= 92 |
117117
| Firefox | >= 91 |
118-
| Safari | >= 14 |
118+
| Safari | >= 15.4 |
119119
| Opera | >= 76 |
120120
| IE ||
121121

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
extend, getValueByPath, isHTMLElement, isHTMLString, isObject, setValueByPath
2+
getValueByPath, isHTMLElement, isHTMLString, isObject, setValueByPath
33
} from "./utils";
44

55
/**
@@ -192,7 +192,7 @@ export default (config = {}) => {
192192
},
193193
set: (data, prop, value) => {
194194
if (isObject(value)) {
195-
data[prop] = extend(data[prop], value);
195+
data[prop] = { ...data[prop], ...value };
196196
} else {
197197
data[prop] = value;
198198
}

src/tests/utils.test.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
ensureArray,
3-
extend,
43
getValueByPath,
54
isHTMLString,
65
isObject,
@@ -187,24 +186,3 @@ describe(`isObject`, () => {
187186
expect(isObject(nonObject)).toBe(false);
188187
});
189188
});
190-
191-
//
192-
// extend
193-
//
194-
describe(`extend`, () => {
195-
test(`Extending a deep object`, () => {
196-
const object1 = { bar: { abc: `abc`, xyz: `xyz` }, foo: `foo` };
197-
const object2 = { bar: { abc: `_new_abc` } };
198-
const expected = { bar: { abc: `_new_abc`, xyz: `xyz` }, foo: `foo` };
199-
200-
expect(extend(object1, object2)).toEqual(expected);
201-
});
202-
203-
test(`Extending flat object`, () => {
204-
const object1 = { bar: `bar`, foo: 2 };
205-
const object2 = { foo: 17 };
206-
const expected = { bar: `bar`, foo: 17 };
207-
208-
expect(extend(object1, object2)).toEqual(expected);
209-
});
210-
});

src/utils.js

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -106,67 +106,3 @@ export function getValueByPath(path, object, fallback) {
106106
export function isObject(object) {
107107
return object && typeof object === `object`;
108108
}
109-
110-
/**
111-
* @param {*} object
112-
* @return {object}
113-
*/
114-
export function extend(...args) {
115-
let options;
116-
let src;
117-
let copy;
118-
let copyIsArray;
119-
let clone;
120-
let i = 1;
121-
let target = args[0] || {};
122-
const { length } = args;
123-
124-
function _extendBaseObject(name) {
125-
src = target[name];
126-
copy = options[name];
127-
128-
// Prevent never-ending loop
129-
if (target === copy) {
130-
return;
131-
}
132-
133-
copyIsArray = Array.isArray(copy);
134-
135-
// Recurse if we're merging plain objects or arrays
136-
if (copy && (isObject(copy) || copyIsArray)) {
137-
if (copyIsArray) {
138-
clone = src && Array.isArray(src) ? src : [];
139-
} else {
140-
clone = src && isObject(src) ? src : {};
141-
}
142-
143-
// Do not move original objects, clone them
144-
target[name] = extend(clone, copy);
145-
} else if (copy !== undefined) {
146-
target[name] = copy;
147-
}
148-
}
149-
150-
// Handle case when target is a string or something (possible in deep copy)
151-
if (!isObject(target) && typeof target !== `function`) {
152-
target = {};
153-
}
154-
155-
if (i === length) {
156-
target = this;
157-
i -= 1;
158-
}
159-
160-
for (; i < length; i += 1) {
161-
// Only deal with non-null/undefined values
162-
options = args[i];
163-
164-
if (typeof window !== `undefined` && options instanceof HTMLElement) {
165-
target = options;
166-
} else if (options != null) {
167-
Object.keys(options).forEach(_extendBaseObject);
168-
}
169-
}
170-
171-
return target;
172-
}

0 commit comments

Comments
 (0)