Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #800 from brandonbk/get-cookie-id
Browse files Browse the repository at this point in the history
Add get-cookie-id utility
  • Loading branch information
brandonbk authored Sep 25, 2023
2 parents e294295 + 086118a commit ccc65f1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/marko-web-omeda-identity-x/utils/get-cookie-id.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = (value, type) => {
if (!value) return null;
const trimmed = `${value.replace(/^"/, '').replace(/"$/, '')}`.trim();
if (type === 'anon') {
return /^[a-z0-9-]{36}$/i.test(trimmed) ? trimmed : null;
}
if (type === 'enc') {
return /^[a-z0-9]{15}$/i.test(trimmed) ? trimmed : null;
}
return null;
};

0 comments on commit ccc65f1

Please sign in to comment.