Skip to content

Commit 7b4952b

Browse files
committed
isArray alias
1 parent ce42cac commit 7b4952b

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

src/core/mutators/set.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dop.core.set = function(object, property, value) {
1616
objectTarget[property] = value;
1717
if (dop.isObjectRegistrable(value)) {
1818
// var object_dop = dop.getObjectDop(value);
19-
// if (dop.isRegistered(value) && Array.isArray(object_dop._) && object_dop._ === objectTarget)
19+
// if (dop.isRegistered(value) && isArray(object_dop._) && object_dop._ === objectTarget)
2020
// object_dop[object_dop.length-1] = property;
2121
// else {
2222
// var shallWeProxy = dop.data.object_data[dop.getObjectId(objectTarget)].options.proxy;
@@ -28,9 +28,9 @@ dop.core.set = function(object, property, value) {
2828
var mutation = {object:objectProxy, name:property, value:value};
2929
if (hasOwnProperty)
3030
mutation.oldValue = oldValue;
31-
if (Array.isArray(objectTarget)) // if is array we must store the length in order to revert it with setUnaction
31+
if (isArray(objectTarget)) // if is array we must store the length in order to revert it with setUnaction
3232
mutation.length = length;
33-
if (Array.isArray(value)) // We cant store the original array cuz when we inject the mutation into the action object could be different from the original
33+
if (isArray(value)) // We cant store the original array cuz when we inject the mutation into the action object could be different from the original
3434
mutation.valueOriginal = dop.util.merge([], value);
3535

3636
dop.core.storeMutation(mutation);

src/core/objects/configureObject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dop.core.configureObject = function(object, path, parent) {
55
// Creating a copy if is another object registered
66
if (dop.isRegistered(object))
77
return dop.core.configureObject(
8-
dop.util.merge( Array.isArray(object)?[]:{}, object),
8+
dop.util.merge(isArray(object)?[]:{}, object),
99
path,
1010
parent
1111
);

src/core/objects/injectMutationInAction.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ dop.core.injectMutationInAction = function(action, mutation, isUnaction) {
77
value = (isUnaction) ? mutation.oldValue : mutation.value,
88
typeofValue = dop.util.typeof(value),
99
index = 1,
10-
isArray = Array.isArray,
1110
parent;
1211

1312

src/util/alias.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ function isFunction(func) {
55

66
function isObject(object) {
77
return (object!==null && typeof object=='object');
8+
}
9+
10+
function isArray(array) {
11+
return Array.isArray(array);
812
}

src/util/typeof.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dop.util.typeof = function(value) {
44
var s = typeof value;
55
if (s == 'object') {
66
if (value) {
7-
if (Array.isArray(value))
7+
if (isArray(value))
88
s = 'array';
99
else if (value instanceof Date)
1010
s = 'date';

0 commit comments

Comments
 (0)