![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
node-rollout
Advanced tools
Feature rollout management for Node.js built on Redis
npm install node-rollout --save
// configuration.js
var rollout = require('node-rollout')
rollout.handler('new_homepage', {
// 1% of regular users
id: {
percentage: 1
},
// All users with the company email
employee: {
percentage: 100,
condition: function (val) {
return val.match(/@company-email\.com$/)
}
},
// 50% of users in San Francisco
geo_sf: {
percentage: 50,
condition: function (val) {
return geolib.getDistance([val.lat, val.lon], [37.768, -122.426], 'miles') < 7
}
}
})
// A typical Express app
...
require('./configuration')
app.get('/', new_homepage, old_homepage)
function new_home_page(req, res, next) {
rollout.get('new_homepage', req.current_user.id, {
employee: req.current_user.email,
geo: [req.current_user.lat, req.current_user.lon]
})
.then(function () {
res.render('home/new-index')
})
.otherwise(next)
}
function old_home_page (req, res, next) {
res.render('home/index')
}
rollout.get(key, uid, opt_values)
key
: String
The rollout feature key. Eg "new_homepage"uid
: String
The identifier of which will determine likelyhood of falling in rollout. Typically a user id.opt_values
: Object
optional A lookup object with default percentages and conditions. Defaults to {id: args.uid}
Promise
rollout.get('button_test', 123)
.then(function () {
render('blue_button')
})
.otherwise(function () {
render('red_button')
})
rollout.get('another_feature', 123, {
employee: 'user@example.org'
})
.then(function () {
render('blue_button')
})
.otherwise(function () {
render('red_button')
})
rollout.handler(key, flags)
key
: String
The rollout feature keyflags
: Object
flagname
: String
The name of the flag. Typically id
, employee
, ip
, or any other arbitrary item you would want to modify the rollout
percentage
: NumberRange
from 0 - 100. Can be set to a third decimal place such as 0.001
or 99.999
. Or simply 0
to turn off a feature, or 100
to give a feature to all userscondition
: Function
a white-listing method by which you can add users into a group. See examples.rollout.handler('admin_section', {
// 0% of regular users. You may omit `id` since it will default to 0
id: {
percentage: 0
},
// All users with the company email
employee: {
percentage: 100,
condition: function (val) {
return val.match(/@company-email\.com$/)
}
}
})
rollout.update(key, flags)
key
: String
The rollout feature keyflags
: Object
mapping of flagname
:String
to percentage
:Number
Promise
rollout.update('new_homepage', {
id: 33.333,
employee: 50,
geo_sf: 25
})
.then(function () {
// values have been updated
})
rollout.mods(flagname, callback)
flagname
: String
the rollout feature keycallback
: function
a callback function that returns the flags, their names, and valuesrollout.mods('new_homepage', function (mods) {
flags.employee == 100
flags.geo_sf == 50.000
flags.id == 33.333
})
rollout.flags()
rollout.flags() == ['new_homepage', 'other_secret_feature']
see tests/index.js
make test
Happy rollout!
FAQs
feature rollout management
The npm package node-rollout receives a total of 0 weekly downloads. As such, node-rollout popularity was classified as not popular.
We found that node-rollout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.