| /*! (C) Andrea Giammarchi - MIT Style License */ | ||
| var Class=Class||function(e){"use strict";function x(e,t,n){for(var r,s=[],o=0;o<e.length;o++)r=A(e[o]),h.call(r,i)&&s.push(r[i]),T(r,t,n,!1,!1);return s}function T(e,t,n,r,i){for(var s,o=typeof e!="function",u=g(e),a=0;a<u.length;a++)s=u[a],(o||!w.test(s))&&L(s,i)&&(h.call(t,s)&&_("duplicated: "+s),O(n,t,s,m(e,s),r))}function N(e,t){var n=function(){};return e&&""+t!=""+n?function(){return t.apply(this,arguments)}:n}function C(e,t,n,r){var i=k(t,r);v(e,t,{enumerable:!1,configurable:i,writable:i,value:n})}function k(e,t){return t?!/^[A-Z_]+$/.test(e):!0}function L(e,f){return e!==t&&e!==n&&e!==r&&e!==s&&e!==o&&e!==u&&e!==a&&(f||e!==i)}function A(t){if(typeof t=="object")return t;t.length&&_((t.name||"Class")+" should not expect arguments");for(var n,r,i,s={init:t},o=t.prototype;o&&o!==e.prototype;o=b(o))for(n=0,i=g(o);n<i.length;n++)r=i[n],L(r,!1)&&!h.call(s,r)&&v(s,r,m(o,r));return s}function O(e,t,n,r,i){var s=h.call(r,"value"),o,u;if(i){if(h.call(t,n))return}else s?(u=r.value,typeof u=="function"&&E.test(u)&&(r.value=D(e,n,u,i))):(P(e,n,r,"get"),P(e,n,r,"set"));o=k(n,i),r.enumerable=!1,r.configurable=o,s&&(r.writable=o),v(t,n,r)}function M(e,t){for(var n,r,i=0;i<e.length;i++){n=e[i];for(r in n)h.call(n,r)&&!h.call(t,r)&&_(r+" is not implemented")}}function _(e){try{console.warn(e)}catch(t){}}function D(e,t,n,r){return function(){h.call(this,u)||C(this,u,null,r);var i=this[u],s=this[u]=e[t],o=n.apply(this,arguments);return this[u]=i,o}}function P(e,t,n,r,i){h.call(n,r)&&E.test(n[r])&&(n[r]=D(m(e,t),r,n[r],i))}var t="constructor",n="extends",r="implements",i="init",s="prototype",o="static",u="super",a="with",f="__proto__",l=["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],c=!{valueOf:0}[l[2]](l[5]),h=e[l[0]],p=e.create||function(e){var t=this instanceof p;return p[s]=t?d:e,t?this:new p},d=p[s],v=e.defineProperty,m=e.getOwnPropertyDescriptor,g=e.getOwnPropertyNames||function(e){var t=[],n,r;for(r in e)h.call(e,r)&&t.push(r);if(c)for(n=0;n<l.length;n++)r=l[n],h.call(e,r)&&t.push(r);return t},y=e.getPrototypeOf,b=y||function(e){return e[f]||null},w=new RegExp("^(?:"+g(function(){}).join("|")+")$"),E=/\bsuper\b/.test(function(){this["super"]()})?/\bsuper\b/:/.*/;try{v({},"{}",{})}catch(S){"__defineGetter__"in{}?(v=function(e,t,n){return h.call(n,"value")?e[t]=n.value:(h.call(n,"get")&&e.__defineGetter__(t,n.get),h.call(n,"set")&&e.__defineSetter__(t,n.set)),e},m=function(e,t){var n=e.__lookupGetter__(t),r=e.__lookupSetter__(t),i={};return n||r?(n&&(i.get=n),r&&(i.set=r)):i.value=e[t],i}):(v=function(e,t,n){return e[t]=n.value,e},m=function(e,t){return{value:e[t]}})}return function(e){var i=h.call(e,t),u=h.call(e,n),l=u&&e[n],c=u&&typeof l=="function",d=c?l[s]:l,v=i?e[t]:N(c,l),m=u&&i&&E.test(v),g=u?p(d):v[s],b,w;return m&&(v=D(d,t,v,!1)),h.call(e,a)&&(b=x([].concat(e[a]),g,d),w=b.length,w&&(v=function(e){return function(){var t=0;while(t<w)b[t++].call(this);return e.apply(this,arguments)}}(v),v[s]=g)),h.call(e,o)&&T(e[o],v,d,!0,!0),u&&(l!==d&&T(l,v,d,!0,!0),v[s]=g),g[t]!==v&&C(g,t,v,!1),T(e,g,d,!1,!0),h.call(e,r)&&M([].concat(e[r]),g),u&&!y&&C(g,f,d,!1),v}}(Object); | ||
| var Class=Class||function(e){"use strict";function N(e,t,n){for(var r,s=[],o=0;o<e.length;o++)r=D(e[o]),p.call(r,i)&&s.push(r[i]),C(r,t,n,!1,!1);return s}function C(e,t,n,r,i){for(var s,o=typeof e!="function",u=y(e),a=0;a<u.length;a++)s=u[a],(o||S.call(E,s)<0)&&M(s,i)&&(p.call(t,s)&&B("duplicated: "+s),P(n,t,s,g(e,s),r))}function k(e,t){var n=function(){};return e&&""+t!=""+n?function(){return t.apply(this,arguments)}:n}function L(e,t,n,r){var i=O(t,r);m(e,t,{enumerable:!1,configurable:i,writable:i,value:n})}function A(e){return e?(e<65||90<e)&&(e<97||122<e)&&e!==95:!0}function O(e,t){return t?!_(e):!0}function M(e,f){return e!==t&&e!==n&&e!==r&&e!==s&&e!==o&&e!==u&&e!==a&&(f||e!==i)}function _(e){for(var t,n=0;n<e.length;n++){t=e.charCodeAt(n);if((t<65||90<t)&&t!==95)return!1}return!0}function D(t){if(typeof t=="object")return t;t.length&&B((t.name||"Class")+" should not expect arguments");for(var n,r,i,s={init:t},o=t.prototype;o&&o!==e.prototype;o=w(o))for(n=0,i=y(o);n<i.length;n++)r=i[n],M(r,!1)&&!p.call(s,r)&&m(s,r,g(o,r));return s}function P(e,t,n,r,i){var s=p.call(r,"value"),o,u;if(i){if(p.call(t,n))return}else s?(u=r.value,typeof u=="function"&&x(u)&&(r.value=j(e,n,u,i))):(F(e,n,r,"get"),F(e,n,r,"set"));o=O(n,i),r.enumerable=!1,r.configurable=o,s&&(r.writable=o),m(t,n,r)}function H(e,t){for(var n,r,i=0;i<e.length;i++){n=e[i];for(r in n)p.call(n,r)&&!p.call(t,r)&&B(r+" is not implemented")}}function B(e){try{console.warn(e)}catch(t){}}function j(e,t,n,r){return function(){p.call(this,u)||L(this,u,null,r);var i=this[u],s=this[u]=e[t],o=n.apply(this,arguments);return this[u]=i,o}}function F(e,t,n,r,i){p.call(n,r)&&x(n[r])&&(n[r]=j(g(e,t),r,n[r],i))}var t="constructor",n="extends",r="implements",i="init",s="prototype",o="static",u="super",a="with",f="__proto__",l=["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],c={}[l[2]]||function(e){for(var t in this)if(e===t)return this.hasOwnProperty(e);return!1},h=!c.call({valueOf:0},l[5]),p=e[l[0]],d=e.create||function(e){var t=this instanceof d;return d[s]=t?v:e,t?this:new d},v=d[s],m=e.defineProperty,g=e.getOwnPropertyDescriptor,y=e.getOwnPropertyNames||function(e){var t=[],n,r;for(r in e)p.call(e,r)&&t.push(r);if(h)for(n=0;n<l.length;n++)r=l[n],p.call(e,r)&&t.push(r);return t},b=e.getPrototypeOf,w=b||function(e){return e[f]||null},E=y(function(){}),S=E.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},x=(""+function(){this["super"]()}).indexOf(u)<0?function(){return!0}:function(e){var t=""+e,n=t.indexOf(u);return n<0?!1:A(t.charCodeAt(n-1))&&A(t.charCodeAt(n+5))};try{m({},"{}",{})}catch(T){"__defineGetter__"in{}?(m=function(e,t,n){return p.call(n,"value")?e[t]=n.value:(p.call(n,"get")&&e.__defineGetter__(t,n.get),p.call(n,"set")&&e.__defineSetter__(t,n.set)),e},g=function(e,t){var n=e.__lookupGetter__(t),r=e.__lookupSetter__(t),i={};return n||r?(n&&(i.get=n),r&&(i.set=r)):i.value=e[t],i}):(m=function(e,t,n){return e[t]=n.value,e},g=function(e,t){return{value:e[t]}})}return function(e){var i=p.call(e,t),u=p.call(e,n),l=u&&e[n],c=u&&typeof l=="function",h=c?l[s]:l,v=i?e[t]:k(c,l),m=u&&i&&x(v),g=u?d(h):v[s],y,w;return m&&(v=j(h,t,v,!1)),p.call(e,a)&&(y=N([].concat(e[a]),g,h),w=y.length,w&&(v=function(e){return function(){var t=0;while(t<w)y[t++].call(this);return e.apply(this,arguments)}}(v),v[s]=g)),p.call(e,o)&&C(e[o],v,h,!0,!0),u&&(l!==h&&C(l,v,h,!0,!0),v[s]=g),g[t]!==v&&L(g,t,v,!1),C(e,g,h,!1,!0),p.call(e,r)&&H([].concat(e[r]),g),u&&!b&&L(g,f,h,!1),v}}(Object); |
+67
-21
| /*! | ||
| Copyright (C) 2014 by Andrea Giammarchi - @WebReflection | ||
| Copyright (C) 2015 by Andrea Giammarchi - @WebReflection | ||
@@ -53,5 +53,12 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| // Espruino 1.7x does not have (yet) Object.prototype.propertyIsEnumerable | ||
| propertyIsEnumerable = {}[nonEnumerables[2]] || function (p) { | ||
| for (var k in this) if (p === k) return this.hasOwnProperty(p); | ||
| return false; | ||
| }, | ||
| // IE < 9 bug only | ||
| hasIEEnumerableBug = !{valueOf:0}[nonEnumerables[2]](nonEnumerables[5]), | ||
| hasIEEnumerableBug = !propertyIsEnumerable.call({valueOf:0}, nonEnumerables[5]), | ||
| // shortcut for own properties | ||
| hOP = Object[nonEnumerables[0]], | ||
@@ -108,17 +115,33 @@ | ||
| // when public static are copied over | ||
| nativeFunctionOPN = new RegExp('^(?:' + gOPN(function () {}).join('|') + ')$'), | ||
| nativeFunctionOPN = gOPN(function () {}), | ||
| indexOf = nativeFunctionOPN.indexOf || function (v) { | ||
| for (var i = this.length; i-- && this[i] !== v;) {} | ||
| return i; | ||
| }, | ||
| superRegExp = /\bsuper\b/.test(function () { | ||
| // this test should never be minifier sensistive | ||
| trustSuper = ('' + function () { | ||
| // this test should never be minifier sensitive | ||
| // or the indexOf check after will fail | ||
| this['super'](); | ||
| }) ? /\bsuper\b/ : /.*/ | ||
| // In 2010 Opera 10.5 for Linux Debian 6 | ||
| // goes nut with methods to string representation, | ||
| // truncating pieces of text in an unpredictable way. | ||
| // If you are targeting such browser | ||
| // be aware that super invocation might fail. | ||
| // This is the only exception I could find | ||
| // from year 2000 to modern days browsers | ||
| // plus everything else would work just fine. | ||
| }).indexOf(SUPER) < 0 ? | ||
| // In 2010 Opera 10.5 for Linux Debian 6 | ||
| // goes nut with methods to string representation, | ||
| // truncating pieces of text in an unpredictable way. | ||
| // If you are targeting such browser | ||
| // be aware that super invocation might fail. | ||
| // This is the only exception I could find | ||
| // from year 2000 to modern days browsers | ||
| // plus everything else would work just fine. | ||
| function () { return true; } : | ||
| // all other JS engines should be just fine | ||
| function (method) { | ||
| var | ||
| str = '' + method, | ||
| i = str.indexOf(SUPER) | ||
| ; | ||
| return i < 0 ? | ||
| false : | ||
| isBoundary(str.charCodeAt(i - 1)) && | ||
| isBoundary(str.charCodeAt(i + 5)); | ||
| } | ||
| ; | ||
@@ -199,3 +222,3 @@ | ||
| if ( | ||
| (noFunctionCheck || !nativeFunctionOPN.test(key)) && | ||
| (noFunctionCheck || indexOf.call(nativeFunctionOPN, key) < 0) && | ||
| isNotASpecialKey(key, allowInit) | ||
@@ -234,6 +257,16 @@ ) { | ||
| // is key is UPPER_CASE and the property is public static | ||
| // verifies a specific char code is not in [A-Za-z_] | ||
| // used to avoid RegExp for non RegExp aware environment | ||
| function isBoundary(code) { | ||
| return code ? | ||
| (code < 65 || 90 < code) && | ||
| (code < 97 || 122 < code) && | ||
| code !== 95 : | ||
| true; | ||
| } | ||
| // if key is UPPER_CASE and the property is public static | ||
| // it will define the property as non configurable and non writable | ||
| function isConfigurable(key, publicStatic) { | ||
| return publicStatic ? !/^[A-Z_]+$/.test(key) : true; | ||
| return publicStatic ? !isPublicStatic(key) : true; | ||
| } | ||
@@ -256,2 +289,15 @@ | ||
| // verifies the entire string is upper case | ||
| // and contains eventually an underscore | ||
| // used to avoid RegExp for non RegExp aware environment | ||
| function isPublicStatic(key) { | ||
| for(var c, i = 0; i < key.length; i++) { | ||
| c = key.charCodeAt(i); | ||
| if ((c < 65 || 90 < c) && c !== 95) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
| // will eventually convert classes or constructors | ||
@@ -296,3 +342,3 @@ // into trait objects, before assigning them as such | ||
| value = descriptor.value; | ||
| if (typeof value === 'function' && superRegExp.test(value)) { | ||
| if (typeof value === 'function' && trustSuper(value)) { | ||
| descriptor.value = wrap(inherits, key, value, publicStatic); | ||
@@ -362,3 +408,3 @@ } | ||
| function wrapGetOrSet(inherits, key, descriptor, gs, publicStatic) { | ||
| if (hOP.call(descriptor, gs) && superRegExp.test(descriptor[gs])) { | ||
| if (hOP.call(descriptor, gs) && trustSuper(descriptor[gs])) { | ||
| descriptor[gs] = wrap( | ||
@@ -384,3 +430,3 @@ gOPD(inherits, key), | ||
| createConstructor(hasParentPrototype, parent), | ||
| hasSuper = hasParent && hasConstructor && superRegExp.test(constructor), | ||
| hasSuper = hasParent && hasConstructor && trustSuper(constructor), | ||
| prototype = hasParent ? create(inherits) : constructor[PROTOTYPE], | ||
@@ -387,0 +433,0 @@ mixins, |
+1
-1
@@ -1,2 +0,2 @@ | ||
| Copyright (C) 2014 by Andrea Giammarchi - @WebReflection | ||
| Copyright (C) 2015 by Andrea Giammarchi - @WebReflection | ||
@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
+1
-1
| { | ||
| "version": "1.1.0", | ||
| "version": "1.2.0", | ||
| "license": "MIT", | ||
@@ -4,0 +4,0 @@ "name": "es-class", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
34004
5.47%436
11.22%