mirror of
https://github.com/strapi/strapi.git
synced 2025-11-05 12:24:35 +00:00
20 lines
303 B
JavaScript
20 lines
303 B
JavaScript
|
|
'use strict';
|
||
|
|
|
||
|
|
const parseBoolean = value => {
|
||
|
|
if (typeof value === 'boolean') return value;
|
||
|
|
|
||
|
|
if (['true', 't', '1', 1].includes(value)) {
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (['false', 'f', '0', 0].includes(value)) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
return Boolean(value);
|
||
|
|
};
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
parseBoolean,
|
||
|
|
};
|