function computeOnce(target, key, descriptor) {
    const {value, get} = descriptor;
    throwIf(!isFunction(value) && !isFunction(get),
        '@computeOnce must be applied to a zero-argument class method or getter.'
    );

    const isMethod = isFunction(value),
        baseFnName = isMethod ? 'value' : 'get',
        baseFn = isMethod ? value : get;
    return {
        ...descriptor,
        [baseFnName]: function() {
            return getOrCreate(this, '_xh_' + key, () => baseFn.call(this));
        }
    };
}
/**
 * Modify a method or getter so that it will compute once lazily and then cache the results.
 * Not appropriate for methods that take arguments. Typically useful on immutable objects.
 */
Modify a method or getter so that it will compute once lazily and then cache the results.
Not appropriate for methods that take arguments. Typically useful on immutable objects.
Modify a method or getter so that it will compute once lazily and then cache the results . Not appropriate for methods that take arguments . Typically useful on immutable objects .
function computeOnce(target, key, descriptor) {
    const {value, get} = descriptor;
    throwIf(!isFunction(value) && !isFunction(get),
        '@computeOnce must be applied to a zero-argument class method or getter.'
    );
    const isMethod = isFunction(value),
        baseFnName = isMethod ? 'value' : 'get',
        baseFn = isMethod ? value : get;
    return {
        ...descriptor,
        [baseFnName]: function() {
            return getOrCreate(this, '_xh_' + key, () => baseFn.call(this));
        }
    };
}
function computeOnce ( target , key , descriptor ) { const { value , get } = descriptor ; throwIf ( ! isFunction ( value ) && ! isFunction ( get ) , '@computeOnce must be applied to a zero-argument class method or getter.' ) ; const isMethod = isFunction ( value ) , baseFnName = isMethod ? 'value' : 'get' , baseFn = isMethod ? value : get ; return { ... descriptor , [ baseFnName ] : function ( ) { return getOrCreate ( this , '_xh_' + key , ( ) => baseFn . call ( this ) ) ; } } ; }
Modify a method or getter so that it will compute once lazily and then cache the results.
Modify a method or getter so that it will compute once lazily and then cache the results .