[API] Satisfy JSCS

This commit is contained in:
Victor Woeltjen 2016-09-30 16:23:17 -07:00
parent 044b1b627d
commit ef0264d864
4 changed files with 11 additions and 12 deletions

View File

@ -91,7 +91,7 @@ define([
* @name indexOf * @name indexOf
*/ */
CompositionCollection.prototype.indexOf = function (child) { CompositionCollection.prototype.indexOf = function (child) {
return _.findIndex(this._children, function (other) { return _.findIndex(this.loadedChildren, function (other) {
return objectUtils.equals(child, other); return objectUtils.equals(child, other);
}); });
}; };
@ -136,7 +136,7 @@ define([
* @name add * @name add
*/ */
CompositionCollection.prototype.add = function (child, skipMutate) { CompositionCollection.prototype.add = function (child, skipMutate) {
if (!this._children) { if (!this.loadedChildren) {
throw new Error("Must load composition before you can add!"); throw new Error("Must load composition before you can add!");
} }
if (!this.canContain(child)) { if (!this.canContain(child)) {
@ -148,7 +148,7 @@ define([
} }
throw new Error("Unable to add child: already in composition"); throw new Error("Unable to add child: already in composition");
} }
this._children.push(child); this.loadedChildren.push(child);
this.emit('add', child); this.emit('add', child);
if (!skipMutate) { if (!skipMutate) {
// add after we have added. // add after we have added.
@ -167,12 +167,12 @@ define([
CompositionCollection.prototype.load = function () { CompositionCollection.prototype.load = function () {
return this.provider.load(this.domainObject) return this.provider.load(this.domainObject)
.then(function (children) { .then(function (children) {
this._children = []; this.loadedChildren = [];
children.map(function (c) { children.map(function (c) {
this.add(c, true); this.add(c, true);
}, this); }, this);
this.emit('load'); this.emit('load');
return this._children.slice(); return this.loadedChildren.slice();
}.bind(this)); }.bind(this));
}; };
@ -196,7 +196,7 @@ define([
throw new Error("Unable to remove child: not found in composition"); throw new Error("Unable to remove child: not found in composition");
} }
var index = this.indexOf(child); var index = this.indexOf(child);
var removed = this._children.splice(index, 1)[0]; var removed = this.loadedChildren.splice(index, 1)[0];
this.emit('remove', index, child); this.emit('remove', index, child);
if (!skipMutate) { if (!skipMutate) {
// trigger removal after we have internally removed it. // trigger removal after we have internally removed it.

View File

@ -113,7 +113,7 @@ define([
}); });
}; };
openmct.objects._supersecretSetFallbackProvider( openmct.objects.supersecretSetFallbackProvider(
new ObjectServiceProvider(objectService, instantiate, topic) new ObjectServiceProvider(objectService, instantiate, topic)
); );

View File

@ -52,7 +52,7 @@ define([
}; };
} }
ObjectAPI.prototype._supersecretSetFallbackProvider = function (p) { ObjectAPI.prototype.supersecretSetFallbackProvider = function (p) {
this.fallbackProvider = p; this.fallbackProvider = p;
}; };

View File

@ -37,18 +37,17 @@ define([
for (var i = 0, escaped = false; i < key.length; i++) { for (var i = 0, escaped = false; i < key.length; i++) {
if (escaped) { if (escaped) {
escaped = false; escaped = false;
namespace += key[i];
} else { } else {
if (key[i] === "\\") { if (key[i] === "\\") {
escaped = true; escaped = true;
continue; } else if (key[i] === ":") {
}
if (key[i] === ":") {
// namespace = key.slice(0, i); // namespace = key.slice(0, i);
identifier = key.slice(i + 1); identifier = key.slice(i + 1);
break; break;
} }
namespace += key[i];
} }
namespace += key[i];
} }
if (key === namespace) { if (key === namespace) {