Socket
Socket
Sign inDemoInstall

fairmont

Package Overview
Dependencies
12
Maintainers
3
Versions
90
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fairmont

Functional reactive programming for JavaScript and CoffeeScript.


Version published
Weekly downloads
1.5K
increased by0.07%
Maintainers
3
Install size
382 kB
Created
Weekly downloads
 

Readme

Source

Fairmont

Fairmont is a family of JavaScript libraries for functional reactive programming. Fairmont takes full advantage of ES6+ features like iterators (including async iterators), generators, and promises. Inspired by libraries like Underscore and many others, Fairmont features include:

  • reactive programming support through async iterators
  • lazy evaluation on collection operations via iterators
  • core functional operations, like currying and composition
  • bridge functions for integrating with OOP-based libraries
  • common file and stream based operations
  • streams and event emitters modeled as asynchronous iterators
  • observers for reacting to changes in state
  • unifies synchronous and asynchronous programming models

Example

Here's a simple reactive Web app implementing a counter using Fairmont's Reactive programming functions.

In JavaScript:

var $ = require("jquery"),
  F = require("fairmont");

$(function() {

  var data = { counter: 0 };

  F.start(F.flow([
    F.events("click", $("a[href='#increment']")),
    F.map(function() { data.counter++; })
  ]));

  F.start(F.flow([
    F.events("change", F.observe(data)),
    F.map(function() {
      $("p.counter")
        .html(data.counter);
    })
  ]));
});

In CoffeeScript:

{start, flow, events, map, observe} = require "fairmont-reactive"

$ = require "jquery"

$ ->

  data = counter: 0

  start flow [
    events "click", $("a[href='#increment']")
    map -> data.counter++
  ]

  start flow [
    events "change", observe data
    map ->
      $("p.counter")
      .html data.counter
  ]

Check out our other reactive examples:

Installation

You can simply install Fairmont as a whole:

npm install fairmont

Or you can simply install the components you need.

Example:

npm install fairmont-core

Learn more about the individual Fairmont components by clicking on the links below:

The API Reference provides documentation on each component and its corresponding functions.

Status

Fairmont is still under heavy development and is beta quality, meaning you should probably not use it in your production code.

Roadmap

You can get an idea of what we're planning by looking at the tickets. If you want something that isn't there, and you think it would be a good addition, please open a ticket.

Keywords

FAQs

Last updated on 11 Aug 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc