mirror of
https://github.com/strapi/strapi.git
synced 2025-07-20 23:47:46 +00:00
18 lines
394 B
JavaScript
18 lines
394 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
const { yup, formatYupErrors } = require('strapi-utils');
|
||
|
|
||
|
const hasPermissionsSchema = yup.array().of(yup.string());
|
||
|
|
||
|
const validateHasPermissionsInput = data => {
|
||
|
try {
|
||
|
return hasPermissionsSchema.validateSync(data, { strict: true, abortEarly: true });
|
||
|
} catch (e) {
|
||
|
throw new Error(formatYupErrors(e));
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports = {
|
||
|
validateHasPermissionsInput,
|
||
|
};
|