@solana/pay
Version:
`@solana/pay` is a JavaScript library for facilitating commerce on Solana by using a token transfer URL scheme. The URL scheme ensures that no matter the wallet or service used, the payment request must be created and interpreted in one standard way.
11 lines (9 loc) • 403 B
text/typescript
import type { Reference, References } from '../types.js';
/**
* Normalize a single reference or array of references into a consistent array form.
* Returns undefined when the input is undefined.
*/
export function normalizeReferences(reference: References | undefined): Reference[] | undefined {
if (!reference) return undefined;
return Array.isArray(reference) ? reference : [reference];
}