Skip to content

Commit

Permalink
Remove unused lines in Reference
Browse files Browse the repository at this point in the history
  • Loading branch information
vonagam committed Feb 3, 2019
1 parent d02ff5e commit 953feee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/Reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ export default class Reference {
validateName(key);
let prefix = options.contextPrefix || '$';

if (typeof key === 'function') {
key = '.';
}

this.key = key.trim();
this.prefix = prefix;
this.isContext = this.key.indexOf(prefix) === 0;
this.isSelf = this.key === '.';
this.isSelf = this.key === '';

this.path = this.isContext ? this.key.slice(this.prefix.length) : this.key;
this._get = getter(this.path, true);
Expand Down
2 changes: 1 addition & 1 deletion src/mixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ const proto = (SchemaType.prototype = {
deps = [].concat(keys).map(key => new Ref(key));

deps.forEach(dep => {
if (!dep.isContext) next._deps.push(dep.key);
if (!dep.isContext && !dep.isSelf) next._deps.push(dep.key);
});

next._conditions.push(new Condition(deps, options));
Expand Down
3 changes: 2 additions & 1 deletion src/util/sortFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export default function sortFields(fields, excludes = []) {

if (!~nodes.indexOf(key)) nodes.push(key);

if (Ref.isRef(value) && !value.isContext) addNode(value.path, key);
if (Ref.isRef(value) && !value.isContext && !value.isSelf)
addNode(value.path, key);
else if (isSchema(value) && value._deps)
value._deps.forEach(path => addNode(path, key));
}
Expand Down

0 comments on commit 953feee

Please sign in to comment.