Comparing version 13.0.0-7 to 13.0.0-8
@@ -63,4 +63,12 @@ /** | ||
// Build up a constant array of unconventional method names | ||
// (used below to show a warning if a machine identity looks too similar to native JS or Node stuff.) | ||
var UNCONVENTIONAL_METHOD_NAMES = [ | ||
'inspect', 'toString', 'valueOf', 'toLocaleString', | ||
'prototype', 'constructor', | ||
'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable' | ||
]; | ||
// Get the `Machine` constructor | ||
@@ -118,4 +126,10 @@ var Machine = this; | ||
// Determine the method name. | ||
var methodName = Machine.getMethodName(machineInstance.identity); | ||
if (_.contains(UNCONVENTIONAL_METHOD_NAMES, methodName)) { | ||
console.warn('Warning: Machine "'+machineInstance.identity+'" has an unconventional identity that, when converted to a method name (`'+methodName+'`), could conflict with native features of JavaScript/Node.js. Please consider changing it!'); | ||
} | ||
// Expose the machine as a method on our Pack dictionary. | ||
memo[Machine.getMethodName(machineInstance.identity)] = machineInstance; | ||
memo[methodName] = machineInstance; | ||
} | ||
@@ -197,3 +211,8 @@ catch (e) { | ||
// Determine the method name. | ||
var methodName = Machine.getMethodName(rawNMDef.identity); | ||
if (_.contains(UNCONVENTIONAL_METHOD_NAMES, methodName)) { | ||
console.warn('Warning: Machine "'+rawNMDef.identity+'" has an unconventional identity that, when converted to a method name (`'+methodName+'`), could conflict with native features of JavaScript/Node.js. Please consider changing it!'); | ||
} | ||
memo[methodName] = Machine.build(rawNMDef); | ||
@@ -200,0 +219,0 @@ return memo; |
{ | ||
"name": "machine", | ||
"version": "13.0.0-7", | ||
"version": "13.0.0-8", | ||
"description": "Configure and execute machines", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
166314
2909