diff --git a/README.md b/README.md index 60a8fe4..e9c4a9b 100644 --- a/README.md +++ b/README.md @@ -457,15 +457,15 @@ Latest ✔ | Latest ✔ | 8+ Full ✔ | Latest ✔ | Latest ✔ | Latest ✔ | ## ES3/IE8 Compatibility -As an library there are numerous users which cannot control the browsers that their customers use. As such we need to ensure that this library continues to "work" and does not break the JS execution when loaded by an older browser. While it would be ideal to just not support IE8 and older generation (ES3) browsers there are numerous large customers/users that continue to require pages to "work" and as noted they may or cannot control which browser that their end users choose to use. +As a library there are numerous users which cannot control the browsers that their customers use. As such we need to ensure that this library continues to "work" and does not break the JS execution when loaded by an older browser. While it would be ideal to just not support IE8 and older generation (ES3) browsers there are numerous large customers/users that continue to require pages to "work" and as noted they may or cannot control which browser that their end users choose to use. As part of enabling ES3/IE8 support we have set the ```tsconfig.json``` to ES3 and ```uglify``` settings in ```rollup.config.js``` transformations to support ie8. This provides a first level of support which blocks anyone from adding unsupported ES3 features to the code and enables the generated javascript to be validily parsed in an ES3+ environment. Ensuring that the generated code is compatible with ES3 is only the first step, JS parsers will still parse the code when an unsupport core function is used, it will just fail or throw an exception at runtime. Therefore, we also need to require/use polyfil implementations or helper functions to handle those scenarios. -### ES3/IE8 Features, Solutions, Workarounds and Polyfil style helper functions +### ES3/IE8 Features, Solutions, Workarounds and Polyfill style helper functions -This table does not attempt to include ALL of the ES3 unsuported features, just the currently known functions that where being used at the time or writing. You are welcome to contribute to provide additional helpers, workarounds or documentation of values that should not be used. +This table does not attempt to include ALL of the ES3 unsupported features, just the currently known functions that where being used at the time or writing. You are welcome to contribute to provide additional helpers, workarounds or documentation of values that should not be used. | Feature | Description | Usage | |-----------|-----------------|------| @@ -473,7 +473,7 @@ This table does not attempt to include ALL of the ES3 unsuported features, just | ES5+ getters/setters
```Object.defineProperty(...)``` | Not provided by ES3 and not used | N/A | | ```Object.create(protoObj, [descriptorSet]?)``` | Not provided by ES3 and not used | N/A | | ```Object.defineProperties()``` | Not provided by ES3 and not used | N/A | -| ```Object.getOwnPropertyNames(obj)``` | Not provided by ES3 and not used | N/A | +| ```Object.getOwnPropertyNames(obj)``` | Not provided by ES3 and not used | ```_forEachProp(target:any, callback: (name: string) => void)``` | | ```Object.getPrototypeOf(obj)``` | Not provided by ES3 and not used | ```_getObjProto(target:any)``` | | ```Object.getOwnPropertyDescriptor(obj)``` | Not provided by ES3 and not used | N/A | | ```Object.preventExtensions(obj)``` | Not provided by ES3 and not used | N/A | diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index e5040ee..23b61f9 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -3,19 +3,19 @@ "version": "0.0.0", "dependencies": { "@babel/code-frame": { - "version": "7.10.4", + "version": "7.12.13", "from": "@babel/code-frame@^7.0.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz" + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz" }, "@babel/helper-validator-identifier": { - "version": "7.10.4", - "from": "@babel/helper-validator-identifier@^7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz" + "version": "7.12.11", + "from": "@babel/helper-validator-identifier@^7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz" }, "@babel/highlight": { - "version": "7.10.4", - "from": "@babel/highlight@^7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "version": "7.13.10", + "from": "@babel/highlight@^7.12.13", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", "dependencies": { "ansi-styles": { "version": "3.2.1", @@ -55,19 +55,19 @@ "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-rollup-es3/-/applicationinsights-rollup-es3-1.1.3.tgz" }, "@nodelib/fs.scandir": { - "version": "2.1.3", - "from": "@nodelib/fs.scandir@2.1.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz" + "version": "2.1.4", + "from": "@nodelib/fs.scandir@2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz" }, "@nodelib/fs.stat": { - "version": "2.0.3", + "version": "2.0.4", "from": "@nodelib/fs.stat@^2.0.2", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz" + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz" }, "@nodelib/fs.walk": { - "version": "1.2.4", + "version": "1.2.6", "from": "@nodelib/fs.walk@^1.2.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz" + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz" }, "@rush-temp/dynamicproto-js": { "version": "0.0.0", @@ -80,9 +80,9 @@ "resolved": "file:projects\\dynamicproto-rollup.tgz" }, "@types/estree": { - "version": "0.0.45", + "version": "0.0.46", "from": "@types/estree@*", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.45.tgz" + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.46.tgz" }, "@types/fs-extra": { "version": "8.1.1", @@ -100,9 +100,9 @@ "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz" }, "@types/node": { - "version": "14.11.7", + "version": "14.14.33", "from": "@types/node@*", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.7.tgz" + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.33.tgz" }, "@types/resolve": { "version": "0.0.8", @@ -283,9 +283,9 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz" }, "builtin-modules": { - "version": "3.1.0", + "version": "3.2.0", "from": "builtin-modules@^3.1.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz" + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz" }, "cache-base": { "version": "1.0.1", @@ -337,9 +337,9 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" }, "colorette": { - "version": "1.2.1", + "version": "1.2.2", "from": "colorette@^1.1.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz" + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz" }, "colors": { "version": "1.1.2", @@ -383,7 +383,7 @@ }, "dateformat": { "version": "3.0.3", - "from": "dateformat@>=3.0.3 <3.1.0", + "from": "dateformat@~3.0.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz" }, "debug": { @@ -567,9 +567,9 @@ } }, "fast-glob": { - "version": "3.2.4", + "version": "3.2.5", "from": "fast-glob@^3.0.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", "dependencies": { "braces": { "version": "3.0.2", @@ -582,9 +582,9 @@ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz" }, "glob-parent": { - "version": "5.1.1", + "version": "5.1.2", "from": "glob-parent@^5.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz" + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" }, "is-glob": { "version": "4.0.1", @@ -609,9 +609,9 @@ } }, "fastq": { - "version": "1.8.0", + "version": "1.11.0", "from": "fastq@^1.6.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz" + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz" }, "fd-slicer": { "version": "1.1.0", @@ -682,6 +682,11 @@ "from": "fs.realpath@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" }, + "function-bind": { + "version": "1.1.1", + "from": "function-bind@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" + }, "get-value": { "version": "2.0.6", "from": "get-value@>=2.0.6 <3.0.0", @@ -718,9 +723,9 @@ "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz" }, "graceful-fs": { - "version": "4.2.4", + "version": "4.2.6", "from": "graceful-fs@^4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz" + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz" }, "grunt": { "version": "1.3.0", @@ -825,6 +830,11 @@ "from": "gzip-size@>=3.0.0 <4.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-3.0.0.tgz" }, + "has": { + "version": "1.0.3", + "from": "has@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz" + }, "has-ansi": { "version": "2.0.0", "from": "has-ansi@>=2.0.0 <3.0.0", @@ -868,14 +878,14 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", "dependencies": { "debug": { - "version": "3.2.6", + "version": "3.2.7", "from": "debug@^3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz" + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz" }, "ms": { - "version": "2.1.2", + "version": "2.1.3", "from": "ms@^2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" } } }, @@ -900,9 +910,9 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" }, "ini": { - "version": "1.3.5", - "from": "ini@>=1.3.4 <2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz" + "version": "1.3.8", + "from": "ini@^1.3.4", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" }, "interpret": { "version": "1.1.0", @@ -936,6 +946,11 @@ "from": "is-buffer@>=1.1.5 <2.0.0", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz" }, + "is-core-module": { + "version": "2.2.0", + "from": "is-core-module@^2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz" + }, "is-data-descriptor": { "version": "0.1.4", "from": "is-data-descriptor@>=0.1.4 <0.2.0", @@ -1060,9 +1075,9 @@ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" }, "js-yaml": { - "version": "3.14.0", + "version": "3.14.1", "from": "js-yaml@~3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz" + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz" }, "jsmin2": { "version": "1.2.1", @@ -1092,9 +1107,9 @@ } }, "lodash": { - "version": "4.17.20", + "version": "4.17.21", "from": "lodash@~4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" }, "magic-string": { "version": "0.25.7", @@ -1154,9 +1169,9 @@ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz" }, "mime": { - "version": "2.4.6", + "version": "2.5.2", "from": "mime@^2.0.3", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz" + "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz" }, "minimatch": { "version": "3.0.4", @@ -1373,9 +1388,9 @@ "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.20.0.tgz", "dependencies": { "debug": { - "version": "4.2.0", + "version": "4.3.1", "from": "debug@^4.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz" + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz" }, "ms": { "version": "2.1.2", @@ -1389,6 +1404,11 @@ } } }, + "queue-microtask": { + "version": "1.2.2", + "from": "queue-microtask@^1.2.2", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz" + }, "readable-stream": { "version": "2.3.7", "from": "readable-stream@^2.2.2", @@ -1430,9 +1450,9 @@ "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz" }, "resolve": { - "version": "1.17.0", + "version": "1.20.0", "from": "resolve@^1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz" + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz" }, "resolve-dir": { "version": "1.0.1", @@ -1465,9 +1485,9 @@ "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz" }, "rollup-plugin-copy": { - "version": "3.3.0", + "version": "3.4.0", "from": "rollup-plugin-copy@^3.1.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.3.0.tgz", + "resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz", "dependencies": { "is-plain-object": { "version": "3.0.1", @@ -1519,9 +1539,9 @@ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz" }, "run-parallel": { - "version": "1.1.9", - "from": "run-parallel@>=1.1.9 <2.0.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz" + "version": "1.2.0", + "from": "run-parallel@^1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" }, "safe-buffer": { "version": "5.1.2", @@ -1637,9 +1657,9 @@ "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz" }, "source-map-url": { - "version": "0.4.0", - "from": "source-map-url@>=0.4.0 <0.5.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz" + "version": "0.4.1", + "from": "source-map-url@^0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz" }, "sourcemap-codec": { "version": "1.4.8", @@ -1711,9 +1731,9 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz" }, "tslib": { - "version": "1.14.0", + "version": "1.14.1", "from": "tslib@^1.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.0.tgz" + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" }, "tslint": { "version": "5.20.1", diff --git a/lib/docs/assets/js/search.js b/lib/docs/assets/js/search.js index 59c5fa2..e326e23 100644 --- a/lib/docs/assets/js/search.js +++ b/lib/docs/assets/js/search.js @@ -1,3 +1,3 @@ var typedoc = typedoc || {}; typedoc.search = typedoc.search || {}; - typedoc.search.data = {"kinds":{"1":"External module","32":"Variable","64":"Function","256":"Interface","1024":"Property","65536":"Type literal","2097152":"Object literal","4194304":"Type alias"},"rows":[{"id":0,"kind":1,"name":"\"DynamicProto\"","url":"modules/_dynamicproto_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":256,"name":"IDynamicProtoOpts","url":"interfaces/_dynamicproto_.idynamicprotoopts.html","classes":"tsd-kind-interface tsd-parent-kind-external-module","parent":"\"DynamicProto\""},{"id":2,"kind":1024,"name":"setInstFuncs","url":"interfaces/_dynamicproto_.idynamicprotoopts.html#setinstfuncs","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"\"DynamicProto\".IDynamicProtoOpts"},{"id":3,"kind":1024,"name":"useBaseInst","url":"interfaces/_dynamicproto_.idynamicprotoopts.html#usebaseinst","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"\"DynamicProto\".IDynamicProtoOpts"},{"id":4,"kind":32,"name":"DynAllowInstChkTag","url":"modules/_dynamicproto_.html#dynallowinstchktag","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":5,"kind":32,"name":"DynProtoDefaultOptions","url":"modules/_dynamicproto_.html#dynprotodefaultoptions","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":6,"kind":64,"name":"_hasVisited","url":"modules/_dynamicproto_.html#_hasvisited","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":7,"kind":64,"name":"_getInstFunc","url":"modules/_dynamicproto_.html#_getinstfunc","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":8,"kind":64,"name":"_getProtoFunc","url":"modules/_dynamicproto_.html#_getprotofunc","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":9,"kind":4194304,"name":"DynamicProtoDelegate","url":"modules/_dynamicproto_.html#dynamicprotodelegate","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"DynamicProto\""},{"id":10,"kind":65536,"name":"__type","url":"modules/_dynamicproto_.html#dynamicprotodelegate.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"\"DynamicProto\".DynamicProtoDelegate"},{"id":11,"kind":64,"name":"dynamicProto","url":"modules/_dynamicproto_.html#dynamicproto","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"DynamicProto\""},{"id":12,"kind":2097152,"name":"perfDefaults","url":"modules/_dynamicproto_.html#perfdefaults","classes":"tsd-kind-object-literal tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":13,"kind":32,"name":"setInstFuncs","url":"modules/_dynamicproto_.html#perfdefaults.setinstfuncs","classes":"tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported","parent":"\"DynamicProto\".perfDefaults"},{"id":14,"kind":32,"name":"useBaseInst","url":"modules/_dynamicproto_.html#perfdefaults.usebaseinst","classes":"tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported","parent":"\"DynamicProto\".perfDefaults"}]}; \ No newline at end of file + typedoc.search.data = {"kinds":{"1":"External module","32":"Variable","64":"Function","256":"Interface","1024":"Property","65536":"Type literal","2097152":"Object literal","4194304":"Type alias"},"rows":[{"id":0,"kind":1,"name":"\"DynamicProto\"","url":"modules/_dynamicproto_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":256,"name":"IDynamicProtoOpts","url":"interfaces/_dynamicproto_.idynamicprotoopts.html","classes":"tsd-kind-interface tsd-parent-kind-external-module","parent":"\"DynamicProto\""},{"id":2,"kind":1024,"name":"setInstFuncs","url":"interfaces/_dynamicproto_.idynamicprotoopts.html#setinstfuncs","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"\"DynamicProto\".IDynamicProtoOpts"},{"id":3,"kind":1024,"name":"useBaseInst","url":"interfaces/_dynamicproto_.idynamicprotoopts.html#usebaseinst","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"\"DynamicProto\".IDynamicProtoOpts"},{"id":4,"kind":32,"name":"DynAllowInstChkTag","url":"modules/_dynamicproto_.html#dynallowinstchktag","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":5,"kind":32,"name":"DynProtoDefaultOptions","url":"modules/_dynamicproto_.html#dynprotodefaultoptions","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":6,"kind":32,"name":"Obj","url":"modules/_dynamicproto_.html#obj","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":7,"kind":64,"name":"_forEachProp","url":"modules/_dynamicproto_.html#_foreachprop","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":8,"kind":64,"name":"_hasVisited","url":"modules/_dynamicproto_.html#_hasvisited","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":9,"kind":64,"name":"_getInstFunc","url":"modules/_dynamicproto_.html#_getinstfunc","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":10,"kind":64,"name":"_getProtoFunc","url":"modules/_dynamicproto_.html#_getprotofunc","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":11,"kind":4194304,"name":"DynamicProtoDelegate","url":"modules/_dynamicproto_.html#dynamicprotodelegate","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"DynamicProto\""},{"id":12,"kind":65536,"name":"__type","url":"modules/_dynamicproto_.html#dynamicprotodelegate.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"\"DynamicProto\".DynamicProtoDelegate"},{"id":13,"kind":64,"name":"dynamicProto","url":"modules/_dynamicproto_.html#dynamicproto","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"DynamicProto\""},{"id":14,"kind":2097152,"name":"perfDefaults","url":"modules/_dynamicproto_.html#perfdefaults","classes":"tsd-kind-object-literal tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"DynamicProto\""},{"id":15,"kind":32,"name":"setInstFuncs","url":"modules/_dynamicproto_.html#perfdefaults.setinstfuncs","classes":"tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported","parent":"\"DynamicProto\".perfDefaults"},{"id":16,"kind":32,"name":"useBaseInst","url":"modules/_dynamicproto_.html#perfdefaults.usebaseinst","classes":"tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported","parent":"\"DynamicProto\".perfDefaults"}]}; \ No newline at end of file diff --git a/lib/docs/interfaces/_dynamicproto_.idynamicprotoopts.html b/lib/docs/interfaces/_dynamicproto_.idynamicprotoopts.html index a59b791..0411aa2 100644 --- a/lib/docs/interfaces/_dynamicproto_.idynamicprotoopts.html +++ b/lib/docs/interfaces/_dynamicproto_.idynamicprotoopts.html @@ -2385,6 +2385,12 @@ img {
  • DynProtoDefaultOptions
  • +
  • + Obj +
  • +
  • + _forEachProp +
  • _getInstFunc
  • @@ -2441,7 +2447,7 @@ img {
    setInstFuncs: boolean
    @@ -2457,7 +2463,7 @@ img {
    useBaseInst: boolean
    diff --git a/lib/docs/modules/_dynamicproto_.html b/lib/docs/modules/_dynamicproto_.html index c7ee7d2..4240467 100644 --- a/lib/docs/modules/_dynamicproto_.html +++ b/lib/docs/modules/_dynamicproto_.html @@ -2377,6 +2377,12 @@ img {
  • DynProtoDefaultOptions
  • +
  • + Obj +
  • +
  • + _forEachProp +
  • _getInstFunc
  • @@ -2417,11 +2423,13 @@ img {

    Functions

    +
    + +

    Const Obj

    +
    Obj: ObjectConstructor = Object
    + +

    Functions

    +
    + +

    _forEachProp

    +
      +
    • _forEachProp(target: any, func: (name: string) => void): void
    • +
    +
      +
    • + +
      +
      +

      Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6 + are not enumerable.

      +
      +
      +

      Parameters

      +
        +
      • +
        target: any
        +
        +
        +
      • +
      • +
        func: (name: string) => void
        +
          +
        • +
            +
          • (name: string): void
          • +
          +
            +
          • +

            Parameters

            +
              +
            • +
              name: string
              +
            • +
            +

            Returns void

            +
          • +
          +
        • +
        +
      • +
      +

      Returns void

      +
    • +
    +

    _getInstFunc

    @@ -2546,7 +2616,7 @@ img {
  • Parameters

    @@ -2578,7 +2648,7 @@ img {
  • Parameters

    @@ -2607,7 +2677,7 @@ img {
  • @@ -2644,7 +2714,7 @@ img {
  • @@ -2753,7 +2823,7 @@ img {
    perfDefaults: object
    @@ -2769,7 +2839,7 @@ img {
    setInstFuncs: true = true
  • @@ -2779,7 +2849,7 @@ img {
    useBaseInst: true = true
    diff --git a/lib/package.json b/lib/package.json index 75cca4a..30ecba2 100644 --- a/lib/package.json +++ b/lib/package.json @@ -20,7 +20,6 @@ "doc": "./docs" }, "scripts": { - "postinstall": "node common/scripts/install-run-rush.js update --recheck --full", "clean": "grunt clean", "build": "npm run build:esm && npm run build:bundle && npm run lint && npm run docs", "build:esm": "grunt dynamicproto", diff --git a/lib/src/DynamicProto.ts b/lib/src/DynamicProto.ts index 876085d..3f8c1c5 100644 --- a/lib/src/DynamicProto.ts +++ b/lib/src/DynamicProto.ts @@ -84,11 +84,13 @@ const strUseBaseInst = 'useBaseInst'; */ const strSetInstFuncs = 'setInstFuncs'; +const Obj = Object; + /** * Pre-lookup to check if we are running on a modern browser (i.e. not IE8) * @ignore */ -let _objGetPrototypeOf = Object["getPrototypeOf"]; +let _objGetPrototypeOf = Obj["getPrototypeOf"]; /** * Internal Global used to generate a unique dynamic class name, every new class will increase this value @@ -101,17 +103,7 @@ let _dynamicNames = 0; * @ignore */ function _hasOwnProperty(obj:any, prop:string) { - return obj && Object[Prototype].hasOwnProperty.call(obj, prop); -} - -/** - * Checks if the passed of value is a function. - * @param {any} value - Value to be checked. - * @return {boolean} True if the value is a boolean, false otherwise. - * @ignore - */ -function _isFunction(value: any): boolean { - return typeof value === strFunction; + return obj && Obj[Prototype].hasOwnProperty.call(obj, prop); } /** @@ -119,7 +111,7 @@ function _isFunction(value: any): boolean { * @ignore */ function _isObjectOrArrayPrototype(target:any) { - return target && (target === Object[Prototype] || target === Array[Prototype]); + return target && (target === Obj[Prototype] || target === Array[Prototype]); } /** @@ -152,6 +144,31 @@ function _getObjProto(target:any) { return null; } +/** + * Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6 + * are not enumerable. + * @param target + */ +function _forEachProp(target: any, func: (name: string) => void) { + let props: string[] = []; + let getOwnProps = Obj["getOwnPropertyNames"]; + if (getOwnProps) { + props = getOwnProps(target); + } else { + for (let name in target) { + if (typeof name === "string" && _hasOwnProperty(target, name)) { + props.push(name); + } + } + } + + if (props && props.length > 0) { + for (let lp = 0; lp < props.length; lp++) { + func(props[lp]); + } + } +} + /** * Helper function to check whether the provided function name is a potential candidate for dynamic * callback and prototype generation. @@ -161,7 +178,7 @@ function _getObjProto(target:any) { * @ignore */ function _isDynamicCandidate(target:any, funcName:string, skipOwn:boolean) { - return (funcName !== Constructor && _isFunction(target[funcName]) && (skipOwn || _hasOwnProperty(target, funcName))); + return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName))); } /** @@ -184,13 +201,13 @@ function _getInstanceFuncs(thisTarget:any): any { var instFuncs = {}; // Save any existing instance functions - for (var name in thisTarget) { + _forEachProp(thisTarget, (name) => { // Don't include any dynamic prototype instances - as we only want the real functions if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) { // Create an instance callback for passing the base function to the caller instFuncs[name] = thisTarget[name]; } - } + }); return instFuncs; } @@ -218,7 +235,7 @@ function _hasVisited(values:any[], value:any) { */ function _getBaseFuncs(classProto:any, thisTarget:any, instFuncs:any, useBaseInst:boolean): any { function _instFuncProxy(target:any, funcHost: any, funcName: string) { - let theFunc = funcHost[name]; + let theFunc = funcHost[funcName]; if (theFunc[DynProxyTag] && useBaseInst) { // grab and reuse the hosted looking function (if available) otherwise the original passed function let instFuncTable = target[DynInstFuncTable] || {}; @@ -234,10 +251,10 @@ function _getBaseFuncs(classProto:any, thisTarget:any, instFuncs:any, useBaseIns // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced) var baseFuncs = {}; - for (var name in instFuncs) { + _forEachProp(instFuncs, (name) => { // Create an instance callback for passing the base function to the caller baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name); - } + }); // Get the base prototype functions var baseProto = _getObjProto(classProto); @@ -246,7 +263,7 @@ function _getBaseFuncs(classProto:any, thisTarget:any, instFuncs:any, useBaseIns // Don't include base object functions for Object, Array or Function while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) { // look for prototype functions - for (var name in baseProto) { + _forEachProp(baseProto, (name) => { // Don't include any dynamic prototype instances - as we only want the real functions // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return @@ -255,7 +272,7 @@ function _getBaseFuncs(classProto:any, thisTarget:any, instFuncs:any, useBaseIns // Create an instance callback for passing the base function to the caller baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name); } - } + }); // We need to find all possible functions that might be overloaded by walking the entire prototype chain // This avoids the caller from needing to check whether it's direct base class implements the function or not @@ -335,7 +352,7 @@ function _getProtoFunc(funcName: string, proto: any, currentDynProtoProxy: any) protoFunc = _getObjProto(proto)[funcName]; } - if (!_isFunction(protoFunc)) { + if (typeof protoFunc !== strFunction) { _throwTypeError("[" + funcName + "] is not a " + strFunction); } @@ -374,7 +391,7 @@ function _populatePrototype(proto:any, className:string, target:any, baseInstFun instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc; } - for (var name in target) { + _forEachProp(target, (name) => { // Only add overridden functions if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name] ) { // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function @@ -386,7 +403,7 @@ function _populatePrototype(proto:any, className:string, target:any, baseInstFun proto[name] = _createDynamicPrototype(proto, name); } } - } + }); } } diff --git a/rollup/package.json b/rollup/package.json index 5630fcc..9fe01af 100644 --- a/rollup/package.json +++ b/rollup/package.json @@ -16,7 +16,6 @@ "directories": { }, "scripts": { - "postinstall": "node common/scripts/install-run-rush.js update --recheck --full", "clean": "grunt clean", "build": "npm run build:esm && npm run build:bundle", "build:esm": "grunt rollup",