Comparing version 0.3.4 to 0.3.6
18
m8.js
;!function( root, Name, PACKAGE ) { | ||
"use strict"; | ||
/*~ m8/src/vars.js ~*/ | ||
/*~ src/vars.js ~*/ | ||
// if ENV === commonjs we want root to be global | ||
@@ -61,3 +61,3 @@ typeof global == 'undefined' ? root : ( root = global ); | ||
/*~ m8/src/lib.js ~*/ | ||
/*~ src/lib.js ~*/ | ||
function __lib__( val ) { return val; } | ||
@@ -174,3 +174,3 @@ | ||
if ( ENV == 'browser' ) | ||
if ( ENV == 'browser' && mod === root ) // don't expose as amd if lib is being added to a module that will be exposed | ||
typeof define != 'function' || !define.amd || define( name, [], function() { return lib; } ); | ||
@@ -365,3 +365,3 @@ } | ||
/*~ m8/src/lib.x.js ~*/ | ||
/*~ src/lib.x.js ~*/ | ||
// Commonjs Modules 1.1.1: http://wiki.commonjs.org/wiki/Modules/1.1.1 | ||
@@ -393,3 +393,3 @@ // notes section: http://wiki.commonjs.org/wiki/Modules/ProposalForNativeExtension | ||
/*~ m8/src/nativex.js ~*/ | ||
/*~ src/nativex.js ~*/ | ||
x.cache( 'Array', function( Type ) { | ||
@@ -496,2 +496,8 @@ var PROTO = Type.prototype; | ||
def( Type.prototype, '__proto__', { | ||
get : function() { | ||
return Type.getPrototypeOf( this ); | ||
} // todo: set??? | ||
}, 'c' ); | ||
defs( Type, { | ||
@@ -530,3 +536,3 @@ key : function( item, val ) { | ||
/*~ m8/src/expose.js ~*/ | ||
/*~ src/expose.js ~*/ | ||
iter( PACKAGE ) || ( PACKAGE = ENV == 'commonjs' ? module : root ); | ||
@@ -533,0 +539,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t,n){"use strict";function r(e){return e}function i(e,t){switch(U(e)){case"array":break;case"string":e=e.split(".");break;default:return u(t)}if(dt.test(e[0])&&(t=r,e.shift()),!e.length)return u(t);e[0].indexOf("^")||(t||"^"==e[0]?e.shift():e[0]=e[0].substring(1)),t=u(t);for(var n;n=e.shift();)t=t[n]||(t[n]=C());return t}function u(t){return"commonjs"==X?t?x(t)?t.exports:t:module.exports:t||e}function s(e){var t,n=Number(e);return isNaN(n)?(t=e+"")in nt?nt[t]:e:n}function o(e,t,n){n=n===!0,t||(t=e,e=C());for(var r in t)!_(t,r)||n&&_(e,r)||(e[r]=t[r]);return e}function c(e,t,n){return n=n===!0,t||(t=e,e=C()),Object.getOwnPropertyNames(t).reduce(function(e,r){return n&&_(e,r)||a(e,r,h(t,r)),e},e)}function a(e,n,i){var u,s,o,c,a=gt.call(arguments,3),f=m(e,n);switch(U(a[0])){case"string":s=ot[a.shift()];break;case"object":s=a.shift();break;default:o=U(i),s="object"!=o&&f?h(e,n):null,!s||(s="function"==o?ot.cw:ot.cew)}return c=a.shift()===!0,u=a.shift()===!0,f&&!c?u&&Error(t+".def cannot overwrite existing property: "+n+", in item type: "+z(e)+"."):("object"!=o&&s&&(i=l(i,s)),(i.get||i.set)&&delete i.writable,Object.defineProperty(e,n,i)),r}function f(e,t,n,i,u){n||(n="cw");for(var s in t)!_(t,s)||a(e,s,t[s],n,i,u);return r}function l(e,t){return o("object"==U(e)?e:{value:e},"object"==U(t)?t:ot[(t+"").toLowerCase()]||ot.cew,!0)}function h(e,t){return Object.getOwnPropertyDescriptor(e,t)}function d(e){return!p(e)||!M(e)&&N(e)||!1}function p(e){return!(null===e||e===K||"number"==typeof e&&isNaN(e))}function b(t,n,r){"string"!=typeof n&&t[V]&&(r=n,n=t[V]);var i,u=C();return u[V]=n,u[J]="library","commonjs"==X&&x(r)?r.exports=t:(r||(r=e),(i=r[n])&&N(i)?(i[n]=t,t=c(i,t)):a(r,n,l({value:t},"ew")),"browser"==X&&("function"!=typeof define||!define.amd||define(n,[],function(){return t}))),f(t,u,"w",!0),t}function g(e){return e.name||e.displayName||((e+"").match(pt)||["",""])[1].trim()}function y(e){return v(e,Array.coerce(arguments,1))}function m(e,t){return t+""in Object(e)}function v(e,t,n){return(e+"").replace(n||lt,function(e,n){return t[n]||""})}function w(){return yt.replace(ht,j)}function j(e){var t=0|16*at();return("x"==e?t:8|3&t).toString(16)}function _(e,t){return et.hasOwnProperty.call(Object(e),t+"")}function O(e,t){return e?m(e,"id")&&!d(e.id)?e.id:e.id=k(t):k(t)}function k(e){return(e||st)+"-"+ ++ut}function x(e){if(null===tt)return!1;try{return e instanceof tt}catch(t){return!1}}function N(e){return m(e,"length")||"object"==U(e)}function M(e){return("length"in(e=Object(e))?e:Object.keys(e)).length}function A(e,t){var n;if(t)n=U(t);else switch(n=U(e)){case"array":case"object":t=e,e=new(t.constructor||Object);break;default:return e}switch(n){case"object":return Object.keys(t).reduce(E,{source:t,target:e}).target;case"array":return e.length=t.length,t.reduce(D,e);default:return t}}function D(e,t,n){return e[n]=U(e[n])===U(t)?A(e[n],t):A(t),e}function E(e,t){return e.target[t]=U(e.target[t])===U(e.source[t])?A(e.target[t],e.source[t]):A(e.source[t]),e}function Y(){}function C(e){var t=Object.create(null);return"object"==typeof e?o(t,e):t}function S(e,t,n){var r;if(n+="",arguments.length>3){for(n=gt.call(arguments,2);r=n.shift();)if(S(e,t,r))return!0;return!1}if(e(t,n))return!0;if("string"!=typeof t&&~n.indexOf(".")){for(n=n.split(".");r=n.shift();){if(!S(e,t,r))return!1;t=t[r]}return!0}return!1}function L(e,t){for(var n=[e];t>=++e;)n.push(e);return n}function T(e,t){t=Array.isArray(t)?t:gt.call(arguments,1);var n=Array.isArray(e)?F:H;return t.forEach(n,e),e}function F(e){var t=this.indexOf(e);t=~t?t:!isNaN(e)&&e in this?e:t,0>t||this.splice(t,1)}function H(e){delete this[e]}function I(e){return et.toString.call(e)}function R(e){return et.valueOf.call(e)}function P(e){return e==it?it:e==rt||"nodelist"==e?rt:e.indexOf("htm")||e.lastIndexOf("element")+7!==e.length?!1:"htmlelement"}function U(e){var t=I(e);return t in ct?ct[t]:ct[t]=t.split(" ")[1].split("]")[0].replace(bt,"$1").toLowerCase()}function z(e){if(null===e||e===K)return!1;var t=m(e,J)?e[J]:null===Object.getPrototypeOf(e)?"nullobject":K;return"object"!==t?t:S(_,e,"configurable","enumerable","writable")&&_(e,"value")||S(_,e,"get","set")?"descriptor":t}function W(e,t){if(!t)return A(e);switch(U(t)){case"object":return Object.keys(t).reduce($,{source:t,target:e}).target;case"array":return t.reduce(Z,e);default:return e}}function Z(e,t,n){return e[n]=m(e,n)?U(e[n])==U(t)?W(e[n],t):e[n]:A(t),e}function $(e,t){return e.target[t]=m(e.target,t)?U(e.target[t])==U(e.source[t])?W(e.target[t],e.source[t]):e.target[t]:A(e.source[t]),e}function q(){return gt.call(arguments).forEach(G),r}function B(e){e(this,r)}function G(e){m(e,Q)||a(e,Q,0,"w");var t=mt[e[V]||g(e)];t&&(t.slice(e[Q]).forEach(B,e),e[Q]=t.length)}"undefined"==typeof global?e:e=global;var K,V="__name__",J="__type__",Q="__xid__",X="undefined"!=typeof module&&"exports"in module&&"function"==typeof require?"commonjs":"undefined"!=typeof navigator?"browser":"other",et=Object.prototype,tt="commonjs"!=X?null:require("module"),nt=[!1,0/0,null,!0,K].reduce(function(e,t){return e[t+""]=t,e},C()),rt="htmlcollection",it="htmldocument",ut=999,st="anon",ot=function(){var e={ce:"ec",cw:"wc",ew:"we",cew:"cwe ecw ewc wce wec".split(" ")},t="configurable enumerable writable".split(" "),n={c:[!0,!1,!1],ce:[!0,!0,!1],cew:[!0,!0,!0],cw:[!0,!1,!0],e:[!1,!0,!1],ew:[!1,!0,!0],r:[!1,!1,!1],w:[!1,!1,!0]},r=Object.keys(n).reduce(function(r,i){function u(e){r[e]=r[i]}var s=e[i];return r[i]=t.reduce(function(e,t,r){return e[t]=n[i][r],e},C()),!s||(Array.isArray(s)?s.forEach(u):u(s)),r},C());return delete r[K],r}(),ct="Array Boolean Date Function Null Number Object RegExp String Undefined".split(" ").reduce(function(e,t){return e["[object "+t+"]"]=t.toLowerCase(),e},C()),at=Math.random,ft=/global|window/i,lt=/\$?\{([^\}]+)\}/g,ht=/[xy]/g,dt=RegExp("^\\u005E?"+t),pt=/[\s\(]*function([^\(]+).*/,bt=/^[Ww]ebkit|[Mm]oz|O|[Mm]s|[Kk]html(.*)$/,gt=Array.prototype.slice,yt="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",mt={Array:[],Boolean:[],Date:[],Function:[],Number:[],Object:[],RegExp:[],String:[]};a(q,"cache",function(e,t){return"string"==typeof e||(e=e[V]||g(e)),mt[e]||(mt[e]=[]),mt[e].push(t),r},"w"),q.cache("Array",function(e){var t=e.prototype;a(e,"coerce",function(e,t,n){return m(e,"length")?(t="number"==z(t)?t>0?t:0:0,n="number"==z(n)?n>t?n:0>=n?e.length+n:t+n:e.length,gt.call(e,t,n)):[e]},"w"),f(t,{find:function(e,t){var n=-1,r=this.length>>>0;for(t||(t=this);r>++n;)if(e.call(t,this[n],n,this))return this[n];return null},invoke:function(n){var r=e.coerce(arguments,1);return t.map.call(this,function(e){return e&&"function"==typeof e[n]?e[n].apply(e,r):K})},pluck:function(e,n){return n=n===!0,t.reduce.call(this,function(t,r){var i=Object.value(r,e);return n&&!p(i)||t.push(i),t},[])}},"w")}),q.cache("Boolean",function(e){a(e,"coerce",function(e){switch(z(e)){case"boolean":return e;case"nan":case!1:return!1;case"number":case"string":return!(e in nt?!nt[e]:0===Number(e))}return!0},"w")}),q.cache("Function",function(e){function t(e){return!e||e in u}function n(){return""+this}function r(){return this}var i="__xname__",u={Anonymous:!0,anonymous:!0},s={mimic:function(e,t){var i=e.valueOf();return f(this,{displayName:t||g(i),toString:n.bind(i),valueOf:r.bind(i)},"c",!0),this}};s[V]={get:function(){if(!this[i]){var e=this.valueOf(),n=e!==this?t(e[V])?null:e[V]:null,r=n||g(this);!t(r)||t(this.displayName)||(r=this.displayName),a(this,i,r||"anonymous","w")}return this[i]}},f(e.prototype,s,"w"),a(e,"anon_list",{value:u},"w")}),q.cache("Object",function(e){a(e.prototype,J,o({get:function(){var e,t=this,n=t.constructor,r=U(t),i=P(r)||(ft.test(r)?"global":!1);return i?i:"number"==r?isNaN(t)?"nan":"number":"object"==r&&"function"==typeof n&&"function"!=n[J]?(e=(n[V]+"").toLowerCase(),e&&"anonymous"!=e?e:n[J]||r):r}},ot.r)),f(e,{key:function(t,n){return e.keys(e(t)).find(function(e){return t[e]===n})},reduce:function(t,n,r){return e.keys(e(t)).reduce(function(e,r,i){return e=n.call(t,e,t[r],r,t,i)},r)},value:function(t,n){if(isNaN(n)){if(m(t,n))return t[n];if(~n.indexOf(".")){var r;for(n=n.split(".");(r=n.shift())&&(t=e.value(t,r))!==K;);return t}}return d(t)?K:p(t[n])?t[n]:"function"==typeof t.get?t.get(n):"function"==typeof t.getAttribute?t.getAttribute(n):K},values:function(t){return e.keys(Object(t)).map(function(e){return t[e]})}},"w")}),N(n)||(n="commonjs"==X?module:e),f(r=b(r,t,n),{ENV:X,global:{value:e},modes:{value:ot},bless:i,coerce:s,copy:o,cpdef:c,def:a,defs:f,describe:l,description:h,empty:d,exists:p,expose:b,format:y,got:S.bind(null,m),gsub:v,guid:w,has:S.bind(null,_),id:O,iter:N,len:M,merge:A,nativeType:U,noop:Y,ntype:U,obj:C,range:L,remove:T,tostr:I,type:z,update:W,valof:R,x:q},"w"),q(Object,Array,Boolean,Function)}(this,"m8"); | ||
!function(e,t,n){"use strict";function r(e){return e}function u(e,t){switch(I(e)){case"array":break;case"string":e=e.split(".");break;default:return o(t)}if(ht.test(e[0])&&(t=r,e.shift()),!e.length)return o(t);e[0].indexOf("^")||(t||"^"==e[0]?e.shift():e[0]=e[0].substring(1)),t=o(t);for(var n;n=e.shift();)t=t[n]||(t[n]=C());return t}function o(t){return"commonjs"==Z?t?_(t)?t.exports:t:module.exports:t||e}function c(e){var t,n=Number(e);return isNaN(n)?(t=e+"")in nt?nt[t]:e:n}function i(e,t,n){n=n===!0,t||(t=e,e=C());for(var r in t)!j(t,r)||n&&j(e,r)||(e[r]=t[r]);return e}function a(e,t,n){return n=n===!0,t||(t=e,e=C()),Object.getOwnPropertyNames(t).reduce(function(e,r){return n&&j(e,r)||f(e,r,p(t,r)),e},e)}function f(e,n,u){var o,c,i,a,f=dt.call(arguments,3),s=y(e,n);switch(I(f[0])){case"string":c=it[f.shift()];break;case"object":c=f.shift();break;default:i=I(u),c="object"!=i&&s?p(e,n):null,!c||(c="function"==i?it.cw:it.cew)}return a=f.shift()===!0,o=f.shift()===!0,s&&!a?o&&Error(t+".def cannot overwrite existing property: "+n+", in item type: "+K(e)+"."):("object"!=i&&c&&(u=l(u,c)),(u.get||u.set)&&delete u.writable,Object.defineProperty(e,n,u)),r}function s(e,t,n,u,o){n||(n="cw");for(var c in t)!j(t,c)||f(e,c,t[c],n,u,o);return r}function l(e,t){return i("object"==I(e)?e:{value:e},"object"==I(t)?t:it[(t+"").toLowerCase()]||it.cew,!0)}function p(e,t){return Object.getOwnPropertyDescriptor(e,t)}function h(e){return!b(e)||!A(e)&&k(e)||!1}function b(e){return!(null===e||e===J||"number"==typeof e&&isNaN(e))}function g(t,n,r){"string"!=typeof n&&t[Q]&&(r=n,n=t[Q]);var u,o=C();return o[Q]=n,o[X]="library","commonjs"==Z&&_(r)?r.exports=t:(r||(r=e),(u=r[n])&&k(u)?(u[n]=t,t=a(u,t)):f(r,n,l({value:t},"ew")),"browser"==Z&&r===e&&("function"!=typeof define||!define.amd||define(n,[],function(){return t}))),s(t,o,"w",!0),t}function d(e){return e.name||e.displayName||((e+"").match(bt)||["",""])[1].trim()}function m(e){return w(e,Array.coerce(arguments,1))}function y(e,t){return t+""in Object(e)}function w(e,t,n){return(e+"").replace(n||lt,function(e,n){return t[n]||""})}function x(){return mt.replace(pt,v)}function v(e){var t=0|16*ft();return("x"==e?t:8|3&t).toString(16)}function j(e,t){return et.hasOwnProperty.call(Object(e),t+"")}function O(e,t){return e?y(e,"id")&&!h(e.id)?e.id:e.id=N(t):N(t)}function N(e){return(e||ct)+"-"+ ++ot}function _(e){if(null===tt)return!1;try{return e instanceof tt}catch(t){return!1}}function k(e){return y(e,"length")||"object"==I(e)}function A(e){return("length"in(e=Object(e))?e:Object.keys(e)).length}function E(e,t){var n;if(t)n=I(t);else switch(n=I(e)){case"array":case"object":t=e,e=new(t.constructor||Object);break;default:return e}switch(n){case"object":return Object.keys(t).reduce(S,{source:t,target:e}).target;case"array":return e.length=t.length,t.reduce(P,e);default:return t}}function P(e,t,n){return e[n]=I(e[n])===I(t)?E(e[n],t):E(t),e}function S(e,t){return e.target[t]=I(e.target[t])===I(e.source[t])?E(e.target[t],e.source[t]):E(e.source[t]),e}function B(){}function C(e){var t=Object.create(null);return"object"==typeof e?i(t,e):t}function F(e,t,n){var r;if(n+="",arguments.length>3){for(n=dt.call(arguments,2);r=n.shift();)if(F(e,t,r))return!0;return!1}if(e(t,n))return!0;if("string"!=typeof t&&~n.indexOf(".")){for(n=n.split(".");r=n.shift();){if(!F(e,t,r))return!1;t=t[r]}return!0}return!1}function L(e,t){for(var n=[e];t>=++e;)n.push(e);return n}function D(e,t){t=Array.isArray(t)?t:dt.call(arguments,1);var n=Array.isArray(e)?M:R;return t.forEach(n,e),e}function M(e){var t=this.indexOf(e);t=~t?t:!isNaN(e)&&e in this?e:t,0>t||this.splice(t,1)}function R(e){delete this[e]}function $(e){return et.toString.call(e)}function q(e){return et.valueOf.call(e)}function z(e){return e==ut?ut:e==rt||"nodelist"==e?rt:e.indexOf("htm")||e.lastIndexOf("element")+7!==e.length?!1:"htmlelement"}function I(e){var t=$(e);return t in at?at[t]:at[t]=t.split(" ")[1].split("]")[0].replace(gt,"$1").toLowerCase()}function K(e){if(null===e||e===J)return!1;var t=y(e,X)?e[X]:null===Object.getPrototypeOf(e)?"nullobject":J;return"object"!==t?t:F(j,e,"configurable","enumerable","writable")&&j(e,"value")||F(j,e,"get","set")?"descriptor":t}function T(e,t){if(!t)return E(e);switch(I(t)){case"object":return Object.keys(t).reduce(V,{source:t,target:e}).target;case"array":return t.reduce(U,e);default:return e}}function U(e,t,n){return e[n]=y(e,n)?I(e[n])==I(t)?T(e[n],t):e[n]:E(t),e}function V(e,t){return e.target[t]=y(e.target,t)?I(e.target[t])==I(e.source[t])?T(e.target[t],e.source[t]):e.target[t]:E(e.source[t]),e}function W(){return dt.call(arguments).forEach(H),r}function G(e){e(this,r)}function H(e){y(e,Y)||f(e,Y,0,"w");var t=yt[e[Q]||d(e)];t&&(t.slice(e[Y]).forEach(G,e),e[Y]=t.length)}"undefined"==typeof global?e:e=global;var J,Q="__name__",X="__type__",Y="__xid__",Z="undefined"!=typeof module&&"exports"in module&&"function"==typeof require?"commonjs":"undefined"!=typeof navigator?"browser":"other",et=Object.prototype,tt="commonjs"!=Z?null:require("module"),nt=[!1,0/0,null,!0,J].reduce(function(e,t){return e[t+""]=t,e},C()),rt="htmlcollection",ut="htmldocument",ot=999,ct="anon",it=function(){var e={ce:"ec",cw:"wc",ew:"we",cew:"cwe ecw ewc wce wec".split(" ")},t="configurable enumerable writable".split(" "),n={c:[!0,!1,!1],ce:[!0,!0,!1],cew:[!0,!0,!0],cw:[!0,!1,!0],e:[!1,!0,!1],ew:[!1,!0,!0],r:[!1,!1,!1],w:[!1,!1,!0]},r=Object.keys(n).reduce(function(r,u){function o(e){r[e]=r[u]}var c=e[u];return r[u]=t.reduce(function(e,t,r){return e[t]=n[u][r],e},C()),!c||(Array.isArray(c)?c.forEach(o):o(c)),r},C());return delete r[J],r}(),at="Array Boolean Date Function Null Number Object RegExp String Undefined".split(" ").reduce(function(e,t){return e["[object "+t+"]"]=t.toLowerCase(),e},C()),ft=Math.random,st=/global|window/i,lt=/\$?\{([^\}]+)\}/g,pt=/[xy]/g,ht=RegExp("^\\u005E?"+t),bt=/[\s\(]*function([^\(]+).*/,gt=/^[Ww]ebkit|[Mm]oz|O|[Mm]s|[Kk]html(.*)$/,dt=Array.prototype.slice,mt="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",yt={Array:[],Boolean:[],Date:[],Function:[],Number:[],Object:[],RegExp:[],String:[]};f(W,"cache",function(e,t){return"string"==typeof e||(e=e[Q]||d(e)),yt[e]||(yt[e]=[]),yt[e].push(t),r},"w"),W.cache("Array",function(e){var t=e.prototype;f(e,"coerce",function(e,t,n){return y(e,"length")?(t="number"==K(t)?t>0?t:0:0,n="number"==K(n)?n>t?n:0>=n?e.length+n:t+n:e.length,dt.call(e,t,n)):[e]},"w"),s(t,{find:function(e,t){var n=-1,r=this.length>>>0;for(t||(t=this);r>++n;)if(e.call(t,this[n],n,this))return this[n];return null},invoke:function(n){var r=e.coerce(arguments,1);return t.map.call(this,function(e){return e&&"function"==typeof e[n]?e[n].apply(e,r):J})},pluck:function(e,n){return n=n===!0,t.reduce.call(this,function(t,r){var u=Object.value(r,e);return n&&!b(u)||t.push(u),t},[])}},"w")}),W.cache("Boolean",function(e){f(e,"coerce",function(e){switch(K(e)){case"boolean":return e;case"nan":case!1:return!1;case"number":case"string":return!(e in nt?!nt[e]:0===Number(e))}return!0},"w")}),W.cache("Function",function(e){function t(e){return!e||e in o}function n(){return""+this}function r(){return this}var u="__xname__",o={Anonymous:!0,anonymous:!0},c={mimic:function(e,t){var u=e.valueOf();return s(this,{displayName:t||d(u),toString:n.bind(u),valueOf:r.bind(u)},"c",!0),this}};c[Q]={get:function(){if(!this[u]){var e=this.valueOf(),n=e!==this?t(e[Q])?null:e[Q]:null,r=n||d(this);!t(r)||t(this.displayName)||(r=this.displayName),f(this,u,r||"anonymous","w")}return this[u]}},s(e.prototype,c,"w"),f(e,"anon_list",{value:o},"w")}),W.cache("Object",function(e){f(e.prototype,X,i({get:function(){var e,t=this,n=t.constructor,r=I(t),u=z(r)||(st.test(r)?"global":!1);return u?u:"number"==r?isNaN(t)?"nan":"number":"object"==r&&"function"==typeof n&&"function"!=n[X]?(e=(n[Q]+"").toLowerCase(),e&&"anonymous"!=e?e:n[X]||r):r}},it.r)),f(e.prototype,"__proto__",{get:function(){return e.getPrototypeOf(this)}},"c"),s(e,{key:function(t,n){return e.keys(e(t)).find(function(e){return t[e]===n})},reduce:function(t,n,r){return e.keys(e(t)).reduce(function(e,r,u){return e=n.call(t,e,t[r],r,t,u)},r)},value:function(t,n){if(isNaN(n)){if(y(t,n))return t[n];if(~n.indexOf(".")){var r;for(n=n.split(".");(r=n.shift())&&(t=e.value(t,r))!==J;);return t}}return h(t)?J:b(t[n])?t[n]:"function"==typeof t.get?t.get(n):"function"==typeof t.getAttribute?t.getAttribute(n):J},values:function(t){return e.keys(Object(t)).map(function(e){return t[e]})}},"w")}),k(n)||(n="commonjs"==Z?module:e),s(r=g(r,t,n),{ENV:Z,global:{value:e},modes:{value:it},bless:u,coerce:c,copy:i,cpdef:a,def:f,defs:s,describe:l,description:p,empty:h,exists:b,expose:g,format:m,got:F.bind(null,y),gsub:w,guid:x,has:F.bind(null,j),id:O,iter:k,len:A,merge:E,nativeType:I,noop:B,ntype:I,obj:C,range:L,remove:D,tostr:$,type:K,update:T,valof:q,x:W},"w"),W(Object,Array,Boolean,Function)}(this,"m8"); |
@@ -30,3 +30,3 @@ { | ||
}, | ||
"version" : "0.3.4" | ||
"version" : "0.3.6" | ||
} |
@@ -941,2 +941,9 @@ # m8.js [![build status](https://secure.travis-ci.org/constantology/m8.png)](http://travis-ci.org/constantology/m8) | ||
### GET: Object.prototype.\_\_proto\_\_:String | ||
Some browsers — like MSIE 9 & 10 which `m8` supports — do not support the non-standard property `__proto__`. | ||
Luckily however, they do support `Object.getPrototypeOf`, which will return the same value as `__proto__`. | ||
`m8` conveniently wraps this call up inside the `__proto__` getter for those browsers, so you can (more) easily work with `Object` prototypes. | ||
### GET: Object.prototype.\_\_type\_\_:String | ||
@@ -949,4 +956,4 @@ Attempts to resolve a normalised type for any type that inherits from JavaScript's `Object.prototype`. See `m8.type` for more information. | ||
- m8.js ≅ 6.2kb (gzipped) | ||
- m8.min.js ≅ 3.5kb (minzipped) | ||
- m8.js ≅ 6.4kb (gzipped) | ||
- m8.min.js ≅ 3.6kb (minzipped) | ||
@@ -953,0 +960,0 @@ ## License |
@@ -112,3 +112,3 @@ function __lib__( val ) { return val; } | ||
if ( ENV == 'browser' ) | ||
if ( ENV == 'browser' && mod === root ) // don't expose as amd if lib is being added to a module that will be exposed | ||
typeof define != 'function' || !define.amd || define( name, [], function() { return lib; } ); | ||
@@ -115,0 +115,0 @@ } |
@@ -102,2 +102,8 @@ x.cache( 'Array', function( Type ) { | ||
def( Type.prototype, '__proto__', { | ||
get : function() { | ||
return Type.getPrototypeOf( this ); | ||
} // todo: set??? | ||
}, 'c' ); | ||
defs( Type, { | ||
@@ -104,0 +110,0 @@ key : function( item, val ) { |
@@ -380,2 +380,27 @@ typeof m8 !== 'undefined' || ( m8 = require( '../m8' ) ); | ||
test( 'Object.prototype.__proto__', function( done ) { | ||
function Collection() { | ||
this.push.apply( this, arguments ); | ||
return this; | ||
} | ||
m8.defs( Collection.prototype = [], { | ||
__type__ : 'collection', | ||
slice : function() { | ||
var val = this.__proto__.__proto__.slice.apply( this, arguments ); | ||
return Array.isArray( val ) ? Collection.apply( Object.create( Collection.prototype ), val ) : val; | ||
}, | ||
splice : function() { | ||
var val = this.__proto__.__proto__.splice.apply( this, arguments ); | ||
return Array.isArray( val ) ? Collection.apply( Object.create( Collection.prototype ), val ) : val; | ||
} | ||
}, 'cw', true ); | ||
var col = new Collection( 1, 2, 3, 4, 5 ); | ||
expect( m8.type( col.slice( 0 ) ) ).to.equal( 'collection' ); | ||
expect( col.slice( 1, 3 ).length ).to.equal( 2 ); | ||
expect( col.length ).to.equal( 5 ); | ||
done(); | ||
} ); | ||
test( '<static> Array.coerce returns an Array based on the passed item', function( done ) { | ||
@@ -382,0 +407,0 @@ expect( Array.coerce( [1, 2, 3] ) ).to.eql( [1, 2, 3] ); |
Sorry, the diff of this file is not supported yet
223217
3881
969