Example 1 — Official: Words With an "s"
The array sample from the Ramda docs.
const words = ["sss", "ttt", "foo", "bars"];
console.log(R.partition(R.includes("s"), words));
// → [["sss", "bars"], ["ttt", "foo"]] How It Works
- Test.
R.includes("s")asks “does this word contain an s?” - Sort.
"sss"and"bars"say yes;"ttt"and"foo"say no. - Result. The yes group comes first, the no group second, each in the original order.
