0.1.0 • Published 10 years ago

snowblower v0.1.0

Weekly downloads
2
License
-
Repository
-
Last release
10 years ago

SnowBlower!

Snow Throwing

Start up your engines and make a snow blower!

Simply include SnowBlower.js on your page or install via NPM.

npm install snowblower

SnowBlower is AMD and RequireJS compliant.

var SnowBlower = require('snowblower');
//or..

require(['snowblower'], function(SnowBlower){

});

Closures

They are defined like this:

function closure(args...) {
    //this is the object you are creating
    var a = {};//hidden private variables
    
    this.a = 'test property';
}

Once the script is loaded, use it like a factory.

Mixins

Typical mixins happen using this function: SnowBlower.mixIn(target, source)

Mixins can exist inside of a factory, just be careful, because the first object reference that gets passed to the factory will become the object's prototype.

var factory = SnowBlower({/*prototype*/}, mixinObject);

Creating the object

var myFactory = SnowBlower(protoObj, functionClosure, mixinObject, mixinObject2);

myFactory([args...]);
//or..
myFactory();
//returns an object

Note, if any of the arguments are undefined, an argument is an array, or there are no parameters, it will return an object at that point.

SnowBlower(proto, func, [params]);
//returns an object

SnowBlower(proto, func, void 0);
SnowBlower(proto, func, undefined, [], whatever);
//returns an object using proto and func

It is curryable and stops at predictable points.

SnowBlower(proto)(obj)(func)();

Testing SnowBlower

Test with npm start first to install mocha, and then npm test thereafter.

Made with love using the MIT license.

0.1.0

10 years ago