diff --git a/lib/v35.js b/lib/v35.js index 842c60ea..1f05d38d 100644 --- a/lib/v35.js +++ b/lib/v35.js @@ -43,7 +43,10 @@ module.exports = function(name, version, hashfunc) { return buf || bytesToUuid(bytes); }; - generateUUID.name = name; + // 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}); + } // Pre-defined namespaces, per Appendix C generateUUID.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';