mirror of
https://github.com/strapi/strapi.git
synced 2025-08-03 06:18:37 +00:00
17 lines
313 B
JavaScript
17 lines
313 B
JavaScript
'use strict';
|
|
|
|
const { parseType } = require('strapi-utils');
|
|
|
|
const createParser = () => (type, value) => {
|
|
if (value === null) return null;
|
|
|
|
switch (type) {
|
|
case 'json':
|
|
return JSON.stringify(value);
|
|
default:
|
|
return parseType({ type, value });
|
|
}
|
|
};
|
|
|
|
module.exports = { createParser };
|