MCPcopy
hub / github.com/uuidjs/uuid / stringify

Function stringify

src/stringify.ts:43–56  ·  view source on GitHub ↗
(arr: Uint8Array, offset = 0)

Source from the content-addressed store, hash-verified

41}
42
43function stringify(arr: Uint8Array, offset = 0) {
44 const uuid = unsafeStringify(arr, offset);
45
46 // Consistency check for valid UUID. If this throws, it's likely due to one
47 // of the following:
48 // - One or more input array values don't map to a hex octet (leading to
49 // "undefined" in the uuid)
50 // - Invalid input values for the RFC `version` or `variant` fields
51 if (!validate(uuid)) {
52 throw TypeError('Stringified UUID is invalid');
53 }
54
55 return uuid;
56}
57
58export default stringify;

Callers 3

v7.test.tsFile · 0.50
stringify.test.tsFile · 0.50
parse.test.tsFile · 0.50

Calls 2

unsafeStringifyFunction · 0.85
validateFunction · 0.70

Tested by

no test coverage detected