fluentnode
Version:
Fluent apis for node (based on the concepts used in C#'s FluentSharp
65 lines (53 loc) • 1.36 kB
JavaScript
// Generated by CoffeeScript 1.12.7
(function() {
Number.prototype.add = function(value) {
if (is_Number(value)) {
return this + value;
} else {
return this;
}
};
Number.prototype.dec = function(value) {
if (is_Number(value)) {
return this - value;
} else {
return this - 1;
}
};
Number.prototype.in_Between = function(min, max) {
return (min < this && this < max);
};
Number.prototype.inc = function(value) {
if (is_Number(value)) {
return this + value;
} else {
return this + 1;
}
};
Number.prototype.invoke_After = function(callback) {
if (callback instanceof Function) {
return setTimeout(callback, this);
}
};
Number.prototype.wait = Number.prototype.invoke_After;
Number.prototype.is_Number = function() {
return this instanceof Number && this.str().is_Not('NaN');
};
Number.prototype.log = function() {
return console.log(this.toString());
};
Number.prototype.random = function(start_From) {
var value;
value = ~~(Math.random() * this);
if (start_From) {
return value + start_From;
}
return value;
};
Number.prototype.str = function() {
return this.toString();
};
Number.prototype.to_Decimal = function() {
return Number.parseFloat(this.toFixed(4));
};
}).call(this);