Socket
Socket
Sign inDemoInstall

smooth.ts

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    smooth.ts

A new age typescript binding for smooth.js


Version published
Weekly downloads
5
increased by400%
Maintainers
1
Install size
15.8 kB
Created
Weekly downloads
 

Readme

Source

Smooth.ts

A new age typescript bindings for smooth.js used under MIT license.

Motivation

Smooth.js is a super lightweight library that allows doing interpolations very performant way. It's slightly different than the other libraries because result curve goes through input points. The only problem is that this library has more than 10 years and has really poor bindings for technologies used in 2022.

Demo

Link to demo available here

Solution

I've taken result JS library (version: 0.1.6) and created bindings for it what makes usage of it much easier.

Installation

yarn add smooth.ts

or with npm

npm install --save smooth.ts

Usage

import { Smooth } from 'smooth.ts';

const smoother = Smooth([2, 1, 3, 7]);

// take interpolation between 0th and 1st element at half of segment
smoother(0.5); // 1.375

Works also for 2d data:

import { Smooth } from 'smooth.ts';

const points = [[10, 15], [32, 40], [1, 0]];
const pointsSmoother = Smooth(points);

// take interpolation between 0th and 1st point at half of segment
pointsSmoother(0.5); // [22.9375, 30]

License

MIT

Keywords

FAQs

Last updated on 13 Mar 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