3 var own = {}.hasOwnProperty
5 module.exports = stringify
7 function stringify(value) {
9 if (!value || typeof value !== 'object') {
14 if (own.call(value, 'position') || own.call(value, 'type')) {
15 return position(value.position)
19 if (own.call(value, 'start') || own.call(value, 'end')) {
20 return position(value)
24 if (own.call(value, 'line') || own.call(value, 'column')) {
32 function point(point) {
33 if (!point || typeof point !== 'object') {
37 return index(point.line) + ':' + index(point.column)
40 function position(pos) {
41 if (!pos || typeof pos !== 'object') {
45 return point(pos.start) + '-' + point(pos.end)
48 function index(value) {
49 return value && typeof value === 'number' ? value : 1