---
title: "API de Utilidades y Tipos"
description: "Referencia de SchemaLocations, CurrencyDecimals, RegimenCapitalRemover, SatNsDefinitionsMover, helpers DOM/XML y tipos TypeScript."
canonical_url: "https://nodecfdi.com/packages/cfdi-core/api-reference/utilities-and-types-api"
---

> Index of every page on this site: [llms.txt](https://nodecfdi.com/llms.txt)

Referencia de las clases utilitarias, funciones globales y tipos exportados en `@nodecfdi/cfdi-core` y `@nodecfdi/cfdi-core/types`.

## `SchemaLocations`

- `constructor(pairs?: Record<string, string>)`
- `size: number` / `length: number` (getters)
- `isEmpty(): boolean`
- `pairs(): Record<string, string>`
- `has(namespace: string): boolean`
- `getNamespacesWithoutLocation(): string[]`
- `hasAnyNamespaceWithoutLocation(): boolean`
- `append(namespace: string, location: string): void`
- `remove(namespace: string): void`
- `asString(): string`
- `[Symbol.iterator](): IterableIterator<[string, string]>`
- `static fromString(schemaLocationValue: string, includeLastUnpairedItem?: boolean): SchemaLocations`
- `static fromStringStrictXsd(schemaLocationValue: string): SchemaLocations`

## `CurrencyDecimals`

- `constructor(currency: string, decimals: number)`
- `currency(): string`
- `decimals(): number`
- `round(value: Decimal.Value): Decimal`
- `doesNotExceedDecimals(value: string): boolean`
- `static decimalsCount(value: string): number`
- `static newFromKnownCurrencies(currency: string, defaultDecimals?: number): CurrencyDecimals`
- `static knownCurrencyDecimals(currency: string): number`

## `RegimenCapitalRemover`

- `constructor(...suffixes: string[])`
- `remove(name: string): string`
- `static createDefault(): RegimenCapitalRemover`

## `SatNsDefinitionsMover`

- `move(root: XmlNodeInterface): void`

## Funciones de formato y números

- `formatNumber(value: Decimal.Value, decimals?: number): string`
- `formatDatetime(value: Date | number, useUtc?: boolean): string`
- `toFloat(value: string): number`
- `roundNumber(num: Decimal.Value, precision: number): number`

## Funciones DOM y XML

- `getParser(): DOMParser`
- `getSerializer(): XMLSerializer`
- `getDomImplementation(): DOMImplementation`
- `isNode(nodo: unknown): nodo is Node & { nodeType: number }`
- `isElement(nodo: unknown): nodo is Element`
- `isAttribute(nodo: unknown): nodo is Attr`
- `isText(nodo: unknown): nodo is Text`
- `isDocument(nodo: unknown): nodo is Document`
- `isCDataSection(nodo: unknown): nodo is CDATASection`
- `documentElement(document: Document): Element`
- `ownerDocument(node: Node): Document`
- `newDocument(document?: Document): Document`
- `newDocumentContent(content: string): Document`
- `isValidXmlName(name: string): boolean`
- `createDomElement(makeElement: () => Element, errorMessage: string, content: string): Element`
- `createElement(document: Document, name: string, content?: string): Element`

## Tipos (`@nodecfdi/cfdi-core/types`)

- `AttributeName<T extends string = string>`
- `AttributesRecord<T extends string = string>`
- `XmlNodeInterface<TAttributes extends string = string>`
- `ContainerWithAttributeInterface`
- `NamespaceFilter`

## Re-exportaciones externas

- Desde `@xmldom/xmldom`: `Attr`, `CDATASection`, `Document`, `DOMImplementation`, `DOMParser`, `Element`, `MIME_TYPE`, `NAMESPACE`, `Node`, `onErrorStopParsing`, `Text`, `XMLSerializer`.
- Desde `decimal.js`: `Decimal`.

## Sitemap

See the full [sitemap](https://nodecfdi.com/sitemap.md) for all pages.
