MCPcopy Create free account
hub / github.com/Azure/powershell / parse

Function parse

lib/index.js:1128–1158  ·  view source on GitHub ↗
(uuid)

Source from the content-addressed store, hash-verified

1126function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1127
1128function parse(uuid) {
1129 if (!(0, _validate.default)(uuid)) {
1130 throw TypeError('Invalid UUID');
1131 }
1132
1133 let v;
1134 const arr = new Uint8Array(16); // Parse ########-....-....-....-............
1135
1136 arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
1137 arr[1] = v >>> 16 & 0xff;
1138 arr[2] = v >>> 8 & 0xff;
1139 arr[3] = v & 0xff; // Parse ........-####-....-....-............
1140
1141 arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
1142 arr[5] = v & 0xff; // Parse ........-....-####-....-............
1143
1144 arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
1145 arr[7] = v & 0xff; // Parse ........-....-....-####-............
1146
1147 arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
1148 arr[9] = v & 0xff; // Parse ........-....-....-....-############
1149 // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
1150
1151 arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
1152 arr[11] = v / 0x100000000 & 0xff;
1153 arr[12] = v >>> 24 & 0xff;
1154 arr[13] = v >>> 16 & 0xff;
1155 arr[14] = v >>> 8 & 0xff;
1156 arr[15] = v & 0xff;
1157 return arr;
1158}
1159
1160var _default = parse;
1161exports["default"] = _default;

Callers 5

validFunction · 0.85
cleanFunction · 0.85
diffFunction · 0.85
prereleaseFunction · 0.85
coerceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…