New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bedard/math

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bedard/math - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

src/functions/bilerp.spec.ts

15

dist/index.bundle.d.ts
/**
* Two dimensional vector
*/
type Vector2 = [
number,
number
];
/**
* Bi-linear interpolation
*/
declare function bilerp([x1, y1]: Vector2, [x2, y2]: Vector2, alpha: number): Vector2;
/**
* Linear interpolation between two numbers.
*/
declare function lerp(a: number, b: number, alpha: number): number;
declare const version = "0.1.1";
export { lerp, version };
declare const version = "0.2.0";
export { bilerp, lerp, version };

2

dist/index.bundle.js

@@ -1,2 +0,2 @@

var BedardMath=function(e){"use strict";return e.lerp=function(e,r,t){return e*(1-t)+r*t},e.version="0.1.1",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var BedardMath=function(e){"use strict";function r(e,r,n){return e*(1-n)+r*n}return e.bilerp=function([e,n],[t,u],i){return[r(e,t,i),r(n,u,i)]},e.lerp=r,e.version="0.2.0",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=index.bundle.js.map
/**
* Two dimensional vector
*/
type Vector2 = [
number,
number
];
/**
* Bi-linear interpolation
*/
declare function bilerp([x1, y1]: Vector2, [x2, y2]: Vector2, alpha: number): Vector2;
/**
* Linear interpolation between two numbers.
*/
declare function lerp(a: number, b: number, alpha: number): number;
declare const version = "0.1.1";
export { lerp, version };
declare const version = "0.2.0";
export { bilerp, lerp, version };
/**
* Two dimensional vector
*/
type Vector2 = [
number,
number
];
/**
* Bi-linear interpolation
*/
declare function bilerp([x1, y1]: Vector2, [x2, y2]: Vector2, alpha: number): Vector2;
/**
* Linear interpolation between two numbers.
*/
declare function lerp(a: number, b: number, alpha: number): number;
declare const version = "0.1.1";
export { lerp, version };
declare const version = "0.2.0";
export { bilerp, lerp, version };

@@ -8,4 +8,11 @@ /**

const version = '0.1.1';
/**
* Bi-linear interpolation
*/
function bilerp([x1, y1], [x2, y2], alpha) {
return [lerp(x1, x2, alpha), lerp(y1, y2, alpha)];
}
export { lerp, version };
const version = '0.2.0';
export { bilerp, lerp, version };

@@ -12,5 +12,13 @@ 'use strict';

const version = '0.1.1';
/**
* Bi-linear interpolation
*/
function bilerp([x1, y1], [x2, y2], alpha) {
return [lerp(x1, x2, alpha), lerp(y1, y2, alpha)];
}
const version = '0.2.0';
exports.bilerp = bilerp;
exports.lerp = lerp;
exports.version = version;

@@ -39,3 +39,3 @@ {

"unpkg": "dist/index.bundle.js",
"version": "0.1.1"
"version": "0.2.0"
}

@@ -1,7 +0,56 @@

# math
# `@bedard/math`
[![Build status](https://img.shields.io/github/workflow/status/scottbedard/math/Test)](https://github.com/scottbedard/math/actions)
[![Codecov](https://img.shields.io/codecov/c/github/scottbedard/math)](https://codecov.io/gh/scottbedard/math)
[![Dependencies](https://img.shields.io/david/scottbedard/math)](https://david-dm.org/scottbedard/math)
[![Dev dependencies](https://img.shields.io/david/dev/scottbedard/math)](https://david-dm.org/scottbedard/math?type=dev)
[![NPM](https://img.shields.io/npm/v/@bedard/math)](https://www.npmjs.com/package/@bedard/math)
[![Bundle size](https://img.shields.io/bundlephobia/minzip/@bedard/math?label=gzipped)](https://bundlephobia.com/result?p=@bedard/math)
[![License](https://img.shields.io/github/license/scottbedard/math?color=blue)](https://github.com/scottbedard/math/blob/main/LICENSE)
A place for to store functions so I don't keep duplicating them between projects.
This library exists to help me avoid duplicate code between projects. My goal here is to expose small, well tested, and tree-shakeable utilities. Given the simplicity of these functions, I do not anticipate breaking changes. But be warned, this project is not following semantic versioning.
## Installation
The recommended installation method is via NPM.
```bash
npm install @bedard/math
```
Alternatively, these functions maybe be accessed via a CDN. When using a CDN, the library will be exposed globally as `BedardMath`.
```html
<script src="https://unpkg.com/@bedard/math"></script>
```
## Functions
- [`bilerp`](#bilerp)
- [`lerp`](#lerp)
### `bilerp`
Bi-linear interpolation between vectors.
```js
import { bilerp } from '@bedard/math'
bilerp([0, 0], [10, 10], 0.5) // [5, 5]
```
### `lerp`
Linear interpolation between numbers.
```js
import { lerp } from '@bedard/math'
lerp(0, 10, 0.5) // 5
```
## License
[MIT](https://github.com/scottbedard/math/blob/master/LICENSE)
Copyright (c) 2021-present, Scott Bedard

@@ -1,3 +0,4 @@

export { lerp } from './utils/lerp'
export { bilerp } from './functions/bilerp'
export { lerp } from './functions/lerp'
export const version = '0.1.1'
export const version = '0.2.0'

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