jussi-kalliokoski / trine

A utility library for modern JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using "this" as data input and pure functions concept

andreventuravale opened this issue · comments

Hi,

Given a pure function like:

function add2(x) {
  return x + 2
}

And a conceptual equivalent in Trine's approach ?

function add2() {
  return this + 2
}

Would the use of "this" as data input invalidate the pure nature of the function ?

Thanks.

PS: I am unsure if this is the best place to ask such question, please let me know of other channels.