1.0.53 • Published 8 months ago

togglee v1.0.53

Weekly downloads
17
License
APACHE-2.0
Repository
github
Last release
8 months ago

LogoMakr_4ojFPZ

Build & Publish codecov npm GitHub license Maintenance Donate

Motivation

Simple library to separate deployment of features from release time. It uses network accesible files without the need of a server to provide feature toggles.

Installation

add it to your project using npm install togglee --save or yarn add togglee

Usage

const { Togglee } = require("togglee")

const url = "https://gist.githubusercontent.com/kanekotic/c469f99bef5a5c0634b4a94a4acd6546/raw/toggles"
const refreshRateSeconds = 5
const defaultValues = [
    {
      type: "release",
      name: "prop",
      value: true,
    },
    {
      type: "release",
      name: "prop2",
      value: true
    },
    {
      type: "context",
      name: "prop3",
      conditions: [
        {
          field: "username",
          value: "user1",
          operation: "eq"
        }
      ]
    }
]

const subject = new Togglee(url, refreshRateSeconds, defaultValues)


setInterval(() => {
    if (subject.isEnabled("prop"))
        console.log("do stuff")
    else
        console.log("dont do stuff")
    if (subject.isEnabled("prop3", {"username": "user1"}))
        console.log("do stuff for user 1")
    else
        console.log("dont do stuff for user 1")
    if (subject.isEnabled("prop3", {"username": "user2"}))
        console.log("do stuff for user 2")
    else
        console.log("dont do stuff for user 2")
        
    console.log("-----------")
}, 10000);

Type of toggles

Release

Simple true/false logical path definition.

{
    type: "release",
    name: "prop",
    value: true,
}

Context

Allows complex logic to decide the outcome of the logical path (example traffic, users, resources available).

{
    type: "context",
    name: "prop3",
    conditions: [
        {
            field: "username",
            value: "user1",
            operation: "eq"
        }
    ]
}

available operations are:

  • 'eq': equal (===)
  • 'ne': not equal (!==)
  • 'gt': greater than (>)
  • 'ge': greater equal (>=)
  • 'lt': lesser than (<)
  • 'le': lesser qqual (<=)
1.0.39

11 months ago

1.0.40

11 months ago

1.0.44

10 months ago

1.0.43

10 months ago

1.0.42

10 months ago

1.0.41

11 months ago

1.0.48

9 months ago

1.0.47

9 months ago

1.0.46

9 months ago

1.0.45

10 months ago

1.0.49

9 months ago

1.0.51

8 months ago

1.0.50

8 months ago

1.0.53

8 months ago

1.0.52

8 months ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.38

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.11

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.10

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.0.19

2 years ago

0.0.18

3 years ago

0.0.17

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago