graphql-language-service-utils
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -21,30 +21,60 @@ 'use strict'; | ||
var Range = exports.Range = function Range(start, end) { | ||
var _this = this; | ||
var Range = exports.Range = function () { | ||
function Range(start, end) { | ||
var _this = this; | ||
_classCallCheck(this, Range); | ||
_classCallCheck(this, Range); | ||
this.containsPosition = function (position) { | ||
var withinLine = _this.start.line <= position.line && _this.end.line >= position.line; | ||
var withinCharacter = _this.start.character <= position.character && _this.end.character >= position.character; | ||
return withinLine && withinCharacter; | ||
this.containsPosition = function (position) { | ||
if (_this.start.line === position.line) { | ||
return _this.start.character <= position.character; | ||
} else if (_this.end.line === position.line) { | ||
return _this.end.character >= position.character; | ||
} else if (_this.start.line > position.line || _this.end.line < position.line) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
}; | ||
this.start = start; | ||
this.end = end; | ||
} | ||
Range.prototype.setStart = function setStart(line, character) { | ||
this.start = new Position(line, character); | ||
}; | ||
this.start = start; | ||
this.end = end; | ||
}; | ||
Range.prototype.setEnd = function setEnd(line, character) { | ||
this.end = new Position(line, character); | ||
}; | ||
var Position = exports.Position = function Position(line, character) { | ||
var _this2 = this; | ||
return Range; | ||
}(); | ||
_classCallCheck(this, Position); | ||
var Position = exports.Position = function () { | ||
function Position(line, character) { | ||
var _this2 = this; | ||
this.lessThanOrEqualTo = function (position) { | ||
return _this2.line < position.line || _this2.line === position.line && _this2.character <= position.character; | ||
_classCallCheck(this, Position); | ||
this.lessThanOrEqualTo = function (position) { | ||
return _this2.line < position.line || _this2.line === position.line && _this2.character <= position.character; | ||
}; | ||
this.line = line; | ||
this.character = character; | ||
} | ||
Position.prototype.setLine = function setLine(line) { | ||
this.line = line; | ||
}; | ||
this.line = line; | ||
this.character = character; | ||
}; | ||
Position.prototype.setCharacter = function setCharacter(character) { | ||
this.character = character; | ||
}; | ||
return Position; | ||
}(); | ||
function offsetToPosition(text, loc) { | ||
@@ -51,0 +81,0 @@ var EOL = '\n'; |
{ | ||
"name": "graphql-language-service-utils", | ||
"repository": "https://github.com/graphql/graphql-language-service", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "Utilities to support the GraphQL Language Service", | ||
@@ -30,4 +30,4 @@ "contributors": [ | ||
"graphql": "^0.10.1", | ||
"graphql-language-service-types": "0.0.19" | ||
"graphql-language-service-types": "0.0.20" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
12596
197
+ Addedgraphql-language-service-types@0.0.20(transitive)
- Removedgraphql-language-service-types@0.0.19(transitive)