README
js-decode-if-json
A helper method that decodes a value if json else defaults to an input value.
const test = decodeIfJson('Hello World', { defaultValue: 'Hello World Default' });
console.log(test); // { defaultValue: 'Hello World Default' }
A helper method that decodes a value if json else defaults to an input value.
<script type="module">
import annoaiJsDecodeIfJson from 'https://cdn.skypack.dev/@annoai/js-decode-if-json';
</script>
A helper method that decodes a value if json else defaults to an input value.
const test = decodeIfJson('Hello World', { defaultValue: 'Hello World Default' });
console.log(test); // { defaultValue: 'Hello World Default' }