Skip to content

Documentation / @facturometro/validator / normalizeSpace

Function: normalizeSpace() ​

normalizeSpace(value): string

Defined in: packages/validator/src/engine/selectors.ts:61

XPath's normalize-space(): collapses runs of XML whitespace to one space and strips it from both ends. Only space, tab, CR and LF count, as in XPath; other Unicode whitespace is content.

Parameters ​

value ​

string | undefined

The text; undefined (an absent element) normalizes to the empty string.

Returns ​

string

The normalized text.

Example ​

ts
import { normalizeSpace } from '@facturometro/validator';

normalizeSpace('  EUR \n'); // 'EUR'
normalizeSpace(undefined); // ''

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.