DEV Community

Sam Clark
Sam Clark

Posted on

Horrible Snippets - Check the string

Usecase
Let's say you're looking to implement a darklaunch feature, you have some options, you can pass a bunch of env vars(RUN_EVENT_1=true, etc.) OR you can just pass a DARK_LAUNCH flag with some comma separated vars.

const stringydingy = 'foo,bar,baz';

stringydingy.split(',').includes('foo');

if(stringydingy.split(',').includes('foo')) {
  runDarkLaunchDotCalm();
}

Play with it, try it out in your project! Give me feedback on how it can be improved!

Top comments (0)