Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
The eol npm package is designed to handle end-of-line (EOL) characters in strings, making it easier to manage cross-platform newline characters in a consistent manner. It provides utilities to convert, detect, and remove line endings.
Convert to specific EOL type
Converts all end-of-line characters in a string to Unix line endings (LF). Useful for ensuring consistent EOL characters in a multi-platform development environment.
const eol = require('eol');
let unixText = eol.lf('Hello\r\nWorld'); // Converts to LF (\n) line endings
Auto-detect and normalize EOL
Automatically detects and normalizes the end-of-line characters in a string to the system's default EOL setting. This is particularly useful for handling text input from various sources with differing EOL conventions.
const eol = require('eol');
let normalizedText = eol.auto('Hello\r\nWorld'); // Normalizes to the default system EOL
Remove all EOL characters
Strips all end-of-line characters from a string, which can be useful for creating single-line strings from multiline input.
const eol = require('eol');
let cleanText = eol.strip('Hello\r\nWorld'); // Removes all EOL characters
Similar to the 'strip' functionality of eol, newline-remove provides a method to remove all newline characters from a string. It does not, however, offer conversion between different types of EOL characters.
This package offers conversion between LF and CRLF line endings, similar to eol's conversion features. However, crlf-helper focuses specifically on these two types of line endings and does not include automatic detection or normalization to the system's default EOL.
Newline character converter node module for JavaScript or TypeScript
npm install eol
let eol = require("eol")
import eol from "eol"
\r\n
or \n
\r\n
\n
\r
eol.auto
linebreakeol.lf(eol.before(text))
⋮eol.auto
linebreakeol.lf(eol.after(text))
⋮Coercing normalizers to string yields the appropriate character...useful glue for joining
String(eol.lf) // "\n"
eol.split(text).join(eol.auto) // === eol.auto(text)
eol.split(text).filter(line => line).join(eol.auto) // text joined after removing empty lines
eol.split(text).slice(-3).join(eol.auto) // last 3 lines joined
Detect or inspect via match
eol.match(" ") // []
eol.match("world\nwide\nweb") // ["\n","\n"]
Generate alternate normalizers
let extra = eol.dub("\n\n\n")
extra("...")
let huh = eol.dub("???")
huh("...")
let eol = require("eol")
let edit = require("edit-file")
edit("sample.txt", eol.lf)
let eol = require("eol")
let map = require("map-file")
map({
from: "from.txt",
to: "to.txt",
map: eol.lf
})
let ssv = require("ssv")
let eol = require("eol")
let deep = eol.split("spaced.txt").map(ssv.split)
Have an eol
sample to share?
Then please do :test_tube: :test_tube: :test_tube: :test_tube:
FAQs
Newline character converter
The npm package eol receives a total of 1,188,386 weekly downloads. As such, eol popularity was classified as popular.
We found that eol 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.