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

tallstack

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tallstack - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

index.d.ts

16

index.js

@@ -83,2 +83,7 @@ /*

/**
* @param {(...args: any[]) => any} func
* @param {any[]} args
* @return {StackFrame}
*/
function call(func, ...args) {

@@ -88,2 +93,8 @@ return new StackFrame(func, args);

/**
* @param {any} thisArg
* @param {(...args: any[]) => any} func
* @param {any[]} args
* @return {StackFrame}
*/
function callWithContext(thisArg, func, ...args) {

@@ -133,2 +144,7 @@ return StackFrame.withContext(thisArg, func, args);

/**
* @param {(...args: any[]) => any} func
* @param {any} thisArg
* @param {(...args: any[]) => any} func
*/
function recursive(func, thisArg) {

@@ -135,0 +151,0 @@ const name = func.name || 'recurse';

2

package.json
{
"name": "tallstack",
"version": "0.0.0",
"version": "0.0.1",
"description": "A library that allows you to define recursive functions in JavaScript without stack overflow.",

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

@@ -6,2 +6,4 @@ # tallstack

It is published for download on [npm](https://www.npmjs.com/package/tallstack).
## Contents

@@ -27,3 +29,3 @@

if (N === 0) return 1;
return call(multiply, n, call(factorial, n - 1));
return call(multiply, N, call(factorial, N - 1));
});

@@ -56,6 +58,22 @@ ```

if (N === 0) return 1;
return callWithContext(object, multiply, n, call(factorial, n - 1));
return callWithContext(object, multiply, N, call(factorial, N - 1));
});
```
The function `recurse` also takes an optional 2nd parameter and binds that object to
the recursive function's `this` object. Extending the `N` factorial example again:
```javascript
const { call, callWithContext } = require('tallstack');
const obj = { multiply: (x, y) => (x * y) };
function factorialWithThis(N) {
if (N === 0) return 1;
return call(this.multiply, N, call(factorial, N - 1));
}
const factorial = recursive(factorialWithThis, obj);
```
## How does it work?

@@ -62,0 +80,0 @@

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