From eca9f8f0f956e07b23e8961a767718376f186874 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Tue, 1 Oct 2024 19:37:43 -0700 Subject: [PATCH] Use loop for = --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 027b1c0..d8765ee 100644 --- a/index.js +++ b/index.js @@ -102,13 +102,13 @@ function parse(str, options) { var index = 0; while (index < str.length) { - var eqIdx = str.indexOf('=', index); - if (eqIdx === -1) break; - var endIdx = str.indexOf(';', index); if (endIdx === -1) endIdx = str.length; - if (eqIdx > endIdx) { + var eqIdx = index; + while (eqIdx < endIdx && str.charCodeAt(eqIdx) !== 0x3D /* = */) eqIdx++; + + if (eqIdx === endIdx) { index = endIdx + 1; continue; }