fc-replace

Easy find/replace!!

Usage no npm install needed!

<script type="module">
  import fcReplace from 'https://cdn.skypack.dev/fc-replace';
</script>

README

FIND + REPLACE = EASY!

https://fc-replace.surge.sh/ LIVE PLAYGROUND!

import replace from "fc-replace";

// Convert JSON to React Props!

const output = replace(
    `{ 
    "hasSingle": true, 
    "isClean": "black", 
    "red": 52 
}`,
    [
        {
            // Remove object curly brackets
            pattern: /\}|\{/g,
            replace: ``,
        },
        {
            // Easy variable replace!
            pattern: `"~1~": ~AZ~~,| ~`,
            replace: `$1={$2} `,
        },
    ]
);
console.info("OUTPUT:", output);
/* 
OUTPUT:
hasSingle={true}
isClean={"black"}
red={52}
*/

See tests and src folder for many more examples!