Socket
Socket
Sign inDemoInstall

rescript-js

Package Overview
Dependencies
1
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rescript-js

> Bindings to the JS standard library


Version published
Weekly downloads
833
decreased by-14.04%
Maintainers
1
Install size
85.5 kB
Created
Weekly downloads
 

Readme

Source

ReScriptJs

Bindings to the JS standard library

Goals

This is an alternative library to the default Js module.

Main differences:

  • Closer naming to the JS platform (e.g. Object vs Obj)
  • Type-first pipe
  • Consistent naming accross the bindings
  • Some missing data-structures (e.g. Map, WeakMap, Set, WeakSet, BigInt, Intl)
  • A DX that overall looks more like JS (if you open Js, you should feel at home)
  • Simple bindings to window, document and globalThis (they're basically typed as any)

Nearly all data structures maintain compatible types with the default Js module.

Installation

Run the following in your console:

$ yarn add rescript-js

Then add rescript-js to your bsconfig.json's bs-dependencies:

 {
   "bs-dependencies": [
+    "rescript-js"
   ]
 }

If you want to exclusively use rescript-js:

 {
   "bsc-flags": [
+    "-open ReScriptJs",
   ]
 }

Usage

open ReScriptJs.Js

Console.log("Hello world!")

let timeout = setTimeout(() => {
  Console.log("Hello!")
}, 100)

clearTimeout(timeout)

let array = [1, 2, 3]

let sum = array
  ->Array.map(x => x * 2)
  ->Array.reduce((acc, item) => acc + item, 0)

Available modules are listed in ReScriptJs.res

Keywords

FAQs

Last updated on 18 Aug 2022

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