@webqit/observer
Version:
A simple set of functions for intercepting and observing JavaScript objects and arrays.
23 lines (20 loc) • 439 B
JavaScript
/**
* ---------------------------
* The Descriptor class
* ---------------------------
*/
export default class Descriptor {
/**
* Initializes the instance.
*
* @param array|object target
* @param object dfn
*
* @return void
*/
constructor( target, dfn ) {
this.target = target;
if ( !( dfn.operation ) ) throw new Error( 'Descriptor operation must be given in definition!' );
Object.assign( this, dfn );
}
}