Horrible Snippets - Check the string
Sam Clark

Sam Clark @samrocksc

About: I'm not good at programming :(

Location:
Berlin, Germany
Joined:
Sep 9, 2018

Horrible Snippets - Check the string

Publish Date: May 2 '19
7 0

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!

Comments 0 total

    Add comment