Sha256: 1889d47e10210821ec877087e2e8bb3ad4cb274b246b9e1643ca97abd9b3b5a7
Contents?: true
Size: 929 Bytes
Versions: 23
Compression:
Stored size: 929 Bytes
Contents
'use strict' var decimal = require('is-decimal') var alphabetical = require('is-alphabetical') var plusSign = 43 // '+' var dash = 45 // '-' var dot = 46 // '.' var underscore = 95 // '_' module.exports = locate // See: <https://github.github.com/gfm/#extended-email-autolink> function locate(value, fromIndex) { var self = this var at var position if (!this.options.gfm) { return -1 } at = value.indexOf('@', fromIndex) if (at === -1) { return -1 } position = at if (position === fromIndex || !isGfmAtext(value.charCodeAt(position - 1))) { return locate.call(self, value, at + 1) } while (position > fromIndex && isGfmAtext(value.charCodeAt(position - 1))) { position-- } return position } function isGfmAtext(code) { return ( decimal(code) || alphabetical(code) || code === plusSign || code === dash || code === dot || code === underscore ) }
Version data entries
23 entries across 23 versions & 1 rubygems