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

Commit

Permalink
Use pickBy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shammamah Hossain committed Nov 11, 2019
1 parent 01324bf commit 6540ebb
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/components/RangeSlider.react.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {assoc, omit} from 'ramda';
import {assoc, omit, pickBy} from 'ramda';
import {Range, createSliderWithTooltip} from 'rc-slider';

/**
Expand Down Expand Up @@ -58,14 +58,8 @@ export default class RangeSlider extends Component {
tipProps = tooltip;
}

const omittedMarks = this.props.marks
? Object.keys(this.props.marks).filter(value => {
return value < this.props.min || value > this.props.max;
})
: [];

const truncatedMarks = omit(
omittedMarks.map(mark => parseInt(mark, 10)),
const truncatedMarks = pickBy(
(k, mark) => mark >= this.props.min && mark <= this.props.max,
this.props.marks
);

Expand Down

0 comments on commit 6540ebb

Please sign in to comment.