How to use @politie/sherlock-utils - 1 common examples

To help you get started, we’ve selected a few @politie/sherlock-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github politie / sherlock / scripts / process-bundle.js View on Github external
const utils = require('@politie/sherlock-utils');
const rxjs = require('@politie/sherlock-rxjs');

const a$ = sherlock.atom({ nested: { property: 'value' } });

let receivedValue
a$.react(v => receivedValue = v, { skipFirst: true });

assert.strictEqual(receivedValue, undefined);

const value$ = a$.pluck('nested').pluck('property');
assert.strictEqual(value$.get(), 'value');
value$.set('another value');

assert.deepStrictEqual(receivedValue, { nested: { property: 'another value' } });
assert.deepStrictEqual(utils.getStateObject(value$), { value: 'another value', resolved: true, errored: false });

assert.ok(rxjs.toObservable(a$));

console.log('Bundles ok.');

@politie/sherlock-utils

Utility functions that are designed to work with Sherlock. His toolbelt.

Apache-2.0
Latest version published 1 month ago

Package Health Score

73 / 100
Full package analysis

Popular @politie/sherlock-utils functions