Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 6a69f15

Browse files
author
Shammamah Hossain
committed
Use pickBy.
1 parent 01324bf commit 6a69f15

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/components/RangeSlider.react.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component} from 'react';
22
import PropTypes from 'prop-types';
3-
import {assoc, omit} from 'ramda';
3+
import {assoc, omit, pickBy} from 'ramda';
44
import {Range, createSliderWithTooltip} from 'rc-slider';
55

66
/**
@@ -58,17 +58,13 @@ export default class RangeSlider extends Component {
5858
tipProps = tooltip;
5959
}
6060

61-
const omittedMarks = this.props.marks
62-
? Object.keys(this.props.marks).filter(value => {
63-
return value < this.props.min || value > this.props.max;
64-
})
61+
const truncatedMarks = this.props.marks
62+
? pickBy(
63+
(k, mark) => mark >= this.props.min && mark <= this.props.max,
64+
this.props.marks
65+
)
6566
: [];
6667

67-
const truncatedMarks = omit(
68-
omittedMarks.map(mark => parseInt(mark, 10)),
69-
this.props.marks
70-
);
71-
7268
return (
7369
<div
7470
id={id}

0 commit comments

Comments
 (0)