Skip to content

Commit

Permalink
feat(input): Use core-js/array/find instead of native find to ensure …
Browse files Browse the repository at this point in the history
…browser compatibility.

IE11 does not support native Array#find.
  • Loading branch information
ryanoglesby08 committed Sep 28, 2017
1 parent b3636e4 commit 14c75e2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion config/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ module.exports = {
assetsDir: path.resolve('docs/assets/'),
styleguideDir: path.resolve('styleguide', styleguidistEnv),
require: [
'babel-polyfill',
path.resolve('src/scss/global.scss'),
path.resolve('docs/scss/styleguide.scss')
],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"classnames": "^2.2.5",
"core-js": "^2.5.1",
"css-loader": "^0.28.4",
"css-modules-loader-core": "^1.1.0",
"cssnano": "^3.10.0",
Expand Down
4 changes: 3 additions & 1 deletion src/components/Input/generateId.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import find from 'core-js/fn/array/find'

const sanitize = text => text.toLowerCase().replace(/ /g, '-')

const generateId = (...choices) => {
const id = sanitize(choices.find(choice => choice))
const id = sanitize(find(choices, choice => choice))

return {
identity: () => id,
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ core-js@^1.0.0, core-js@^1.2.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"

core-js@^2.4.0, core-js@^2.5.0:
core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b"

Expand Down

0 comments on commit 14c75e2

Please sign in to comment.