fc-replace
v1.3.1
Published
Easy find/replace!!
Downloads
10
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!