Sha256: 4b575d562085c2f151a42b561494b35e2516c30fc67457834509fd3f7963af2a
Contents?: true
Size: 890 Bytes
Versions: 24
Compression:
Stored size: 890 Bytes
Contents
'use strict' var own = {}.hasOwnProperty module.exports = stringify function stringify(value) { // Nothing. if (!value || typeof value !== 'object') { return '' } // Node. if (own.call(value, 'position') || own.call(value, 'type')) { return position(value.position) } // Position. if (own.call(value, 'start') || own.call(value, 'end')) { return position(value) } // Point. if (own.call(value, 'line') || own.call(value, 'column')) { return point(value) } // ? return '' } function point(point) { if (!point || typeof point !== 'object') { point = {} } return index(point.line) + ':' + index(point.column) } function position(pos) { if (!pos || typeof pos !== 'object') { pos = {} } return point(pos.start) + '-' + point(pos.end) } function index(value) { return value && typeof value === 'number' ? value : 1 }
Version data entries
24 entries across 24 versions & 1 rubygems