Last active
July 7, 2016 22:18
-
-
Save omichelsen/6440fe07d2c378383dc8c96331f62c81 to your computer and use it in GitHub Desktop.
Feature flipping data and rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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