0.0.61 • Published 5 years ago

oulik v0.0.61

Weekly downloads
59
License
ISC
Repository
-
Last release
5 years ago

OULIK

Version Build Status Coverage Status Package Size Dependency count

Declarative, self-documenting state-management. Free of innacurate actions & convoluted reducers. All in-line.

🎨 WHY CHOOSE OULIK?

Oulik is designed to make your state management as transparent and semantically consistent as possible.
It's fluent API is 100% typesafe, and it uses that API to auto-generate your actions and perform immutable updates.
This library can be used with npm.io Vanilla-JS, with minimal bindings for npm.io React, and npm.io Angular.

🌈 SET UP

const get = set({
  username: '',
  favorite: {
    foods: new Array<string>(),
    hobbies: new Array<{ id: number, name: string }>(),
  },
});

✍️ WRITE STATE

get(s => s.username)                     // type: 'username.replace()'
  .replace('Terence');                   // replacement: 'Terence'

get(s => s.favorite.foods)               // type: 'favorite.foods.insert()'
  .insert(['Indian', 'Sushi']);          // insertion: ['Indian', 'Sushi']

get(s => s.favorite.hobbies)             // type: 'favorite.hobbies.find().patch()'
  .find(s => s.id).eq(3)                 // query: 'id === 3',
  .patch({ name: 'coding' });            // patch: { name: 'coding' }

🔍 READ STATE

get(s => s.favorite.hobbies)
  .read()

get(s => s.favorite.hobbies)
  .onChange(e => console.log(e));

derive(
  get(s => s.foods),
  get(s => s.hobbies),
).usingExpensiveCalc(
  (foods, hobbies) => {
    // some calculation we don't want to repeat unnecessarily
  }
)

🥚 NEST STORES

class TodoComponent {
  get = setNested({
    name: '',
    description: '',
    done: false,
  });
  onClickDone(done: boolean) {
    get(s => s.done)
      .replace(done);
  }
}
0.0.61

5 years ago

0.0.60

5 years ago

0.0.59

5 years ago

0.0.56

5 years ago

0.0.57

5 years ago

0.0.58

5 years ago

0.0.55

5 years ago

0.0.53

5 years ago

0.0.54

5 years ago

0.0.52

5 years ago

0.0.51

5 years ago

0.0.50

5 years ago

0.0.49

5 years ago

0.0.48

5 years ago

0.0.47

5 years ago

0.0.46

5 years ago

0.0.45

5 years ago

0.0.44

5 years ago

0.0.42

5 years ago

0.0.43

5 years ago

0.0.41

5 years ago

0.0.40

5 years ago

0.0.38

5 years ago

0.0.39

5 years ago

0.0.36

5 years ago

0.0.35

5 years ago

0.0.34

5 years ago

0.0.33

5 years ago

0.0.32

5 years ago

0.0.31

5 years ago

0.0.30

5 years ago

0.0.29

5 years ago

0.0.28

5 years ago

0.0.26

5 years ago

0.0.27

5 years ago

0.0.25

5 years ago

0.0.23

5 years ago

0.0.24

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.16

5 years ago

0.0.17

5 years ago

0.0.18

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.11

5 years ago

0.0.12

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago