Optimisation : deuxième toLowerCase mal placé
parent
41d45164c8
commit
42f579fc8a
|
@ -18,11 +18,14 @@ export default class Explicable extends React.Component {
|
|||
dottedName, hover, label,
|
||||
explain, explained,
|
||||
lightBackground
|
||||
} = this.props,
|
||||
rule = findRuleByDottedName(rules, dottedName)
|
||||
} = this.props
|
||||
|
||||
// Rien à expliquer ici, ce n'est pas une règle
|
||||
if (!rule) return <span>{label}</span>
|
||||
if (dottedName == null)
|
||||
return <span>{label}</span>
|
||||
|
||||
let rule = findRuleByDottedName(rules, dottedName)
|
||||
|
||||
|
||||
let ruleLabel = (
|
||||
label || rule.title
|
||||
|
|
|
@ -75,7 +75,7 @@ export default class Question extends Component {
|
|||
return (<ul>
|
||||
{choices.canGiveUp &&
|
||||
<li key='aucun' className="variantLeaf aucun">
|
||||
<RadioLabel {...{value: 'non', label: 'Aucun', input, submit, themeColours}}/>
|
||||
<RadioLabel {...{value: 'non', label: 'Aucun', input, submit, themeColours, dottedName: null}}/>
|
||||
</li>
|
||||
}
|
||||
{ choices.children && choices.children.map( ({name, title, dottedName, children}) =>
|
||||
|
|
|
@ -99,8 +99,10 @@ export let searchRules = searchInput =>
|
|||
JSON.stringify(rule).toLowerCase().indexOf(searchInput) > -1)
|
||||
.map(enrichRule)
|
||||
|
||||
export let findRuleByDottedName = (allRules, dottedName) =>
|
||||
dottedName && allRules.find(rule => rule.dottedName == dottedName.toLowerCase())
|
||||
export let findRuleByDottedName = (allRules, dottedName) => {
|
||||
let query = dottedName.toLowerCase()
|
||||
return allRules.find(rule => rule.dottedName == query)
|
||||
}
|
||||
|
||||
/*********************************
|
||||
Autres */
|
||||
|
|
Loading…
Reference in New Issue