bishopZ / Typecast.js

No Longer Maintained - Typecast.js :: typing for Javascript
http://typecastjs.com/
30 stars 2 forks source link

more new types: NodeList & Wrapped #23

Open bishopZ opened 10 years ago

bishopZ commented 10 years ago

From https://github.com/bishopZ/velocity/blob/master/jquery.velocity.js

/* Copyright Martin Bohm. MIT License: https://gist.github.com/Tomalak/818a78a226a0738eaade */ isNodeList: function (variable) { return typeof variable === "object" && /^[object (HTMLCollection|NodeList|Object)]$/.test(Object.prototype.toString.call(variable)) && variable.length !== undefined && (variable.length === 0 || (typeof variable[0] === "object" && variable[0].nodeType > 0)); },

    /* Determine if variable is a wrapped jQuery or Zepto element. */
    isWrapped: function (variable) {
        return variable && (variable.jquery || (window.Zepto && window.Zepto.zepto.isZ(variable)));
    }