mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-05 23:00:03 -06:00
- fixes #1264 - fixes #1321 - fixes #1799 - fixes #2689 - fixes #2688 - fixes #2687 - fixes #2686
21 lines
347 B
JavaScript
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
|
|
},
|
|
}
|