diff --git a/lib/v35.js b/lib/v35.js index 1f05d38d..7e1af903 100644 --- a/lib/v35.js +++ b/lib/v35.js @@ -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)); }); @@ -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