Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
library under construction
The Nature library provides a class (Thing
) which creates objects with strict, per-property type and value checking. This enables more fine-grained classification base on type and state. Say you have a Person
class, with nature you can create a sub-class of Person
in a particular state, e.g. Drunkard
, Scoundrel
, Leader
etc. These Things can be reused, subclassed or merged with other Things to create new hybrids. The Thing
class adds these features to each new object:
Enables you to write an API method like: (Scoundrel
and FlammableCar
are derivitives of Thing
)
exports.burnCar = function(arsonist){
var scoundrel = new Scoundrel(arsonist);
if (!scoundrel.valid){
throw new Error(scoundrel.validationMessages.join("\n"));
// throws:
// The arsonist supplied must be a Scoundrel, you passed a Metrosexual
// 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
scoundrel.igniteCar(car);
}
}
}
Client code for the above is straight forward. In this case burnCar()
input is taken directly from the command line. You can also pass the environment (process.env
), an object literal or a Thing
instance.
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
See the Thing docs for more detail..
FAQs
Naturalise your inventory
The npm package nature receives a total of 290 weekly downloads. As such, nature popularity was classified as not popular.
We found that nature demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.