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

lambda-math

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-math - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

4

package.json
{
"name": "lambda-math",
"version": "0.0.11",
"version": "0.0.12",
"description": "Pseudo lambda expressions for JS arbitrary-precision arithmetic operations.",

@@ -24,2 +24,4 @@ "main": "src/index.js",

"chai": "4.2.0",
"eslint": "^7.11.0",
"eslint-config-google": "^0.14.0",
"mocha": "8.1.1"

@@ -26,0 +28,0 @@ },

@@ -140,3 +140,3 @@ # Lambda math

Besides using `λ` as a function, you can also access the results of each invocation of the function via the array index, starting from 0. So first invocation of `λ` will store the result as `λ[0]`, second invocation as `λ[1]`, and so on. For convenience, `λ[i].number` will contain the JavaScript `number` result value, and `λ[i]` will contain the `BigNumber` result value.
Besides using `λ` as a function, you can also access the results of each invocation of the function via the array index, starting from 0. So first invocation of `λ` will store the result as `λ[0]`, second invocation as `λ[1]`, and so on. For convenience, `λ[i].number` will contain the JavaScript `number` result value, `λ[i].string` will contain the JavaScript `string` result value, and `λ[i]` will contain the `BigNumber` result value.

@@ -153,2 +153,6 @@ ### Example 6

console.log(λ[2].number); // 11
console.log(λ[0].string); // '3'
console.log(λ[1].string); // '7'
console.log(λ[2].string); // '11'
```

@@ -155,0 +159,0 @@

@@ -6,6 +6,6 @@ const BigNumber = require('bignumber.js');

let λ_call_count = -1;
let λCallCount = -1;
function λ() {
const func = arguments[0];
function λ(...args) {
const func = args[0];
const funcArgsSet = [];

@@ -15,4 +15,4 @@ let repeatLastFuncTimes = 1;

λ_call_count += 1;
λ[λ_call_count] = new BigNumber(0);
λCallCount += 1;
λ[λCallCount] = new BigNumber(0);

@@ -36,12 +36,12 @@ if (typeof func === 'undefined' || func === undefined) {

if (Array.isArray(arguments[1]) === false) {
if (Array.isArray(args[1]) === false) {
throw new TypeError('λ: 2nd param should be an array!');
}
funcArgsSet.push(arguments[1]);
funcArgsSet.push(args[1]);
c1 = 2;
while (typeof arguments[c1] !== 'undefined') {
if (typeof arguments[c1] === 'number') {
repeatLastFuncTimes = Math.floor(arguments[c1]);
while (typeof args[c1] !== 'undefined') {
if (typeof args[c1] === 'number') {
repeatLastFuncTimes = Math.floor(args[c1]);

@@ -52,7 +52,7 @@ if (Number.isNaN(repeatLastFuncTimes) || repeatLastFuncTimes <= 0) {

if (typeof arguments[c1 + 1] !== 'undefined') {
if (typeof args[c1 + 1] !== 'undefined') {
throw new Error('λ: Repeat last function call times should be the last parameter!');
}
} else if (Array.isArray(arguments[c1])) {
funcArgsSet.push(arguments[c1]);
} else if (Array.isArray(args[c1])) {
funcArgsSet.push(args[c1]);
} else {

@@ -83,7 +83,7 @@ throw new TypeError('λ: 3rd, 4th, ... params can be either an array or a number!');

if (args[idx] === Σ) {
args[idx] = λ[λ_call_count];
args[idx] = λ[λCallCount];
}
});
λ[λ_call_count] = func(args[0], args[1]);
λ[λCallCount] = func(args[0], args[1]);
});

@@ -100,11 +100,12 @@

if (args[idx] === Σ) {
args[idx] = λ[λ_call_count];
args[idx] = λ[λCallCount];
}
});
λ[λ_call_count] = func(args[0], args[1]);
λ[λCallCount] = func(args[0], args[1]);
}
}
λ[λ_call_count].number = λ[λ_call_count].toNumber();
λ[λCallCount].number = λ[λCallCount].toNumber();
λ[λCallCount].string = λ[λCallCount].toString(10);

@@ -115,7 +116,7 @@ return λ;

λ.reset = function() {
while (λ_call_count >= 0) {
λ[λ_call_count] = undefined;
delete λ[λ_call_count];
while (λCallCount >= 0) {
λ[λCallCount] = undefined;
delete λ[λCallCount];
λ_call_count -= 1;
λCallCount -= 1;
}

@@ -122,0 +123,0 @@ };

@@ -6,3 +6,3 @@ const { verifyFuncParams, convertFuncParams } = require('./utils');

({x, y} = convertFuncParams(x, y));
({ x, y } = convertFuncParams(x, y));

@@ -15,3 +15,3 @@ return x.plus(y);

({x, y} = convertFuncParams(x, y));
({ x, y } = convertFuncParams(x, y));

@@ -24,3 +24,3 @@ return x.minus(y);

({x, y} = convertFuncParams(x, y));
({ x, y } = convertFuncParams(x, y));

@@ -33,3 +33,3 @@ return x.times(y);

({x, y} = convertFuncParams(x, y));
({ x, y } = convertFuncParams(x, y));

@@ -36,0 +36,0 @@ return x.div(y);

@@ -25,5 +25,5 @@ const BigNumber = require('bignumber.js');

return {x, y};
return { x, y };
}
module.exports = { verifyFuncParams, convertFuncParams };

Sorry, the diff of this file is too big to display

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