Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

immutable-partition

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable-partition

A partition helper returning ImmutableJS structures

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

immutable-partition

Build Status

A partitioning helper returning an immutablejs Map of Lists:

import partition from 'immutable-partition'

const someNumbers = List.of(0, 1, 2, 3)
const evenOrOdd = (number) => number % 2 === 1 ? 'odd' : 'even'
const partitions = partition(evenOrOdd, someNumbers)
console.log(partitions.toString())
// > Map { "even": List [ 0, 2 ], "odd": List [ 1, 3 ] }

Install

npm i -S immutable-partition

# or

yarn add immutable-partition

Usage

partition takes the two following arguments and returns a Map<K:string, V:List>.

  • keyForValue(value: any): string must return a string
  • reducible just needs to have a reduce function so it can be any immutablejs structure, a regular array or anything that acts like one.

partition is curried so it can be called in two ways:

partition(keyForValue, reducible)
// or
partition(keyForValue)(reducible)

Keywords

FAQs

Package last updated on 19 Dec 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc