Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Feature flipping data and rules
const data = {
browser: {
name: 'Chrome',
version: '52.4.53.123',
os: 'Mac'
},
env: 'development',
settings: {
audioConference: {
release: '2016-10-23 22:34:12'
}
},
user: {
name: 'Ole',
role: 'Trusted',
profile: {
avatar: ...
}
}
}
const rules = {
user: {
group: /alpha|beta|theta/i
},
browser: {
name: 'Chrome'
},
browser: {
name: ['Chrome', 'Firefox']
},
browser: {
version: function (data) {
return parseInt(data.version) > 42 && parseInt(data.version) < 50;
}
},
settings: {
audioConference: function (data) {
return (new Date()) > data.release;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.