Skip to content

Commit df019ff

Browse files
ro-savagerafeememon
authored andcommitted
Remove lodash and replace with inbuilt native functionality (Hacker0x01#757)
1 parent 5bc1cf7 commit df019ff

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/calendar.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import moment from 'moment'
2-
import find from 'lodash/find'
32
import YearDropdown from './year_dropdown'
43
import MonthDropdown from './month_dropdown'
54
import Month from './month'
@@ -14,9 +13,7 @@ const DROPDOWN_FOCUS_CLASSNAMES = [
1413

1514
const isDropdownSelect = (element = {}) => {
1615
const classNames = (element.className || '').split(/\s+/)
17-
return !!find(DROPDOWN_FOCUS_CLASSNAMES, (testClassname) => {
18-
return classNames.indexOf(testClassname) >= 0
19-
})
16+
return DROPDOWN_FOCUS_CLASSNAMES.some(testClassname => classNames.indexOf(testClassname) >= 0)
2017
}
2118

2219
var Calendar = React.createClass({

src/datepicker.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import DateInput from './date_input'
22
import Calendar from './calendar'
33
import React from 'react'
4-
import defer from 'lodash/defer'
54
import TetherComponent from './tether_component'
65
import classnames from 'classnames'
76
import {isSameDay, isDayDisabled, isDayInRange} from './date_utils'
@@ -146,7 +145,7 @@ var DatePicker = React.createClass({
146145

147146
deferFocusInput () {
148147
this.cancelFocusInput()
149-
this.inputFocusTimeout = defer(() => this.setFocus())
148+
this.inputFocusTimeout = window.setTimeout(() => this.setFocus(), 1)
150149
},
151150

152151
handleDropdownFocus () {

src/month_dropdown.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react'
22
import MonthDropdownOptions from './month_dropdown_options'
33
import onClickOutside from 'react-onclickoutside'
44
import moment from 'moment'
5-
import range from 'lodash/range'
65

76
var WrappedMonthDropdownOptions = onClickOutside(MonthDropdownOptions)
87

@@ -81,7 +80,9 @@ var MonthDropdown = React.createClass({
8180

8281
render () {
8382
const localeData = moment.localeData(this.props.locale)
84-
const monthNames = range(0, 12).map((M) => localeData.months(moment({M})))
83+
const monthNames = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(
84+
(M) => localeData.months(moment({M}))
85+
)
8586

8687
let renderedDropdown
8788
switch (this.props.dropdownMode) {

0 commit comments

Comments
 (0)