Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@vyacheslav97/ct
Advanced tools
Common tools (hereinafter referred to as **ct**) - a common JavaScript data structures and associated processing procedures package.
Common tools (hereinafter referred to as ct) - a common JavaScript data structures and associated processing procedures package.
Tip: questions bother your head? Feel free to contact me: https://t.me/WernerWalter
UIC module provides a user with two functions: transformToIterable and its wrapper, createIterableTransformer. UIC module is represented by uic.ts file of original project.
transformToIterable is a core procedure - it defines the way an input iterable is converted to an output one. createIterableTransformer wraps transformToIterable to create an iterable convertor with encapsulated target iterable constructor.
transformToIterable algorithm essentials:
UIC members can be imported as follows:
import {createIterableTransformer, transformToIterable} from '@vyacheslav97/ct/uic';
createIterableTransformer is highly recommended for usage instead of transformToIterable to avoid redundant target iterable constructor referencing. For example, lets inspect a createIterableTransformer application from uicsds.ts:
/**
* Creates <u>**Array**</u> to <u>**Map**</u> converter
* @param arrayItemTransformer <u>**Array**</u> item transformer, derives key-value pair from array item
*/
export function createArrayToMap<ArrayItemType, K, V>(
arrayItemTransformer: SingleToPair<ArrayItemType, K, V>,
) {
return createIterableTransformer<ArrayItemType[], [K, V], Map<K, V>>(Map, arrayItemTransformer);
}
createArrayToMap creates an Array to Map transformer. All such transformer needs to be utilized is an array item transform function, which converts an array item to key-value pair for Map constructor. Here goes an createArrayToMap application example:
// Clarifies the rule how to transform array item to a key-value pair list
const shiftedArrayItemToMapItemTransformer: SingleToPair<number, number, number>
= (number): [number, number] => [number, number + 1];
// Creates array to map converter with certain array item rule transformation
const arrayToMapShifted = createArrayToMap<number, number, number>(shiftedArrayItemToMapItemTransformer);
arrayToMapShifted([1, 2, 3]) //--> {1 -> 2, 2 -> 3, 3 -> 4} - final Map object content
Remember, you are able to create your own custom iterable transformers!
UICSDS module consists of createIterableTransformer applications to built-in JavaScript iterable datastructures. uicsds.ts represents UICSDS module content.
UICSDS module members can be imported as follows:
import {createArrayToMap, createMapToSet} from '@vyacheslav97/ct/uicsds';
It's pretty easy to use:
Example:
// All needed type aliases for conversion laws can be imported as follows:
import {
SingleToPair,
SingleToSingle,
PairToSingle
} from "@vyacheslav97/uic/interfaces";
// Map item to a character transformer
const keyValuePairConcatenatedTransformer: PairToSingle<number, number, string>
= (pair) => pair.join('');
// Create transformer itself
const keyValuePairConcatenated = createMapToString(keyValuePairConcatenatedTransformer);
keyValuepairConcatenated(new Map([[1, 1], [2, 2]])); // results in '1122'
Webstorm (always) and VS Code (sometimes) can't autocomplete imports and don't fetch doc strings content. Despite this issue test project with simple webpack configurations assembles well and runs installed module code smoothly. If you now how to handle described issue via tuning ct package in particular, please, feel free to contact me. I'll appreciate your help.
Next scheduled implementations:
FAQs
Common tools (hereinafter referred to as **ct**) - a common JavaScript data structures and associated processing procedures package ([package repository](https://github.com/VyacheslavMishin/ct/tree/master)).
The npm package @vyacheslav97/ct receives a total of 2 weekly downloads. As such, @vyacheslav97/ct popularity was classified as not popular.
We found that @vyacheslav97/ct demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.