bs-js-collections
Advanced tools
Comparing version 1.5.0 to 1.6.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27506
9
77