Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
scrollBy(direction, value, trigger, sync) {
let type = typeof value
if (type === 'string') {
if (isPercentage(value)) {
value =
convertPercentageToFloat(value) * this.getScrollLength(direction)
}
value = parseFloat(value)
type = 'number'
}
if (type !== 'number') {
return
}
this.move(direction, this.getOffset(direction) + value, trigger, sync)
}
scrollTo(direction, value, trigger, sync) {
let type = typeof value
if (type === 'string') {
if (isPercentage(value)) {
value =
convertPercentageToFloat(value) * this.getScrollLength(direction)
}
value = parseFloat(value)
type = 'number'
}
if (type !== 'number') {
return
}
this.move(direction, value, trigger, sync)
}
parse(result) {
const hsla = {
h: ((result[1] % 360) + 360) % 360,
s: isPercentage(result[2])
? convertPercentageToFloat(result[2])
: parseFloat(result[2], 10),
l: isPercentage(result[3])
? convertPercentageToFloat(result[3])
: parseFloat(result[3], 10),
a: isPercentage(result[4])
? convertPercentageToFloat(result[4])
: parseFloat(result[4], 10)
}
return Converter.HSLtoRGB(hsla)
},
to(color) {
moveBy(value, trigger, sync) {
let type = typeof value
if (type === 'string') {
if (isPercentage(value)) {
value =
convertPercentageToFloat(value) * (this.barLength - this.handleLength)
}
value = parseFloat(value)
type = 'number'
}
if (type !== 'number') {
return
}
this.move(this.handlePosition + value, trigger, sync)
}
parse(result) {
const hsla = {
h: ((result[1] % 360) + 360) % 360,
s: isPercentage(result[2])
? convertPercentageToFloat(result[2])
: parseFloat(result[2], 10),
l: isPercentage(result[3])
? convertPercentageToFloat(result[3])
: parseFloat(result[3], 10),
a: isPercentage(result[4])
? convertPercentageToFloat(result[4])
: parseFloat(result[4], 10)
}
return Converter.HSLtoRGB(hsla)
},
to(color) {
parse(result) {
const hsla = {
h: ((result[1] % 360) + 360) % 360,
s: isPercentage(result[2])
? convertPercentageToFloat(result[2])
: parseFloat(result[2], 10),
l: isPercentage(result[3])
? convertPercentageToFloat(result[3])
: parseFloat(result[3], 10),
a: isPercentage(result[4])
? convertPercentageToFloat(result[4])
: parseFloat(result[4], 10)
}
return Converter.HSLtoRGB(hsla)
},
to(color) {