Skip to content

Commit f2a60f2

Browse files
committed
fix: fix #284 by setting function name in try-catch
1 parent c662540 commit f2a60f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/v35.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var bytesToUuid = require('./bytesToUuid');
33
function uuidToBytes(uuid) {
44
// Note: We assume we're being passed a valid uuid string
55
var bytes = [];
6+
const el =
67
uuid.replace(/[a-fA-F0-9]{2}/g, function(hex) {
78
bytes.push(parseInt(hex, 16));
89
});
@@ -43,9 +44,10 @@ module.exports = function(name, version, hashfunc) {
4344
return buf || bytesToUuid(bytes);
4445
};
4546

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

5153
// Pre-defined namespaces, per Appendix C

0 commit comments

Comments
 (0)