In Ramda kann ich etwas tun, wie folgt (dies nur hypothetisch Code ist, entwickelt nur die Art von Lösung zu veranschaulichen, die ich für die Suche bin)Gibt es ein R.notEquals-Äquivalent in Ramda?
const highest = function(attribute) {
switch(attribute){
case 'score':
return 'John'
}
}
const hasHighestScore = R.compose(
R.equals,
R.toLower,
highest
)('score')
hasHighestScore('john') // true
Gibt es ein Äquivalent für R.equals die das Gegenteil zurück Wert funktioniert noch genauso wie R.equals?
so dass diese hypothetische Code funktionieren würde:
const hasNotHighestScore = R.compose(
R.notEquals,
R.toLower,
highest
)('score')
Offensichtlich ich
const doesNotHaveHighestScore = x => !hasHighestScore(x)
das vorherige Ergebnis inverse könnte, aber ich würde gerne wissen, ob es so etwas wie R.notEquals ist oder vielleicht Ich kann es selbst erstellen? Vielen Dank.
Ramda hat eine 'not' Funktion, die Komplimente ein Prädikat. Z.B. 'const notEqual = Wert => R.compose (R.not, R.equals (Wert))'. –
Es funktioniert nicht auf die gleiche Weise, zum Beispiel, wenn ich einfach auf eine R. nicht gefolgt von R.equals, bekomme ich den Fehler "Erstes Argument für _arity muss eine nicht negative ganze Zahl nicht größer als" – Babak
Figure it raus, danke! – Babak