44 */
55'use strict' ;
66
7+ var find = require ( 'array.prototype.find' ) ;
78var variableUtil = require ( '../util/variable' ) ;
89
910// ------------------------------------------------------------------------------
@@ -20,7 +21,7 @@ module.exports = {
2021 } ,
2122 create : function ( context ) {
2223 function findSpreadVariable ( name ) {
23- return variableUtil . variablesInScope ( context ) . find ( function ( item ) {
24+ return find ( variableUtil . variablesInScope ( context ) , function ( item ) {
2425 return item . name === name ;
2526 } ) ;
2627 }
@@ -33,7 +34,7 @@ module.exports = {
3334 if ( ! node . properties ) {
3435 return false ;
3536 }
36- return node . properties . find ( function ( prop ) {
37+ return find ( node . properties , function ( prop ) {
3738 if ( prop . type === 'Property' ) {
3839 return prop . key . name === propName ;
3940 } else if ( prop . type === 'ExperimentalSpreadProperty' ) {
@@ -53,7 +54,7 @@ module.exports = {
5354 */
5455 function findJsxProp ( node , propName ) {
5556 var attributes = node . openingElement . attributes ;
56- return attributes . find ( function ( attribute ) {
57+ return find ( attributes , function ( attribute ) {
5758 if ( attribute . type === 'JSXSpreadAttribute' ) {
5859 var variable = findSpreadVariable ( attribute . argument . name ) ;
5960 if ( variable && variable . defs . length && variable . defs [ 0 ] . node . init ) {
@@ -94,7 +95,7 @@ module.exports = {
9495 var props = node . arguments [ 1 ] ;
9596
9697 if ( props . type === 'Identifier' ) {
97- var variable = variableUtil . variablesInScope ( context ) . find ( function ( item ) {
98+ var variable = find ( variableUtil . variablesInScope ( context ) , function ( item ) {
9899 return item . name === props . name ;
99100 } ) ;
100101 if ( variable && variable . defs [ 0 ] . node . init ) {
0 commit comments