npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@alt-javascript/scanner-darkly

v1.0.2

Published

A Pluggable Scanner For Launch Darkly Feature Flag Variations

Downloads

10

Readme

A Pluggable Scanner For Launch Darkly Feature Flag Variations

NPM Language Badge Package Badge release notes

Introduction

A pluggable scanner for listening and acting on Launch Darkly feature flag variations in server-side node.js.

Usage

To use the module, follow the example in the included scan.js file, which plays nicely with all the other @alt-javascript modules.

The Scanner, takes an Arctor (or array of Arctors) that will act on flagged LaunchDarkly variations with the implemented see(clearly) function, in this case the provided LogArctor outputs the changed flag value.

scan.js

const LaunchDarkly = require('launchdarkly-node-server-sdk');
const ScannerDarkly = require('@alt-javascript/scanner-darkly');
const {config} = require ("@alt-javascript/config");
const {boot} = require ("@alt-javascript/boot");
const {LoggerFactory} = require ('@alt-javascript/logger');
boot({ config });


const LogArctor = require('@alt-javascript/scanner-darkly'); // this  uses booted logging config, so is required after boot().

const logger = LoggerFactory.getLogger('@alt-javascript/scanner-darkly/scan');
const ldlogger = LoggerFactory.getLogger('LaunchDarkly');
const SDK_KEY = config.get('scanner.darkly.sdk-key');
const scannerDarkly = new ScannerDarkly(
    new LogArctor('logging-levels', {"key": "[email protected]"},null),
    SDK_KEY,
    {logger : ldlogger});

scannerDarkly.init();
// ... later, on process exit.
scannerDarkly.destroy();

When your LaunchDarkly product, environment, sdk-key and feature flag are configured, you should see output like:

Wed Jul 28 2021 10:57:03 GMT+1000 (GMT+10:00):LaunchDarkly:info:Initializing stream processor to receive feature flag updates
Wed Jul 28 2021 10:57:04 GMT+1000 (GMT+10:00):LaunchDarkly:info:Opened LaunchDarkly stream connection
Wed Jul 28 2021 10:57:04 GMT+1000 (GMT+10:00):LaunchDarkly:debug:Received put event
Wed Jul 28 2021 10:57:15 GMT+1000 (GMT+10:00):LaunchDarkly:debug:Received patch event
Wed Jul 28 2021 10:57:15 GMT+1000 (GMT+10:00):LaunchDarkly:debug:Updating logging-levels in features
Wed Jul 28 2021 10:57:15 GMT+1000 (GMT+10:00):@alt-javascript/scanner-darkly/LogArctor:info:Variation seen clearly as {"crew_prestart/src/services":"debug"}
Wed Jul 28 2021 10:57:18 GMT+1000 (GMT+10:00):LaunchDarkly:debug:Flushing %d events2

Yes, its Arctor, not Actor

Yes, the class is called Arctor by design, and in homage to one of my very favourite novels,

What does a scanner see? he asked himself. I mean, really see? Into the head? Down into the heart? Does a passive infrared scanner like they used to use or a cube-type holo-scanner like they use these days, the latest thing, see into me - into us - clearly or darkly? I hope it does, he thought, see clearly, because I can't any longer these days see into myself. I see only murk. Murk outside; murk inside. I hope, for everyone's sake, the scanners do better. Because, he thought, if the scanner sees only darkly, the way I myself do, then we are cursed, cursed again and like we have been continually, and we'll wind up dead this way, knowing very little and getting that little fragment wrong too.

A Scanner Darkly - Philip. K. Dick, 1977

The movie is pretty good too, weird good.