UNPKG

@levabala/react-native-uuid

Version:

react-native-uuid is a zero-dependency TypeScript implementation of RFC4122.

32 lines (28 loc) 600 B
import {byteToHex} from './utils'; // **`unparse()` - Convert UUID byte array (ala parse()) into a string** export const unparse = (buf: Array<number>, offset?: number) => { let i = offset || 0; let bth = byteToHex; return ( bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] ); };