Sha256: b75cdb3043eb693afba6166f05aa95d3b09be872cf2eceb0b7f55afb09db699e

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

	if (is_undefined(Function.prototype['method'])) {
		Function.prototype.method = function(name, func) {
			if (is_undefined(name)) {
				throw new SyntaxError("Object.method(name, func): name is undefined");
			}

			if (is_undefined(func)) {
				throw new SyntaxError("Object.method(name, func): func is undefined");
			}

			if (is_undefined(this.prototype[name])) {
				this.prototype[name] = func;
				return this;
			}
		};
	}

	if (is_undefined(window.unless)) {
	   window.unless = function(expression, callback, fallback) {
			if (is_undefined(expression)) {
				throw new SyntaxError("unless(expression, callback[, fallback]): expression is undefined");
			}

			if (is_undefined(callback)) {
				throw new SyntaxError("unless(expression, callback[, fallback]): callback is undefined");
			}

			if (!expression) {
				callback.call(this);
			}
			else if (is_defined(fallback)) {
				fallback.call(this);
			}
	   };
	}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ninjs-0.14.1 repository/ninjs/core/extend.js
ninjs-0.14.0 repository/ninjs/core/extend.js