pipeline_operator.js 436 B

12345678910111213141516171819202122232425262728
  1. a |> b |> c;
  2. a |> (b |> c);
  3. (a |> b) || c;
  4. a |> (b || c);
  5. let result = "hello"
  6. |> doubleSay
  7. |> capitalize
  8. |> exclaim;
  9. let newScore = person.score
  10. |> double
  11. |> (_ => add(7, _))
  12. |> (_ => subtract(2, _))
  13. |> (_ => boundScore(0, 100, _));
  14. function createPerson (attrs) {
  15. attrs
  16. |> bounded('age', 1, 100)
  17. |> format('name', /^[a-z]$/i)
  18. |> Person.insertIntoDatabase;
  19. }
  20. foo |> (bar ?? baz);
  21. (foo |> bar) ?? baz;