Files
cypress/packages/server/lib/util/cache_buster.js
Brian Mann 2333d04a54 secure cookie error crash (#2685)
- fixes #1264 
- fixes #1321 
- fixes #1799  
- fixes #2689
- fixes #2688
- fixes #2687 	
- fixes #2686
2018-11-01 12:34:37 -04:00

21 lines
347 B
JavaScript

const DIGITS = 3
const SEPERATOR = '-'
module.exports = {
get () {
return SEPERATOR + Math.random().toFixed(DIGITS).slice(2, 5)
},
strip (str) {
if (this._hasCacheBuster(str)) {
return str.slice(0, -4)
}
return str
},
_hasCacheBuster (str) {
return str.split('').slice(-4, -3).join('') === SEPERATOR
},
}