Skip to content

Commit

Permalink
fix: fix #284 by setting function name in try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Jun 28, 2018
1 parent c662540 commit f2a60f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/v35.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var bytesToUuid = require('./bytesToUuid');
function uuidToBytes(uuid) {
// Note: We assume we're being passed a valid uuid string
var bytes = [];
const el =
uuid.replace(/[a-fA-F0-9]{2}/g, function(hex) {
bytes.push(parseInt(hex, 16));
});
Expand Down Expand Up @@ -43,9 +44,10 @@ module.exports = function(name, version, hashfunc) {
return buf || bytesToUuid(bytes);
};

// only attempt to set the name if's configurable (which it should be on node > 0.12)
if (Object.getOwnPropertyDescriptor(generateUUID, 'name').configurable) {
Object.defineProperty(generateUUID, 'name', {value: name});
// Function#name is not settable on some platforms (#270)
try {
generateUUID.name = name;
} catch (err) {
}

// Pre-defined namespaces, per Appendix C
Expand Down

0 comments on commit f2a60f2

Please sign in to comment.