JXA-Cookbook / JXA-Cookbook

Cookbook for JavaScript for Automation in Mac OS X Yosemite
2.88k stars 116 forks source link

osx-jxa should have full es6 support now, I think #23

Closed joedaniels29 closed 5 years ago

joedaniels29 commented 7 years ago

The guides could use an update, Happy to help out with it if wanted

JMichaelTX commented 7 years ago

Just to be clear, ES6 requires macOS Sierra 10.12+.

macOS El Capitan 10.11.6 is partially compliant with ES6. Anyone have a complete list of ES6 features supported by macOS 10.11.6?

Also of use, is this script written by @RobTrew, which will clearly identify whether or not JXA (as run in Script Editor) is ES6 compliant:

(function () {
    'use strict';

    try {
        eval('[1, 2, 3].map(x => x * 2)');
        return 'ES6';
    } catch (e) {
        return 'ES5';
    }
})();
ELLIOTTCABLE commented 7 years ago

Similarly, you can check ES2016 (‘ES7’) compliance pretty trivially:

(function () {
   'use strict'

   try {
      eval('2 ** 2')
      return 'ES2016'
   } catch (e) { return false }
})()
Tatsh commented 7 years ago

You can use the compat-table scripts, but they may require editing.