Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var module, moduleKeywords,
- indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
- moduleKeywords = ['extended,included'];
- module = (function() {
- function module() {}
- module.extend = function(obj) {
- var key, ref, value;
- for (key in obj) {
- value = obj[key];
- if (indexOf.call(moduleKeywords, key) < 0) {
- this[key] = value;
- }
- }
- if ((ref = obj.extended) != null) {
- ref.apply(this);
- }
- return this;
- };
- module.include = function(obj) {
- var key, ref, value;
- for (key in obj) {
- value = obj[key];
- if (indexOf.call(moduleKeywords, key) < 0) {
- this.prototype[key] = value;
- }
- }
- if ((ref = obj.included) != null) {
- ref.apply(this);
- }
- return this;
- };
- return module;
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement