Skip to content

Commit

Permalink
perf: hoist regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
mscdex authored and dougwilson committed Aug 14, 2015
1 parent e0a38a3 commit 5b3f955
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ unreleased

* Add `firstPartyOnly` option
* Throw better error for invalid argument to parse
* perf: hoist regular expression

0.1.3 / 2015-05-19
==================
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports.serialize = serialize;

var decode = decodeURIComponent;
var encode = encodeURIComponent;
var pairSplitRegExp = /; */;

/**
* Parse a cookie header.
Expand All @@ -39,7 +40,7 @@ function parse(str, options) {

var obj = {}
var opt = options || {};
var pairs = str.split(/; */);
var pairs = str.split(pairSplitRegExp);
var dec = opt.decode || decode;

pairs.forEach(function(pair) {
Expand Down

0 comments on commit 5b3f955

Please sign in to comment.