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

@daeinc/array

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daeinc/array - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

11

dist/index.d.ts

@@ -26,2 +26,13 @@ /**

/**
* interpolates between two 1d array of any size. for now, numbers only.
*
* TODO:
* - expand to take object, nested aray/ojbects. recursive.
* @param arrStart array to start from
* @param arrTarget array to interpolate to
* @param t 0..1
* @returns 1d array
*/
export declare const interpolateArray: (arrStart: number[], arrTarget: number[], t: number) => number[];
/**
* check if all values of array is one.

@@ -28,0 +39,0 @@ * @param arr array to evaluate

25

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unwrapArrayOfObjects = exports.isAnyZero = exports.isAnyOne = exports.isAllZero = exports.isAllOne = exports.getNonZeroIndices = exports.fillAndMap = exports.addToArray = void 0;
exports.unwrapArrayOfObjects = exports.isAnyZero = exports.isAnyOne = exports.isAllZero = exports.isAllOne = exports.interpolateArray = exports.getNonZeroIndices = exports.fillAndMap = exports.addToArray = void 0;
const math_1 = require("@daeinc/math");
/**

@@ -58,2 +59,24 @@ * add to array in-place while limiting how many to keep history.

/**
* interpolates between two 1d array of any size. for now, numbers only.
*
* TODO:
* - expand to take object, nested aray/ojbects. recursive.
* @param arrStart array to start from
* @param arrTarget array to interpolate to
* @param t 0..1
* @returns 1d array
*/
const interpolateArray = (arrStart, arrTarget, t) => {
if (arrStart.length === 0 || arrTarget.length === 0)
throw new Error("interpolateArray(): arrays cannot be empty");
if (arrStart.length !== arrTarget.length)
throw new Error("interpolateArray(): length must be same");
return Array(arrStart.length)
.fill(0)
.map((_, i) => {
return (0, math_1.mix)(arrStart[i], arrTarget[i], t);
});
};
exports.interpolateArray = interpolateArray;
/**
* check if all values of array is one.

@@ -60,0 +83,0 @@ * @param arr array to evaluate

7

package.json
{
"name": "@daeinc/array",
"version": "0.1.0",
"version": "0.2.0",
"description": "Array utilities",

@@ -33,3 +33,6 @@ "types": "./dist/index.d.ts",

},
"homepage": "https://github.com/cdaein/array#readme"
"homepage": "https://github.com/cdaein/array#readme",
"dependencies": {
"@daeinc/math": "^0.2.0"
}
}

Sorry, the diff of this file is not supported yet

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