mirror of
https://github.com/strapi/strapi.git
synced 2025-07-28 03:20:17 +00:00
27 lines
691 B
JavaScript
27 lines
691 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
const { curry } = require('lodash/fp');
|
||
|
|
||
|
const pipeAsync = require('../pipe-async');
|
||
|
const traverseEntity = require('../traverse-entity');
|
||
|
|
||
|
const { removePassword, removePrivate } = require('./visitors');
|
||
|
|
||
|
const sanitizePasswords = curry((schema, entity) => {
|
||
|
return traverseEntity(removePassword, { schema }, entity);
|
||
|
});
|
||
|
|
||
|
const sanitizePrivates = curry((schema, entity) => {
|
||
|
return traverseEntity(removePrivate, { schema }, entity);
|
||
|
});
|
||
|
|
||
|
const defaultSanitizeOutput = curry((schema, entity) => {
|
||
|
return pipeAsync(sanitizePrivates(schema), sanitizePasswords(schema))(entity);
|
||
|
});
|
||
|
|
||
|
module.exports = {
|
||
|
sanitizePasswords,
|
||
|
sanitizePrivates,
|
||
|
defaultSanitizeOutput,
|
||
|
};
|