UNPKG

mutate.js

Version:

overloading javascript functions done easy

1 lines 760 B
!function(t){var n=function(t,n){var o={};return{method:function(t,n){var u="array"===e(n);return t||(t=[]),o[t.join("::").toLowerCase()]={fn:u?r(n):n,inject:u?!0:n.length>t.length},this},close:function(){return function(){var r=Array.prototype.slice.call(arguments,0),u=function(){for(var t=[],n=0,o=r.length;o>n;n++)t.push(e(r[n]));return t}().join("::");return o[u]?(o[u].inject&&r.unshift(t),o[u].fn.apply(n||null,r)):t&&t.apply(n||null,r)}}}},r=function(t){return function(n){for(var r=Array.prototype.slice.call(arguments,1),e={},o=0,u=t.length;u>o;o++)e[t[o]]=r[o];return n(e)}},e=function(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()};"undefined"!=typeof module&&module.exports?module.exports=n:t.mutate=n}(this);