Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@anselan/maprange

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anselan/maprange - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

28

dist/index.test.js

@@ -19,2 +19,30 @@ "use strict";

});
describe('pixel values', () => {
test('far left', () => {
const value = 0;
expect(_1.default(value, 0, 1, 0, 1920)).toBe(0);
});
test('leftish', () => {
const value = 0.25;
expect(_1.default(value, 0, 1, 0, 1920)).toBe(480);
});
test('far right', () => {
const value = 1.0;
expect(_1.default(value, 0, 1, 0, 1920)).toBe(1920);
});
});
describe('negative values', () => {
test('middle is 0', () => {
const value = 0.5;
expect(_1.default(value, 0, 1, -1, 1)).toBe(0);
});
test('leftish', () => {
const value = 0.25;
expect(_1.default(value, 0, 1, -1000, 1000)).toBe(-500);
});
test('far right', () => {
const value = 80;
expect(_1.default(value, 0, 100, -100, 100)).toBe(60);
});
});
//# sourceMappingURL=index.test.js.map

2

package.json
{
"name": "@anselan/maprange",
"version": "0.2.0",
"version": "0.2.1",
"description": "Map values from one range to another",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -17,2 +17,32 @@ import remap from '.'

})
describe('pixel values', () => {
test('far left', () => {
const value = 0;
expect(remap(value, 0, 1, 0, 1920)).toBe(0)
})
test('leftish', () => {
const value = 0.25;
expect(remap(value, 0, 1, 0, 1920)).toBe(480)
})
test('far right', () => {
const value = 1.0;
expect(remap(value, 0, 1, 0, 1920)).toBe(1920)
})
})
describe('negative values', () => {
test('middle is 0', () => {
const value = 0.5;
expect(remap(value, 0, 1, -1, 1)).toBe(0);
})
test('leftish', () => {
const value = 0.25;
expect(remap(value, 0, 1, -1000, 1000)).toBe(-500)
})
test('far right', () => {
const value = 80;
expect(remap(value, 0, 100, -100, 100)).toBe(60)
})
})

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