8 times faster matching of enter key within incoming pty data

https://jsperf.com/exec-vs-match-vs-test-vs-search/5
This commit is contained in:
Guillermo Rauch 2017-02-17 02:47:09 -03:00
parent 75b37b7690
commit fe6e2977bd

View file

@ -54,8 +54,7 @@ export function addSessionData(uid, data) {
data,
effect() {
const {shell} = getState().sessions.sessions[uid];
const enterKey = Boolean(data.match(/\n/));
const enterKey = data.indexOf('\n') > 0;
const url = enterKey ? isUrl(shell, data) : null;
if (url) {
dispatch({