Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

split-lines

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

split-lines

Split lines into an array of lines

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
135K
increased by17.21%
Maintainers
1
Weekly downloads
 
Created

What is split-lines?

The split-lines npm package is a simple utility for splitting a string into an array of lines. It handles different newline characters and can optionally keep the newline characters in the resulting array.

What are split-lines's main functionalities?

Basic Line Splitting

This feature allows you to split a string into an array of lines based on newline characters. It handles different types of newline characters such as \n, \r\n, and \r.

const splitLines = require('split-lines');
const text = 'Hello\nWorld';
const lines = splitLines(text);
console.log(lines); // ['Hello', 'World']

Keep Newline Characters

This feature allows you to split a string into an array of lines while keeping the newline characters in the resulting array. This can be useful if you need to preserve the original formatting.

const splitLines = require('split-lines');
const text = 'Hello\nWorld';
const lines = splitLines(text, { keepNewlines: true });
console.log(lines); // ['Hello\n', 'World']

Other packages similar to split-lines

Keywords

FAQs

Package last updated on 28 Jun 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc