Comparing version 0.0.1 to 0.0.2
@@ -456,3 +456,2 @@ // module dependencies | ||
} | ||
@@ -459,0 +458,0 @@ return result; |
{ | ||
"name": "nature", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A library to help classify the things (models) in your world (app) and how they interact.", | ||
@@ -5,0 +5,0 @@ "main": "lib/nature.js", |
@@ -1,2 +0,2 @@ | ||
** under construction ** | ||
***library under construction*** | ||
@@ -11,30 +11,30 @@ Nature | ||
Enables you to write API methods like: (`YoungMan` and `FlammableCar` are derivitives of `Thing`) | ||
exports.burnCar = function(arsonist){ | ||
var youngMan = new YoungMan(arsonist); | ||
if (!youngMan.valid){ | ||
throw new Error(youngMan.validationMessages.join("\n")); | ||
// throws: | ||
// The arsonist supplied must be a young man. | ||
// Invalid age 29: Must be between 11 and 19. | ||
// Over 5 litres Gasoline required | ||
// Less compassion necessary. | ||
} else { | ||
var car = new FlammableCar(process.env); | ||
if (car.valid){ | ||
// the Vauxhall Astra supplied in the environment is indeed flammable | ||
youngMan.igniteCar(car); | ||
} | ||
```javascript | ||
exports.burnCar = function(arsonist){ | ||
var youngMan = new YoungMan(arsonist); | ||
if (!youngMan.valid){ | ||
throw new Error(youngMan.validationMessages.join("\n")); | ||
// throws: | ||
// The arsonist supplied must be a young man. | ||
// Invalid age 29: Must be between 11 and 19. | ||
// Over 5 litres Gasoline required | ||
// Less compassion necessary. | ||
} else { | ||
var car = new FlammableCar(process.env); | ||
if (car.valid){ | ||
// the Vauxhall Astra supplied in the environment is indeed flammable | ||
youngMan.igniteCar(car); | ||
} | ||
} | ||
} | ||
``` | ||
Client code for the above is straight forward, input taken directly from the command line | ||
var outdoors = require("outdoor-activity"); | ||
outdoors.burnCar(process.argv); | ||
```javascript | ||
var outdoors = require("outdoor-activity"); | ||
outdoors.burnCar(process.argv); | ||
``` | ||
Then a simple command executes the outdoor activity: | ||
$ CAR_MAKE=Vauxhall CAR_MODEL=Astra node outdoors.js --name Alfie --age 11 --litres 13 --compassion unknown | ||
```sh | ||
$ CAR_MAKE=Vauxhall CAR_MODEL=Astra node outdoors.js --name Alfie --age 11 --litres 13 --compassion unknown | ||
``` | ||
See the Thing docs for more detail.. |
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
69335