Skip to content

Commit 72acfaa

Browse files
refactor: convert redColorScaleGenerator.js to TypeScript #125
1 parent 9942885 commit 72acfaa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/helper/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export { default as defaultProps } from './defaultProps.js'
2-
export { redColorScaleGenerator } from './redColorScaleGenerator.js'
2+
export { redColorScaleGenerator } from './redColorScaleGenerator'
33
export * from './utilities.js'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export function redColorScaleGenerator(values) {
1+
export function redColorScaleGenerator(values: number[]) {
22
const min = Math.min.apply(Math, values)
33
const max = Math.max.apply(Math, values)
4-
return (x) => {
4+
return (x: number) => {
55
const nonRed = 255 - Math.round((255 * (x - min)) / (max - min))
66
return { backgroundColor: `rgb(255,${nonRed},${nonRed})` }
77
}

0 commit comments

Comments
 (0)