UNPKG

strapi-pfapi

Version:

a strapi plugin library uses local and redis caches to achieve single digit milliseconds on average api response time.

18 lines (17 loc) 415 B
'use strict'; module.exports = (value) => { if (value === undefined) { throw new Error('value is undefined'); } if (Buffer.isBuffer(value)) { return value.toString('utf-8'); } if (typeof value === 'string' && value !== '') { try { value = JSON.parse(value); } catch(err) { //console.error(err.message); } } return value; }