|
1 |
| -# extendscript-es6-shim |
| 1 | +# extendscript-es6-shim |
| 2 | +A collection of ES6 shims for polyfiling Exendscript (for es5 shims take a look at https://github.com/ExtendScript/extendscript-es5-shim) |
| 3 | + |
| 4 | +## Installation |
| 5 | + |
| 6 | +Currently you can install the package using npm: |
| 7 | + |
| 8 | + npm init -y |
| 9 | + npm install git+https://github.com/ExtendScript/extendscript-es6-shim.git |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +## Array, String and Function notes |
| 14 | +All polyfills could be used in your code. |
| 15 | + |
| 16 | +<!-- ## Object notes |
| 17 | +Because it is impossible to emulate property descriptors in ES3 engine, the following functions are just a mocks and you should avoid to use them in your code if it is possible, only shim thirdparty libraries: |
| 18 | + |
| 19 | +### defineProperty, defineProperties |
| 20 | +Supports only **_data descriptor_**. **_Writable_**, **_enumerable_** and **_configurable_** properties of descriptor are ignored. If you try to define **_set_** or **_get_** propperty this methods will throw an error. |
| 21 | +
|
| 22 | +### getOwnPropertyDescriptor |
| 23 | +Supports only **_data descriptor_**. **_Configurable_** property of descriptor is always **TRUE**. **_Enumerable_** and **_writable_** properties of descriptor will be always **TRUE** on user defined objects, but may vary on build in. |
| 24 | +
|
| 25 | +### freeze, preventExtensions, seal |
| 26 | +Only validate input parameter and return input if it is an object. |
| 27 | +
|
| 28 | +### isExtensible, isFrozen, isSealed |
| 29 | +Validates input and returns **TRUE, FALSE, FALSE, respectively** if input parametr is an object. |
| 30 | +
|
| 31 | +
|
| 32 | +**These functions you can use in your code:** |
| 33 | +
|
| 34 | +### create |
| 35 | +Support of property descriptor is in the same level as in _**defineProperty**_. Although, you can use this function in your code like this: |
| 36 | +
|
| 37 | +```js |
| 38 | +var obj1 = {a : 1}; |
| 39 | +var obj2 = Object.create(obj1, {b : {value : 2}}); |
| 40 | +``` |
| 41 | +
|
| 42 | +or like that: |
| 43 | +
|
| 44 | +```js |
| 45 | +var obj1 = {a : 1}; |
| 46 | +var obj2 = Object.create(obj1); |
| 47 | +obj2.b = 2; |
| 48 | +``` |
| 49 | +
|
| 50 | +
|
| 51 | +### getOwnPropertyNames |
| 52 | +This function uses reflection interface, that ExtendScript provides (see JavaScript Tools Guide), to get own properties of an object (enumerable or not). But ther is no guarantee that the order of enumeration will be the same as in _for in loop_. |
| 53 | + |
| 54 | +### keys |
| 55 | +Use _for in loop_ along with _hasOwnProperty_ function to get own enumerable properties in object. |
| 56 | +
|
| 57 | +### getPrototypeOf |
| 58 | +Use build in `__proto__` property as return value. --> |
| 59 | + |
| 60 | +## Development |
| 61 | + |
| 62 | +- Install the devDependencies by running `npm install` |
| 63 | +- Bundle the index.js by running `npm run bundle` |
| 64 | +- Add new prototypes in the respective folders |
| 65 | +- If you need new folders, add the folder to the top of `./bin/concat.js` into the `folders` array |
| 66 | + |
| 67 | + |
| 68 | + |
0 commit comments