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.
@igor.dvlpr/scramble
Advanced tools
๐ Scrambles (rearranges randomly) Strings and Arrays. ๐
๐ Support further development
I work hard for every project, including this one
and your support means a lot to me!
Consider buying me a coffee. โ
Thank you for supporting my efforts! ๐๐
@igorskyflyer
Fisher-Yates
algorithmInstall it by executing:
npm i '@igor.dvlpr/scramble'
scrambleString(input: string, options?: IStringOptions): string
Scrambles the characters of each word in a given string.
input
- The string to be scrambled.
[!NOTE] Since
Fisher-Yates
algorithm is used for scrambling, a length of > 3 is needed for a word to be able to get scrambled.
options
- Options for scrambling, optional.
options
are defined via an interface IStringOptions
:
interface IStringOptions {
trimWhitespace?: boolean
}
trimWhitespace
, if true all whitespace is removed from the input string prior to scrambling its contents.
Returns the scrambled string.
Will throw an error if the input is not a string.
scrambleArray<ArrayType>(input: ArrayType[]): ArrayType[]
Scrambles the elements of an array.
input
- The array to be scrambled.
Returns the scrambled array.
Will throw an error if the input is not an array.
example.mts
import { scrambleString, scrambleArray } from '@igor.dvlpr/scramble'
// these are just sample outputs
// since each invocation reorders
// elements randomly
console.log(scrambleString(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
)) // returns 'Leorm isupm dloor sit aetm, ccotnsueetr asdincipig eitl.'
console.log(scrambleString(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', { trimWhitespace: true }
)) // returns 'Lpetssgerodcsctcmuaunelrteiisoomirlait,toindmipe.'
console.log(scrambleArray([1, 2, 3, 4, 5, 6, 7, 8])) // [5, 7, 1, 4, 2, 8, 3, 6]
๐ The changelog is available here: CHANGELOG.md.
Licensed under the MIT license which is available here, MIT license.
๐ Provides UArray, an Array type that supports negative indices/indexes, just wrap your regular JavaScript array with UArray() and you are all set! ๐
๐งต An expressive and chainable library for advanced string manipulations. Supports appending, prepending, trimming, quoting, and path formatting with customizable whitespace handling. Makes advanced String manipulations a piece of cake. ๐ฆฅ
๐ฅ Removes HTML code from the given string. Can even extract text-only from the given an HTML string. โจ
๐ฆ ExtendableString allows you to create strings on steroids that have custom transformations applied to them, unlike common, plain strings. ๐ช
โ DรบรถScrรญbรฎ allows you to convert letters with diacritics to regular letters. ๐ค
Created by Igor Dimitrijeviฤ (@igorskyflyer).
FAQs
๐ Scrambles (rearranges randomly) Strings and Arrays. ๐
The npm package @igor.dvlpr/scramble receives a total of 1 weekly downloads. As such, @igor.dvlpr/scramble popularity was classified as not popular.
We found that @igor.dvlpr/scramble 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.