⌈⌋ ⎇ branch:  Bitrhythm


Artifact Content

Artifact dd651c6bc28cc58e39e9d977ab6c62ce9ad7f25a0191b76b2d30effc97f20b17:


import extend from './extend'

/**
 * Helper function to set an immutable property
 * @param   { Object } el - object where the new property will be set
 * @param   { String } key - object key where the new property will be stored
 * @param   { * } value - value of the new property
 * @param   { Object } options - set the propery overriding the default options
 * @returns { Object } - the initial object
 */
export default function define(el, key, value, options) {
  Object.defineProperty(el, key, extend({
    value,
    enumerable: false,
    writable: false,
    configurable: true
  }, options))
  return el
}