UNPKG

@e22m4u/js-repository

Version:

Реализация репозитория для работы с базами данных в Node.js

20 lines (18 loc) 518 B
import {InvalidArgumentError} from '../../../../../errors/index.js'; /** * Trim transformer. * * @param {*} value * @param {undefined} options * @param {object} context * @returns {string|undefined|null} */ export function trimTransformer(value, options, context) { if (value == null) return value; if (typeof value === 'string') return value.trim(); throw new InvalidArgumentError( 'The property transformer %v requires a String value, but %v given.', context.transformerName, value, ); }