All Projects → grebaldi → Plow Js

grebaldi / Plow Js

Licence: mit
Functional operations on large immutable objects

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Plow Js

Esp Mqtt Json Multisensor
(OBSOLETE) ESP MQTT JSON Multisensor for Home Assistant. Supported sensors include the TEMT6000 light, AM312 PIR, DHT22 temperature/humidity sensors. RGB led supports flash, fade, and transition. Over-The-Air (OTA) uploading, too!
Stars: ✭ 323 (+572.92%)
Mutual labels:  light
Avalondock
Our own development branch of the well known WPF document docking library
Stars: ✭ 518 (+979.17%)
Mutual labels:  light
Server Manager
This repository holds the IntISP Interface. It can be rebuilt to interface with any other hosting panel.
Stars: ✭ 31 (-35.42%)
Mutual labels:  light
Redis Ui
📡 P3X Redis UI is a very functional handy database GUI and works in your pocket on the responsive web or as a desktop app
Stars: ✭ 334 (+595.83%)
Mutual labels:  light
Hexo Theme Yun
☁️ A fast & light & lovely theme for Hexo. 一个对可爱自以为是的 Hexo 主题。
Stars: ✭ 477 (+893.75%)
Mutual labels:  light
Wled
Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
Stars: ✭ 7,626 (+15787.5%)
Mutual labels:  light
Msirgb
Alternative to MSI Mystic Light for controlling motherboard LEDs, without the fixed 7 colour limitation.
Stars: ✭ 276 (+475%)
Mutual labels:  light
Plenoptictoolbox2.0
The Plenoptic Toolbox 2.0 aims to help promote research on Focused Plenoptic Cameras (a.k.a. Plenoptic 2.0)
Stars: ✭ 45 (-6.25%)
Mutual labels:  light
Dsltablayout
♥️ Android界最万能的TabLayout(不仅仅是TabLayout), 支持任意类型的item, 支持Drawable类型的指示器,智能开启滚动,支持横竖向布局等
Stars: ✭ 489 (+918.75%)
Mutual labels:  light
Senseme
Python Library for Haiku SenseMe app controlled fans/lights
Stars: ✭ 19 (-60.42%)
Mutual labels:  light
Gatsby Starter Prismic
A typography-heavy & light-themed Gatsby Starter which uses the Headless CMS Prismic.
Stars: ✭ 381 (+693.75%)
Mutual labels:  light
Hugo Theme Introduction
Minimal, single page, smooth-scrolling theme for Hugo static site generator.
Stars: ✭ 441 (+818.75%)
Mutual labels:  light
Pytradfri
IKEA Trådfri/Tradfri API. Control and observe your lights from Python. Examples available. On pypi. Sans-io.
Stars: ✭ 778 (+1520.83%)
Mutual labels:  light
Q42.hueapi
C# helper library to talk to the Philips Hue bridge
Stars: ✭ 323 (+572.92%)
Mutual labels:  light
Superboucle
Loop application synced with jack transport
Stars: ✭ 31 (-35.42%)
Mutual labels:  light
Nofrils
An extremely minimalist colorscheme, even opting out of the second L in frills
Stars: ✭ 292 (+508.33%)
Mutual labels:  light
Nighttab
A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.
Stars: ✭ 598 (+1145.83%)
Mutual labels:  light
Lovelace Light With Profiles
Turn on lights based on light_profiles.csv
Stars: ✭ 47 (-2.08%)
Mutual labels:  light
Yeelight Platform
Yet Another Yeelight API in node.js
Stars: ✭ 35 (-27.08%)
Mutual labels:  light
Utox
µTox the lightest and fluffiest Tox client
Stars: ✭ 820 (+1608.33%)
Mutual labels:  light

Build Status

Plow JS

Functional operations on large immutable objects

Why?

Technologies like redux and Flux embrace the idea of a central immutable state object. Immutability brings a lot of benefits, especially regarding predictability and memory usage.

But it can be a rather daunting task to handle those objects in a readable fashion. When you're just trying to change a value deep inside an object structure while keeping the structure immutable, you can end up having code like this:

return Object.assign(
    {},
    state,
    {
        someProperty: Object.assign(
            {},
            state.someProperty,
            {
                someDeeperProperty: 'someValue'
            }
        )
    }
);

Of course, you want a function for that.

Immutable already does a great job on providing functions for these situation. But it does that in a rather OOP style and also binds you to a non-Standard API for data structures.

Plow JS is aiming to fill the remaining gap with functional operations, that allow you to process large state objects in a clear and declarative way.

Installation

You can install Plow JS via npm:

npm install plow-js

Example

Given the following object:

const state = {
    rooms: {
        kitchen: {
            light: 'off',
            door: 'closed',
            refrigerator: ['beer']
        },
        living: {
            tv: 'off'
        }
    }
}

Plow JS allows you to open the kitchen door and turn the light on as follows:

const newState = $merge('rooms.kitchen', {
    light: 'on',
    door: 'open'
}, state);

Well that was easy... Now let's grab a beer, turn the light off and the TV on:

const beer = $head('rooms.kitchen.refrigerator', state);
const newState = $all(
    $set('rooms.kitchen.refrigerator', []),
    $set('rooms.kitchen.light', 'off'),
    $set('rooms.living.tv', 'on'),
    state
);

License

The MIT License (MIT) Copyright (c) 2016 Wilhelm Behncke

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].