aboutsummaryrefslogtreecommitdiffstats
path: root/src/Angular.js
diff options
context:
space:
mode:
authorDaniel Luz2013-08-22 16:44:24 -0300
committerBrian Ford2013-10-02 16:57:26 -0700
commit5b8c78843e8d62a7a67cead8bf04c76aa8ee411d (patch)
treedc336b2896b5ba7499efb74dafd910343fdf01c1 /src/Angular.js
parentfc8034b352121f8f057dbd5e3837eeb17e1df580 (diff)
downloadangular.js-5b8c78843e8d62a7a67cead8bf04c76aa8ee411d.tar.bz2
fix(isArrayLike): correctly handle string primitives
Closes #3356
Diffstat (limited to 'src/Angular.js')
-rw-r--r--src/Angular.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Angular.js b/src/Angular.js
index efb11526..ad281504 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -87,22 +87,21 @@ if (isNaN(msie)) {
/**
* @private
* @param {*} obj
- * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...)
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, String ...)
*/
function isArrayLike(obj) {
if (obj == null || isWindow(obj)) {
return false;
}
-
+
var length = obj.length;
if (obj.nodeType === 1 && length) {
return true;
}
- return isArray(obj) || !isFunction(obj) && (
- length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj
- );
+ return isString(obj) || isArray(obj) || length === 0 ||
+ typeof length === 'number' && length > 0 && (length - 1) in obj;
}
/**
@@ -599,7 +598,7 @@ function isLeafNode (node) {
* * If a destination is provided, all of its elements (for array) or properties (for objects)
* are deleted and then all elements/properties from the source are copied to it.
* * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
- * * If `source` is identical to 'destination' an exception will be thrown.
+ * * If `source` is identical to 'destination' an exception will be thrown.
*
* Note: this function is used to augment the Object type in Angular expressions. See
* {@link ng.$filter} for more information about Angular arrays.