Comparing version 9.0.4 to 9.0.5
@@ -169,2 +169,8 @@ /** | ||
// Fold case for `typesafe` (tolerate "typeSafe") | ||
if (!_.isUndefined(machineDefinition.typeSafe)) { | ||
machineDefinition.typesafe = machineDefinition.typeSafe; | ||
delete machineDefinition.typeSafe; | ||
} | ||
// Define a callable machine function | ||
@@ -210,2 +216,6 @@ // | ||
}; | ||
_callableMachineWrapper.unsafe = function (){ | ||
var machineInstance = new Machine(machineDefinition); | ||
return machineInstance.unsafe.apply(machineInstance, Array.prototype.slice.call(arguments)); | ||
}; | ||
@@ -212,0 +222,0 @@ // Next, expose the rest of the machine definition as properties on the wrapper fn. |
@@ -60,3 +60,3 @@ /** | ||
}, | ||
build: this.constructor.build | ||
build: _.bind(self.constructor.build, self.constructor) | ||
}; | ||
@@ -76,6 +76,20 @@ | ||
// unsafe mode completely disables input validation, and sets _runTimeTypeCheck, _inputCoercion | ||
// and _exitCoercion to `false` (they can be reactivated if chained after the call to `.unsafe()`) | ||
// unsafe mode completely disables validation and coercion of both inputs and exits | ||
// by setting `_runTimeTypeCheck`, `_inputCoercion` ,and `_exitCoercion` to `false`. | ||
// (they can be reactivated if chained after the call to the `.unsafe()` helper method) | ||
this._unsafeMode = false; | ||
// if `typesafe` is enabled, then the machine will have validation and coercion | ||
// completely disabled by default-- so immediately call `.unsafe(true)` | ||
if (this.typesafe) { | ||
console.log(' * * * * * * * * * * * * * * * * ~••~ * * * * * * * * * * * * * * * * * * *'); | ||
console.log(' * NOTE: `typesafe` is experimental and not ready for production use! *'); | ||
console.log(' * It is generally not a good idea to use this, and there is a high *'); | ||
console.log(' * likelihood the feature will be removed altogether; or that its API *'); | ||
console.log(' * will change significantly and without notice in an upcoming release. *'); | ||
console.log(' * * * * * * * * * * * * * * * * ~••~ * * * * * * * * * * * * * * * * * * *'); | ||
this.unsafe(true); | ||
} | ||
// a flag tracking whether or not the machine is running synchronously | ||
this._runningSynchronously = false; | ||
@@ -82,0 +96,0 @@ |
@@ -35,2 +35,3 @@ /** | ||
// Only validate & coerce configured input values if `unsafeMode` is disabled. | ||
var coercedInputValues; | ||
@@ -46,3 +47,3 @@ if (!self._unsafeMode) { | ||
// if any inputs are invalid. | ||
// TODO: call a special 'failedInputValidation' exit here | ||
// TODO: call a special '_failedInputValidation' exit here | ||
if(self._runTimeTypeCheck) { | ||
@@ -49,0 +50,0 @@ // Fourth argument (`true`) tells switchback to run synchronously |
{ | ||
"name": "machine", | ||
"version": "9.0.4", | ||
"version": "9.0.5", | ||
"description": "Configure and execute machines", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77550
28
1747