1010'use strict' ;
1111
1212var isNumeric = require ( 'fast-isnumeric' ) ;
13- var isArray = require ( './is_array' ) ;
13+ var isArrayOrTypedArray = require ( './is_array' ) . isArrayOrTypedArray ;
1414var isPlainObject = require ( './is_plain_object' ) ;
1515var containerArrayMatch = require ( '../plot_api/container_array_match' ) ;
1616
@@ -96,7 +96,7 @@ function npGet(cont, parts) {
9696 }
9797 return allSame ? out [ 0 ] : out ;
9898 }
99- if ( typeof curPart === 'number' && ! isArray ( curCont ) ) {
99+ if ( typeof curPart === 'number' && ! isArrayOrTypedArray ( curCont ) ) {
100100 return undefined ;
101101 }
102102 curCont = curCont [ curPart ] ;
@@ -144,7 +144,7 @@ function isDeletable(val, propStr) {
144144 ) {
145145 return false ;
146146 }
147- if ( ! isArray ( val ) ) return true ;
147+ if ( ! isArrayOrTypedArray ( val ) ) return true ;
148148
149149 if ( propStr . match ( INFO_PATTERNS ) ) return true ;
150150
@@ -167,7 +167,7 @@ function npSet(cont, parts, propStr) {
167167 for ( i = 0 ; i < parts . length - 1 ; i ++ ) {
168168 curPart = parts [ i ] ;
169169
170- if ( typeof curPart === 'number' && ! isArray ( curCont ) ) {
170+ if ( typeof curPart === 'number' && ! isArrayOrTypedArray ( curCont ) ) {
171171 throw 'array index but container is not an array' ;
172172 }
173173
@@ -211,7 +211,7 @@ function joinPropStr(propStr, newPart) {
211211
212212// handle special -1 array index
213213function setArrayAll ( containerArray , innerParts , val , propStr ) {
214- var arrayVal = isArray ( val ) ,
214+ var arrayVal = isArrayOrTypedArray ( val ) ,
215215 allSet = true ,
216216 thisVal = val ,
217217 thisPropStr = propStr . replace ( '-1' , 0 ) ,
@@ -261,7 +261,7 @@ function pruneContainers(containerLevels) {
261261 propPart = containerLevels [ i ] [ 1 ] ;
262262
263263 remainingKeys = false ;
264- if ( isArray ( curCont ) ) {
264+ if ( isArrayOrTypedArray ( curCont ) ) {
265265 for ( j = curCont . length - 1 ; j >= 0 ; j -- ) {
266266 if ( isDeletable ( curCont [ j ] , joinPropStr ( propPart , j ) ) ) {
267267 if ( remainingKeys ) curCont [ j ] = undefined ;
@@ -287,7 +287,7 @@ function pruneContainers(containerLevels) {
287287function emptyObj ( obj ) {
288288 if ( obj === undefined || obj === null ) return true ;
289289 if ( typeof obj !== 'object' ) return false ; // any plain value
290- if ( isArray ( obj ) ) return ! obj . length ; // []
290+ if ( isArrayOrTypedArray ( obj ) ) return ! obj . length ; // []
291291 return ! Object . keys ( obj ) . length ; // {}
292292}
293293
0 commit comments