
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
js-helper-functions
Advanced tools
TypeScript utility functions.
countItemsInMultidimensionalObject
A function that recursively counts the number of selected items in a nested data structure. This function is particularly useful when dealing with hierarchical selection states such as those found in tree views, nested checklists, or multi-level category pickers.
type NestedObject = {
[key: string]: Node | string[];
};
Name | Type | Description |
---|---|---|
data | NestedObject Or string[] | A nested object or array representing selected items. |
📤 Returns
{
total: number; // Total count of items in the entire structure
result: {
[key: string]: number | { ...nested_object }
}
}
const selection = {
fruits: ["apple", "banana"],
vegetables: {
root: ["carrot", "beet"],
leafy: ["spinach"],
},
grains: {
rice: ["basmati"],
wheat: [],
},
};
const result = countItemsInMultidimensionalObject(selection);
console.log(result);
{
total: 6,
result: {
fruits: 2,
vegetables: {
root: 2,
leafy: 1
},
grains: {
rice: 1,
wheat: 0
}
}
}
A lightweight utility function that transforms a given string into a valid key name or key by normalizing spaces, removing special characters, and converting to lowercase.
Name | Type | Description |
---|---|---|
query | string | The string to be formatted. |
Type | Description |
---|---|
string | A kebab-cased, sanitized string suitable for use as a CSS class name or identifier. |
formatAsKey("Primary Button"); // "primary-button"
formatAsKey("Save&Continue!"); // "save-continue"
formatAsKey(" Complex--Key!! "); // "complex-key"
formatAsKey("Already-formatted_key"); // "already-formatted-key"
FAQs
---
The npm package js-helper-functions receives a total of 7 weekly downloads. As such, js-helper-functions popularity was classified as not popular.
We found that js-helper-functions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.