Giter VIP home page Giter VIP logo

extendscript-es5-shim's Introduction

extendscript-es5-shim

A collection of ES5 shims for polyfiling Exendscript (for es6 shims take a look at https://github.com/ExtendScript/extendscript-es6-shim)

Installation

npm init -y
npm install extendscript-es5-shim

Usage

Array, String and Function notes

All polyfills could be used in your code.

Object notes

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:

defineProperty, defineProperties

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.

getOwnPropertyDescriptor

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.

freeze, preventExtensions, seal

Only validate input parameter and return input if it is an object.

isExtensible, isFrozen, isSealed

Validates input and returns TRUE, FALSE, FALSE, respectively if input parametr is an object.

These functions you can use in your code:

create

Support of property descriptor is in the same level as in defineProperty. Although, you can use this function in your code like this:

var obj1 = {a : 1};
var obj2 = Object.create(obj1, {b : {value : 2}});

or like that:

var obj1 = {a : 1};
var obj2 = Object.create(obj1);
obj2.b = 2;

getOwnPropertyNames

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.

keys

Use for in loop along with hasOwnProperty function to get own enumerable properties in object.

getPrototypeOf

Use build in __proto__ property as return value.

Development

  • Install the devDependencies by running npm install
  • Bundle the index.js by running npm run bundle
  • Add new prototypes in the respective folders
  • If you need new folders, add the folder to the top of ./bin/concat.js into the folders array

extendscript-es5-shim's People

Contributors

eugentepin avatar andyinabox avatar ff6347 avatar mudcube avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.