Socket
Socket
Sign inDemoInstall

bs-js-collections

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-js-collections - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

src/JsMap.rei

2

package.json
{
"name": "bs-js-collections",
"description": "Bindings to JavaScript primitive Set and Map types",
"version": "1.5.0",
"version": "1.6.0",
"scripts": {

@@ -6,0 +6,0 @@ "copy-git-hooks": "mkdir -p ./.git/hooks && cp -v ./hooks/* ./.git/hooks",

@@ -11,5 +11,19 @@ # `bs-js-collections`

```reason
let myIntSet = JsSet.empty();
[|1, 2, 3|]->Belt.Array.forEach(myIntSet->JsSet.add);
myIntSet->JsSet.delete(1);
// Construct empty, with a single element, or from an array
let myEmptySet = JsSet.empty();
let mySetWithOneString = JsSet.singleton("hello!");
let myIntSet = [|1, 2, 3|]->JsSet.fromArray;
// Mutably add some values to the set
[|3, 4, 5|]->Belt.Array.forEach(myIntSet->JsSet.addMut);
// Mutably delete values from the set
myIntSet->JsSet.deleteMut(1);
// Map functions over the set
let myStringSet = myIntSet->JsString.map(string_of_int);
// Filter the set
let my
Js.log(myIntSet->JsSet.size); // 2

@@ -28,7 +42,13 @@ ```

See unit tests for more examples. In addition a number of higher-level
utility functions are included, such as `map`, `keep`, `keepMap`, etc.
In addition to bindings to the native API, this library adds a number
of functions useful for pure functional programming, such as:
* Conversion to/from various data structures such as arrays, lists,
dicts and `Belt` data structures
* `map`, `keep`, `reduce`, including `*WithKey` versions for the Map type
* Set operations such as `union`, `intersection` and `diff`
See the `.rei` files for more tails, and unit tests examples of usage.
In general we try to follow naming conventions similar to `Belt` and
a pipe-first style. Note that many of these functions still require tests,
so use with caution and your own testing.
a pipe-first style.

@@ -35,0 +55,0 @@ ## Usable types

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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