Files
cypress/packages/server/lib/util/cache_buster.coffee
T
2017-05-09 13:51:45 -04:00

17 lines
311 B
CoffeeScript

_ = require 'lodash'
DIGITS = 3
SEPERATOR = "-"
module.exports =
get: ->
SEPERATOR + Math.random().toFixed(DIGITS).slice(2, 5)
strip: (str) ->
if @_hasCacheBuster(str)
str.slice(0, -4)
else
str
_hasCacheBuster: (str) ->
str.split("").slice(-4, -3).join("") is SEPERATOR