• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microstates / microstates.js / 507
99%

Build:
DEFAULT BRANCH: master
Ran 27 Feb 2018 07:40PM UTC
Jobs 4
Files 1
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
507

push

travis-ci

taras
Introducing type parameters for Array and Object. (#70)

Part of what makes microstates so powerful is their composability. We
can take the data and operations of one class and "place" them into
another class. Sometimes however, the nature of a type is to manage or
"contain" another type. In other words, it doesn't have much meaning
in relation to the type. Arrays and Objects are examples of this. They
should be able to work with _any_ type, and still be able to leverage
the transitions of that type. That's not currently the case.

As a concrete example, before in order to make a todo list, all
of the transitions had to live on the "TodoList" class because the
array only holds "data".

```js
class TodoList {
  items = Array

  setTodoDescription(todo, description) {}

  markDone(todo) {}
}
```

But the transitions associated with an individual item, are really
about that item. What we'd really like to be able to do is to have a
class:

```js
class TodoItem {
  description = String;
  isDone = Boolean;
}
```

and then be able to use the string and boolean transitions in there.

With parameterized types this becomes a possibility. Now, we can
"embed" the `TodoItem` inside the array by declaring our TodoList as:

```js
import { parameterized } from 'microstates';

class TodoList {
  items = parameterized(Array, TodoItem)
}
```

172 of 217 branches covered (79.26%)

Branch coverage included in aggregate %.

402 of 430 relevant lines covered (93.49%)

1652.69 hits per line

Jobs
ID Job ID Ran Files Coverage
1 507.1 27 Feb 2018 07:40PM UTC 0
88.72
Travis Job 507.1
2 507.2 27 Feb 2018 07:42PM UTC 0
88.72
Travis Job 507.2
3 507.3 27 Feb 2018 07:41PM UTC 0
88.72
Travis Job 507.3
4 507.4 27 Feb 2018 07:42PM UTC 0
88.72
Travis Job 507.4
Source Files on build 507
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #507
  • 195ad250 on github
  • Prev Build on master (#457)
  • Next Build on master (#510)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc