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

View File

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

View File

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