
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Splits a String into an Array of substrings with the option to skip some cases where the separator is found, based on some truthy condition.
Splits a String into an Array of substrings with the option to skip some cases where the separator is found, based on some truthy condition.
Node.js and Browser ready.
npm install split-skip
CLI
npm install split-skip -g
npx split-skip --help
const splitSkip = require('split-skip');
//@param {String} str - Input String
const str = 'Some,String,as,an,Input';
// @param {String} separator - Specifies the character(s) to use for separating the string
const separator = ',';
// @param {Function} skipState - Function to be called on each iteration, to manage the skip state. Parameters: `(state, char, i)`
const skipState = (state, char, i) => {
/*
Some logic to define state.skip equals to some truthy value
e.g. state.skip = true, state.skip = 1
when it should skip if the current char matches the separator
*/
/*
And define state.skip equals to some falsy value
e.g. state.skip = false, state.skip = 0
when it should get back splitting if the current char matches the separator
*/
// Must alway return the state;
return state;
};
const resultArray = splitSkip(str, separator, skipState);
As an input we have a string representing the parameters definition of a function from where we want to get each individual parameter. One idea of doing this is to split on every comma, but skipping the commas that are present on destructuring parameters definitions. Using splitSkip, it could be like:
const input = `[destru,cturu,cing]=[1],param,{dd,ee,ff}={dd:{b:1,c:2,arr:[1,6]}},last`;
const result = splitSkip(input, ',', (state, char, i) => {
if ('{[('.indexOf(char) >= 0) {
state.skip += 1;
}
if ('}])'.indexOf(char) >= 0) {
state.skip -= 1;
}
return state;
});
// result === ['[destru,cturu,cing]=[1]', 'param', '{dd,ee,ff}={dd:{b:1,c:2,arr:[1,6]}}', 'last'];
FAQs
Splits a String into an Array of substrings with the option to skip some cases where the separator is found, based on some truthy condition.
The npm package split-skip receives a total of 215,070 weekly downloads. As such, split-skip popularity was classified as popular.
We found that split-skip demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.