1.0.0 • Published 5 years ago

hook-factory v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

🏭 Hook Factory

📕 Index

💪 Installing

yarn add hook-factor

📒 Usage

import Factory from "hook-factory";

const data = {
    count: 0
};

const modifier = ({
    prehook: data => {
        data.count++
        return data;
    },
    posthook: data => {
        data.count++
        return data;
    }
});

const modifiers = [modifier];

const newCount = factory({
    data,
    modifiers
});

console.log(newCount);
// { count: 2}