Sha256: 0c31346ff5751b348a2cef13639f34abddfcdcf5a04216880943afb65279a645

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

import { Descriptor } from './properties';
export default function descriptor(desc) {
    return new NativeDescriptor(desc);
}
/**
  A wrapper for a native ES5 descriptor. In an ideal world, we wouldn't need
  this at all, however, the way we currently flatten/merge our mixins require
  a special value to denote a descriptor.

  @class NativeDescriptor
  @private
*/
class NativeDescriptor extends Descriptor {
    constructor(desc) {
        super();
        this.desc = desc;
        this.enumerable = desc.enumerable !== false;
        this.configurable = desc.configurable !== false;
    }
    setup(obj, key, meta) {
        Object.defineProperty(obj, key, this.desc);
        meta.writeDescriptors(key, this);
    }
    get(obj, key) {
        return obj[key];
    }
    set(obj, key, value) {
        return (obj[key] = value);
    }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/metal/lib/descriptor.js