This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mixin() { | |
return JSON.parse('{' | |
+ [].reduce.call(arguments, function (prev, cur) { | |
var str = JSON.stringify(cur); | |
if (!str || str.slice(0, 1) !== '{' || str.slice(-1) !== '}') { | |
throw new Error('Invalid object: ' + str); | |
} | |
return (prev ? prev + ',' : '') | |
+ str.slice(1, -1); | |
}, null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
class Person { | |
constructor(arg = { | |
firstName: 'John', | |
lastName: 'Doe' | |
}) { | |
({ | |
firstName: this.firstName = '<FIRSTNAME_UNKNOWN>', | |
lastName: this.lastName = '<LASTNAME_UNKNOWN>' | |
} = arg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function IIFE() { | |
'use strict'; | |
function counter() { | |
this.def = 0; | |
return (function() { | |
return this.def++; | |
}).bind(this); | |
}; | |
var obj = {}; | |
Object.defineProperties(obj, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function IIFE() { | |
'use strict'; | |
var obj = {}; | |
Object.defineProperties(obj, { | |
counter: { | |
get: (function IIFE() { | |
var def = 0; | |
return function() { | |
return def++; | |
} |