emoji-mart-lazyload/src/polyfills/createClass.js

20 lines
647 B
JavaScript
Raw Normal View History

2017-09-17 08:54:22 +00:00
const _Object = Object
2017-09-24 00:06:29 +00:00
export default (function createClass() {
2017-09-17 08:54:22 +00:00
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
2017-10-07 04:02:02 +00:00
var descriptor = props[i]
descriptor.enumerable = descriptor.enumerable || false
descriptor.configurable = true
if ('value' in descriptor) descriptor.writable = true
_Object.defineProperty(target, descriptor.key, descriptor)
2017-09-17 08:54:22 +00:00
}
}
2017-10-07 04:02:02 +00:00
return function(Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps)
if (staticProps) defineProperties(Constructor, staticProps)
return Constructor
}
})()