10
10
'use strict' ;
11
11
12
12
var isNumeric = require ( 'fast-isnumeric' ) ;
13
- var isArray = require ( './is_array' ) ;
13
+ var isArrayOrTypedArray = require ( './is_array' ) . isArrayOrTypedArray ;
14
14
var isPlainObject = require ( './is_plain_object' ) ;
15
15
var containerArrayMatch = require ( '../plot_api/container_array_match' ) ;
16
16
@@ -96,7 +96,7 @@ function npGet(cont, parts) {
96
96
}
97
97
return allSame ? out [ 0 ] : out ;
98
98
}
99
- if ( typeof curPart === 'number' && ! isArray ( curCont ) ) {
99
+ if ( typeof curPart === 'number' && ! isArrayOrTypedArray ( curCont ) ) {
100
100
return undefined ;
101
101
}
102
102
curCont = curCont [ curPart ] ;
@@ -144,7 +144,7 @@ function isDeletable(val, propStr) {
144
144
) {
145
145
return false ;
146
146
}
147
- if ( ! isArray ( val ) ) return true ;
147
+ if ( ! isArrayOrTypedArray ( val ) ) return true ;
148
148
149
149
if ( propStr . match ( INFO_PATTERNS ) ) return true ;
150
150
@@ -167,7 +167,7 @@ function npSet(cont, parts, propStr) {
167
167
for ( i = 0 ; i < parts . length - 1 ; i ++ ) {
168
168
curPart = parts [ i ] ;
169
169
170
- if ( typeof curPart === 'number' && ! isArray ( curCont ) ) {
170
+ if ( typeof curPart === 'number' && ! isArrayOrTypedArray ( curCont ) ) {
171
171
throw 'array index but container is not an array' ;
172
172
}
173
173
@@ -211,7 +211,7 @@ function joinPropStr(propStr, newPart) {
211
211
212
212
// handle special -1 array index
213
213
function setArrayAll ( containerArray , innerParts , val , propStr ) {
214
- var arrayVal = isArray ( val ) ,
214
+ var arrayVal = isArrayOrTypedArray ( val ) ,
215
215
allSet = true ,
216
216
thisVal = val ,
217
217
thisPropStr = propStr . replace ( '-1' , 0 ) ,
@@ -261,7 +261,7 @@ function pruneContainers(containerLevels) {
261
261
propPart = containerLevels [ i ] [ 1 ] ;
262
262
263
263
remainingKeys = false ;
264
- if ( isArray ( curCont ) ) {
264
+ if ( isArrayOrTypedArray ( curCont ) ) {
265
265
for ( j = curCont . length - 1 ; j >= 0 ; j -- ) {
266
266
if ( isDeletable ( curCont [ j ] , joinPropStr ( propPart , j ) ) ) {
267
267
if ( remainingKeys ) curCont [ j ] = undefined ;
@@ -287,7 +287,7 @@ function pruneContainers(containerLevels) {
287
287
function emptyObj ( obj ) {
288
288
if ( obj === undefined || obj === null ) return true ;
289
289
if ( typeof obj !== 'object' ) return false ; // any plain value
290
- if ( isArray ( obj ) ) return ! obj . length ; // []
290
+ if ( isArrayOrTypedArray ( obj ) ) return ! obj . length ; // []
291
291
return ! Object . keys ( obj ) . length ; // {}
292
292
}
293
293
0 commit comments