Skip to content

azz0r/hook-factory

Repository files navigation

🏭 Hook Factory

📕 Index

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}