1.3.1 • Published 3 years ago

fc-replace v1.3.1

Weekly downloads
9
License
-
Repository
-
Last release
3 years ago

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!

1.3.1

3 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.0.0

4 years ago