UNPKG

msw

Version:

Seamless REST/GraphQL API mocking library for browser and Node.js.

9 lines (8 loc) 210 B
/** * Creates an immutable copy of the given array. */ export function toReadonlyArray<T>(source: Array<T>): ReadonlyArray<T> { const clone = [...source] as Array<T> Object.freeze(clone) return clone }