<commit_before># ud-kefir

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/AgentME/ud-kefir/blob/master/LICENSE.txt) [![npm version](https://img.shields.io/npm/v/ud-kefir.svg?style=flat)](https://www.npmjs.com/package/ud-kefir) [![CircleCI Status](https://circleci.com/gh/AgentME/ud-kefir.svg?style=shield)](https://circleci.com/gh/AgentME/ud-kefir)

A companion utility to [ud](https://github.com/AgentME/ud) for exposing new
values from hot module replacements as
[Kefir](https://rpominov.github.io/kefir/) streams. It's split out from ud only
to avoid making ud require a Kefir peer dependency.

## API

### udKefir(module, value, key?)

This library exposes itself as a single function. Like ud's functions, the
first argument must be a module object, and the last parameter is an optional
key. This function may only be used once per module with a given key. On the
first run, a Kefir property containing the given value will be returned. On
future reloads, the original property will be updated to emit the new value,
and the property will be returned.

Be careful that module replacements do not add new listeners to the property
each time (at least not without old listeners unsubscribing themselves),
because the old listeners still persist.

## Examples

### Value stream

udKefir can be used to keep already constructed resources up-to-date. Here's
an example of udKefir being used to keep a stylesheet set to the latest value<commit_msg>docs(readme): add Greenkeeper badge<commit_after># ud-kefir

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/AgentME/ud-kefir/blob/master/LICENSE.txt) [![npm version](https://img.shields.io/npm/v/ud-kefir.svg?style=flat)](https://www.npmjs.com/package/ud-kefir) [![CircleCI Status](https://circleci.com/gh/AgentME/ud-kefir.svg?style=shield)](https://circleci.com/gh/AgentME/ud-kefir) [![Greenkeeper badge](https://badges.greenkeeper.io/AgentME/ud-kefir.svg)](https://greenkeeper.io/)

A companion utility to [ud](https://github.com/AgentME/ud) for exposing new
values from hot module replacements as
[Kefir](https://rpominov.github.io/kefir/) streams. It's split out from ud only
to avoid making ud require a Kefir peer dependency.

## API

### udKefir(module, value, key?)

This library exposes itself as a single function. Like ud's functions, the
first argument must be a module object, and the last parameter is an optional
key. This function may only be used once per module with a given key. On the
first run, a Kefir property containing the given value will be returned. On
future reloads, the original property will be updated to emit the new value,
and the property will be returned.

Be careful that module replacements do not add new listeners to the property
each time (at least not without old listeners unsubscribing themselves),
because the old listeners still persist.

## Examples

### Value stream

udKefir can be used to keep already constructed resources up-to-date. Here's
an example of udKefir being used to keep a stylesheet set to the latest value
{'fraction_non_alphanumeric': 0.10502577319587629, 'fraction_numerical': 0.0, 'mean_word_length': 4.771375464684015, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 18, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1930230', 'n_tokens_mistral': 958, 'n_tokens_neox': 912, 'n_words': 354}