aerial-common
Advanced tools
Comparing version 0.0.5 to 0.0.7
@@ -58,9 +58,8 @@ "use strict"; | ||
__extends(ActiveRecordCollection, _super); | ||
function ActiveRecordCollection() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
function ActiveRecordCollection(collectionName, kernel, createActiveRecord, query) { | ||
if (query === void 0) { query = {}; } | ||
var _this = _super.call(this) || this; | ||
_this.setup(collectionName, kernel, createActiveRecord, query); | ||
return _this; | ||
} | ||
ActiveRecordCollection.create = function (collectionName, kernel, createActiveRecord, query) { | ||
if (query === void 0) { query = {}; } | ||
return observable_1.ObservableCollection.create.call(this).setup(collectionName, kernel, createActiveRecord, query); | ||
}; | ||
ActiveRecordCollection.prototype.setup = function (collectionName, kernel, createActiveRecord, query) { | ||
@@ -67,0 +66,0 @@ var _this = this; |
@@ -1,45 +0,21 @@ | ||
/** | ||
* ES5 compatible subclassing of arrays. | ||
*/ | ||
function ArrayCollection() { | ||
Array.prototype.push.apply(this, arguments); | ||
} | ||
ArrayCollection.prototype = []; | ||
ArrayCollection.create = function() { | ||
var proto = []; | ||
proto["__proto__"] = Object.create(this.prototype); | ||
// try the es5 route | ||
return this.apply(proto, arguments); | ||
}; | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ArrayCollection = (function (_super) { | ||
__extends(ArrayCollection, _super); | ||
function ArrayCollection() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ArrayCollection; | ||
}(Array)); | ||
exports.ArrayCollection = ArrayCollection; | ||
// export class ArrayCollection<T> extends Array<T> { | ||
// protected constructor(...items: T[]) { | ||
// super(...items); | ||
// return this; | ||
// } | ||
// static create<T>(...items: T[]): ArrayCollection<T> { | ||
// const proto = []; | ||
// proto["__proto__"] = Object.create(this.prototype); | ||
// // for (const key in Object.create(this.prototype)) { | ||
// // // proto[key] = this.prototype[key]; | ||
// // } | ||
// // try the es5 route | ||
// try { | ||
// return this.apply(proto, items); | ||
// } catch(e) { | ||
// console.log("ERRING", e.stack) | ||
// return new this(...items); | ||
// } | ||
// } | ||
// } | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "aerial-common", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"description": "This is currently a junk drawer of dependencies. Most everything here should be moved into separate repositories eventually.", | ||
@@ -11,3 +11,4 @@ "main": "index.js", | ||
"scripts": { | ||
"build": "rm -rf lib; npm run copy-js; tsc", | ||
"test": "mocha ./lib/**/*-test.js", | ||
"build": "rm -rf lib; tsc", | ||
"copy-js": "for FILE in `find ./src -name *.js -o -name *.d.ts`; do OUT_FILE=`echo $FILE | sed 's/src/lib/'`; mkdir -p `dirname $OUT_FILE`; cp $FILE $OUT_FILE; done;" | ||
@@ -22,3 +23,4 @@ }, | ||
"@types/reflect-metadata": "0.0.5", | ||
"chai": "^4.0.2" | ||
"chai": "^4.0.2", | ||
"mocha": "^3.4.2" | ||
}, | ||
@@ -25,0 +27,0 @@ "dependencies": { |
@@ -33,4 +33,5 @@ import sift from 'sift'; | ||
static create<T extends IActiveRecord<any>, U>(collectionName: string, kernel: Kernel, createActiveRecord: (source: U) => T, query: any = {}): ActiveRecordCollection<T, U> { | ||
return (ObservableCollection.create.call(this) as ActiveRecordCollection<any, any>).setup(collectionName, kernel, createActiveRecord, query); | ||
constructor(collectionName: string, kernel: Kernel, createActiveRecord: (source: U) => T, query: any = {}) { | ||
super(); | ||
this.setup(collectionName, kernel, createActiveRecord, query); | ||
} | ||
@@ -37,0 +38,0 @@ |
@@ -15,5 +15,12 @@ /** | ||
proto["__proto__"] = Object.create(this.prototype); | ||
try { | ||
console.log(this); | ||
// try the es5 route | ||
return this.apply(proto, arguments); | ||
} catch(e) { | ||
// try the es5 route | ||
return this.apply(proto, arguments); | ||
// es6 enabled | ||
return new this(...arguments); | ||
} | ||
}; | ||
@@ -20,0 +27,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
533277
337
6
8786