Skip to content

Instantly share code, notes, and snippets.

@medikoo
Created August 8, 2014 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save medikoo/b5c4fc368e19b7d50090 to your computer and use it in GitHub Desktop.
Save medikoo/b5c4fc368e19b7d50090 to your computer and use it in GitHub Desktop.
'use strict';
var esniff = require('./')
, name = 'i18n.bind'
, hasOwnProperty = Object.prototype.hasOwnProperty
, $common = esniff.$common
, wsSet = esniff.wsSet
, move = esniff.move
, l = name.length
, code = 'var raz = dwatrzy("rdwa"); i18n.bind(\'elo\'); marko()'
, result;
esniff(code, function (char, i, previous) {
var j = 0;
if (char !== name[j]) return $common;
if (previous === '.') return $common;
while (++j !== l) {
if (code[i] !== name[j]) return $common;
++i;
}
while (hasOwnProperty.call(wsSet, code[i])) ++i;
if (code[i] !== '(') return $common;
++i;
while (hasOwnProperty.call(wsSet, code[i])) ++i;
result = i;
move(code.length);
});
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment