Permalink
Browse files

Properly bundle npm dependency

  • Loading branch information...
1 parent 8867aa4 commit 8fb7917ee8c9cff174b293b5f74dedc51f764f62 @felixge committed Jul 6, 2011
View
2 .gitignore
@@ -0,0 +1,2 @@
+*.un~
+/node_modules
View
4 node_modules/oop/Makefile
@@ -1,4 +0,0 @@
-SHELL := /bin/bash
-
-test-integration:
- @find test/integration/test-*.js | xargs -n 1 -t node
View
11 node_modules/oop/Readme.md
@@ -1,11 +0,0 @@
-# oop
-
-## Purpose
-
-This library tries to bring basic oop features to JavaScript while being as
-light-weight and simple as possible.
-
-
-## Todo
-
-* Documentation
View
1 node_modules/oop/lib/index.js
@@ -1 +0,0 @@
-module.exports = require('./oop');
View
131 node_modules/oop/lib/oop.js
@@ -1,131 +0,0 @@
-var oop = exports;
-
-oop.forceMixin = function(child /*, Parent1, ... */) {
- for (i = 1; i < arguments.length; i++) {
- oop._forceMixin(child, arguments[i]);
- }
-};
-oop.mixin = oop.forceMixin;
-
-oop._forceMixin = function(child, Parent) {
- oop._forceCopyPrototype(child, Parent);
- Parent.call(child);
-};
-
-oop._forceCopyPrototype = function(child, Parent) {
- for (var property in Parent.prototype) {
- oop._copyPrototypeProperty(child, Parent, property);
- };
-};
-
-oop._copyPrototypeProperty = function(child, Parent, property) {
- Object.defineProperty(child, property, {
- value: Parent.prototype[property],
- writable: true,
- enumerable: false,
- configurable: true
- });
-};
-
-oop.strictMixin = function(child /*, Parent1, ... */) {
- for (i = 1; i < arguments.length; i++) {
- oop._strictMixin(child, arguments[i]);
- }
-};
-
-oop._strictMixin = function(child, Parent) {
- oop._strictCopyPrototype(child, Parent);
- oop._strictCallConstructor(child, Parent);
-};
-
-oop._strictCopyPrototype = function(child, Parent) {
- for (var property in Parent.prototype) {
- if (child[property] === undefined) {
- oop._copyPrototypeProperty(child, Parent, property);
- continue;
- }
-
- oop._error(
- 'oop.strictMixin(): Class "' + Parent.name + '" tried to overwrite ' +
- 'prototype property "' + property + '".'
- , oop.strictMixin);
- };
-};
-
-oop._strictCallConstructor = function(child, Parent) {
- var original = {};
- for (var property in child) {
- original[property] = child[property];
- }
-
- Parent.call(child);
-
- for (var property in original) {
- if (child[property] === original[property]) {
- continue;
- }
-
- oop._error(
- 'oop.mixin(): Class "' + Parent.name +
- '" tried to overwrite property "' + property + '".'
- , oop.strictMixin);
- }
-};
-
-oop.softMixin = function(child /*, Parent1, ... */) {
- for (i = 1; i < arguments.length; i++) {
- oop._softMixin(child, arguments[i]);
- }
-};
-
-oop._softMixin = function(child, Parent) {
- oop._softCopyPrototype(child, Parent);
- oop._softCallConstructor(child, Parent);
-};
-
-oop._softCopyPrototype = function(child, Parent) {
- for (var property in Parent.prototype) {
- if (child[property] !== undefined) {
- continue;
- }
-
- oop._copyPrototypeProperty(child, Parent, property);
- };
-};
-
-oop._softCallConstructor = function(child, Parent) {
- var original = {};
- for (var property in child) {
- original[property] = child[property];
- }
-
- Parent.call(child);
-
- for (var property in original) {
- child[property] = original[property];
- }
-};
-
-oop._error = function(message, traceOrigin) {
- var error = new Error(message);
- Error.captureStackTrace(error, traceOrigin);
- throw error;
-};
-
-
-oop.extend = function(Child, Parent) {
- Child.prototype = Object.create(Parent.prototype, {
- constructor: {
- value: Child,
- enumerable: false
- }
- });
-
- for (var property in Parent) {
- if (Child[property] !== undefined) {
- continue;
- }
-
- Child[property] = Parent[property];
- }
-};
View
10 node_modules/oop/package.json
@@ -1,10 +0,0 @@
-{
- "name": "oop",
- "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
- "description": "Simple & light-weight oop.",
- "version": "0.0.3",
- "main": "./lib/index.js",
- "engines": {
- "node": ">=0.4.0"
- }
-}
View
2 node_modules/oop/test/common.js
@@ -1,2 +0,0 @@
-var common = exports;
-common.oop = require('../lib/oop');
View
59 node_modules/oop/test/integration/test-force-mixin.js
@@ -1,59 +0,0 @@
-var common = require('../common');
-var oop = common.oop;
-var assert = require('assert');
-
-function Friendly() {
- // Properties from the mixed in class should be copied
- this.friendly = true;
- this.overWriteMe = 'Friendly';
-
- // Methods of the mixed in class should be callable from the constructor
- this.greet();
-}
-
-Friendly.prototype.greet = function() {
-};
-
-function Tall() {
- this.tall = true;
- this.overWriteMe = 'Tall';
-
- this.slamdunk();
-}
-
-Tall.prototype.slamdunk = function() {
-}
-
-function Person() {
- // The properties of the mixin target should be kept
- this.person = true;
- // Unless they are overwritten by one of the mixins
- this.overWriteMe = 'Person';
-
- // Mixins are runtime created
- oop.forceMixin(this, Friendly, Tall);
-}
-
-Person.prototype.whimper = function() {
-}
-
-var person = new Person();
-// Make sure all properties got copied
-assert.ok(person.person);
-assert.ok(person.friendly);
-assert.ok(person.tall);
-
-// Make sure overWriteMe got overwritten by the last mixin
-assert.strictEqual(person.overWriteMe, 'Tall');
-
-// Make sure all methods got copied
-person.whimper();
-person.greet();
-person.slamdunk();
-
-// Make sure only the properties are enumerable
-var properties = Object.keys(person);
-assert.deepEqual(properties, ['person', 'overWriteMe', 'friendly', 'tall']);
-
-// Make sure mixin is an alias of forceMixin
-assert.strictEqual(oop.mixin, oop.forceMixin);
View
35 node_modules/oop/test/integration/test-inherits.js
@@ -1,35 +0,0 @@
-var common = require('../common');
-var oop = common.oop;
-var assert = require('assert');
-
-function A() {
- this.a = true;
-}
-A.methodA = function() {};
-
-function B() {
- A.call(this);
-
- this.b = true;
-}
-oop.extend(B, A);
-
-B.methodB = function() {};
-
-function C() {
- B.call(this);
-}
-oop.extend(C, B);
-
-var c = new C();
-assert.ok(c instanceof C);
-assert.ok(c instanceof B);
-assert.ok(c instanceof A);
-
-assert.ok(c.a);
-assert.ok(c.b);
-
-C.methodA();
-C.methodB();
-
-assert.strictEqual(c.constructor, C);
View
36 node_modules/oop/test/integration/test-soft-mixin.js
@@ -1,36 +0,0 @@
-var common = require('../common');
-var oop = common.oop;
-var assert = require('assert');
-
-function A() {
- this.propertyA = true;
- this.sharedProperty = 'A';
-}
-A.prototype.methodA = function() {}
-A.prototype.sharedMethod = function() {}
-
-function B() {
- this.propertyB = true;
- this.sharedProperty = 'B';
-
- oop.softMixin(this, A);
-}
-B.prototype.methodB = function() {}
-B.prototype.sharedMethod = function() {}
-
-var b = new B();
-// Make sure individual properties got copied
-assert.ok(b.propertyA);
-assert.ok(b.propertyB);
-
-// Make sure that mixin A didn't overwrite shared property B
-assert.strictEqual(b.sharedProperty, 'B');
-
-// Make sure all methods got copied and are callable
-b.methodA();
-b.methodB();
-b.sharedMethod();
-
-// Check that our sharedMethod comes from B and wasn't overwritten by mixin A
-assert.strictEqual(b.sharedMethod, B.prototype.sharedMethod);
-assert.notStrictEqual(b.sharedMethod, A.prototype.sharedMethod);
View
19 node_modules/oop/test/integration/test-strict-mixin-property-conflict.js
@@ -1,19 +0,0 @@
-var common = require('../common');
-var oop = common.oop;
-var assert = require('assert');
-
-function A() {
- this.myProperty = 'foo';
-}
-
-function B() {
- this.myProperty = 'bar';
-}
-
-function C() {
- oop.strictMixin(this, A, B);
-}
-
-assert.throws(function() {
- var c = new C();
-}, /class "B".+property "myProperty"/i);
View
17 node_modules/oop/test/integration/test-strict-mixin-prototype-conflict.js
@@ -1,17 +0,0 @@
-var common = require('../common');
-var oop = common.oop;
-var assert = require('assert');
-
-function A() {}
-A.prototype.myMethod = function() {};
-
-function B() {}
-B.prototype.myMethod = function() {};
-
-function C() {
- oop.strictMixin(this, A, B);
-}
-
-assert.throws(function() {
- var c = new C();
-}, /class "B".+prototype property "myMethod"/i);
View
5 package.json
@@ -9,10 +9,13 @@
},
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
"main": "./lib/m3u.js",
+ "dependencies": {
+ "oop": "0.0.3"
+ },
"directories": {
"lib": "lib"
},
"engines": {
"node": "*"
}
-}
+}

0 comments on commit 8fb7917

Please sign in to comment.