Home Blog CV Projects Patterns Notes Book Colophon Search

Default Values withDefaults()

function withDefaults(target, origSpec) {
    return function(spec) {
        let combinedSpec = {};
        Object.assign(combinedSpec, origSpec, spec)
        return target(combinedSpec);
    }
}

Copyright James Gardner 1996-2020 All Rights Reserved. Admin.