Skip to content

$, how it works?

Arthur Guiot edited this page Oct 22, 2017 · 2 revisions

How it works?

The $ is the object that will help you test everything in EyeJS. You already saw it in the core language page, here is a quick example:

eye.test("$ demo", "node",
   $ => $(1).is('number')
)

So, let's analyze what's happening. We first start by creating a new test that is called $ demo. Then, we say that it will be a node based test.

After, we have $ => $(.... If you're already familiar with ES6, you know that it means:

$ => $(1).is('number')
          |
          v
function ($) {
    return $(1).is('number')
}

The 'not' operator

In v0.2, because of error messages, you now can't use ! to simulate a false condition. That's why we introduce a new method:

eye.test("false condition", "node",
	$ => $(true).Equal(false, false)
)

As you can see, you simply have to add a false at the end of any function to explicitly say that the condition is false.


⚠️ Questions?

Don't hesitate to ask your questions ⁉️ in the issue part 😁

Clone this wiki locally