ES5 Object.assign equivalent

In underscore.js you can use like, _.extend(firstObj, secondObj); In jQuery, you can use, $.extend({},firstObj,secondObj); In pure javascipt, you can merge n number of objects by using this function: function mergeObjects() { var resObj = {}; for(var i=0; i < arguments.length; i += 1) { var obj = arguments[i], keys = Object.keys(obj); for(var j=0; j < … Read more

ES7 Getting result from an array of promises using await generator

As mentioned in the issue you filed, the core issue is that await* is no longer a thing and has been removed. Unfortunately, it was not properly throwing a syntax error in Babel 6 and was essentially being treated like a normal await. You’ll need to explicitly let [p1, p2] = await Promise.all([ System.import(‘./package1.js’), System.import(‘./package2.js’)]);

JavaScript ES6: Test for arrow function, built-in function, regular function?

Believe it or not… Testing for presence of “=>” in string representation of a function is likely the most reliable way (but not 100%). Obviously we can’t test against either of 2 conditions you mentioned — lack of prototype property and lack of [[Construct]] as that might give false positives with either host objects or … Read more

Is it possible to reset an ECMAScript 6 generator to its initial state?

If your intention is to some other scope, iterate over it, do some other stuff, then be able to iterate over it again later on in that same scope. Then the only thing you shouldn’t try doing is passing the iterator, instead pass the generator: var generator = function*() { yield 1; yield 2; yield … Read more

ECMAScript:Harmony / ES6 to JavaScript compiler

(shameless but relevant plug below) Caja is reworking its ES5 support via ES5/3 and will do the same for ES harmony. So our structure would be implemented as a Harmony to ES3 layer which can be skipped for real harmony implementations, and then a separable loader that preserves the security properties that concern caja. Like … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)