UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

21 lines (14 loc) 415 B
'use strict'; var getCookie = name => { var nameEQ = encodeURIComponent(name) + '='; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) === ' ') { c = c.substring(1, c.length); } if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length)); } return null; }; module.exports = getCookie;