Don't use Buffer::equals

Node 0.10 doesn't have it
This commit is contained in:
Max Brunsfeld 2015-08-18 16:17:27 -07:00
parent e4b1d512cd
commit bea45b5921

View File

@ -4,7 +4,7 @@ BABEL_PREFIXES = [
"'use babel'"
'"use babel"'
'/** use babel */'
].map(Buffer)
]
PREFIX_LENGTH = Math.max(BABEL_PREFIXES.map((prefix) -> prefix.length)...)
@ -15,4 +15,4 @@ module.exports = (filename) ->
fs.readSync(file, buffer, 0, PREFIX_LENGTH)
fs.closeSync(file)
BABEL_PREFIXES.some (prefix) ->
prefix.equals(buffer.slice(0, prefix.length))
prefix is buffer.toString('utf8', 0, prefix.length)