mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-15 09:09:10 +00:00
add feature flag stuff
Signed-off-by: Katalina Okano <git@kat.cafe>
This commit is contained in:
parent
3074db0a21
commit
dde05c402e
4 changed files with 53 additions and 0 deletions
8
packages/misc-utils/hasFeature.spec.ts
Normal file
8
packages/misc-utils/hasFeature.spec.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { Features } from '@roleypoly/types';
|
||||
import { hasFeature } from './hasFeature';
|
||||
|
||||
it('correctly matches against features', () => {
|
||||
const features = Features.LegacyGuild;
|
||||
expect(hasFeature(Features.LegacyGuild, features)).toBe(true);
|
||||
expect(hasFeature(Features.LegacyGuild, Features.None)).toBe(false);
|
||||
});
|
5
packages/misc-utils/hasFeature.ts
Normal file
5
packages/misc-utils/hasFeature.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
import { Features } from '@roleypoly/types';
|
||||
|
||||
export const hasFeature = (feature: Features, features: number): boolean => {
|
||||
return (features & feature) === feature;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue