23 lines
416 B
JavaScript
23 lines
416 B
JavaScript
'use strict'
|
|
|
|
var position = exports
|
|
|
|
position.start = factory('start')
|
|
position.end = factory('end')
|
|
|
|
function factory(type) {
|
|
point.displayName = type
|
|
|
|
return point
|
|
|
|
function point(node) {
|
|
var point = (node && node.position && node.position[type]) || {}
|
|
|
|
return {
|
|
line: point.line || null,
|
|
column: point.column || null,
|
|
offset: isNaN(point.offset) ? null : point.offset
|
|
}
|
|
}
|
|
}
|