adding duck typing section so that it's not unexpected

This commit is contained in:
Jeremy Ashkenas
2010-01-27 14:05:27 -05:00
parent 30858c50a8
commit 21f37e43a1

View File

@@ -1053,6 +1053,19 @@ _([1, 2, 3]).value();
=> [1, 2, 3]
</pre>
<h2 id="duck_typing">Duck Typing</h2>
<p>
The <b>isType</b> (<tt>isArray</tt>, <tt>isFunction</tt>, <tt>isString</tt> ...) family of type-checking
functions use property detection to do their work, which, although
orders of magnitude faster than the alternative, isn't entirely safe when dealing
with objects that are used as hashes, where arbitrary strings are being
set for the keys. It's entirely possible for an object to masquerade as
another type, if you're setting properties with names like "concat" and
"charCodeAt". So be aware.
</p>
<h2>Links &amp; Suggested Reading</h2>
<p>