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

microstates / microstates.js / 507 / 2
99%
master: 99%

Build:
DEFAULT BRANCH: master
Ran 27 Feb 2018 07:42PM UTC
Files 1
Run time 0s
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

27 Feb 2018 07:37PM UTC coverage: 88.717% (+2.0%) from 86.705%
507.2

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%)

413.17 hits per line

Source Files on job 507.2
  • Tree
  • List 0
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 1
  • Travis Job 507.2
  • 195ad250 on github
  • Prev Job for on master (#457.3)
  • Next Job for on master (#510.1)
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