Skip to content

Latest commit

 

History

History
135 lines (99 loc) · 5.16 KB

README-EN.md

File metadata and controls

135 lines (99 loc) · 5.16 KB

Table of Contents

  1. Introduction
  2. Features
  3. Installation
  4. Usage
  5. Contribution
  6. License
  7. Acknowledge
  8. Donate
  9. Changelog

Introduction

Split Lines is a JavaScript extension that splits strings into arrays by line, with the option to include or remove line break characters. It is as similar as possible to splitlines() in Python.

Features

Split Lines offers the following features:

  • Splits strings into arrays based on line breaks.
  • There is an option to include or omit line breaks in the results.
  • Can be integrated into TypeScript code.

Installation

To install Split Lines locally, follow these installation steps:

npm install @barudakrosul/split-lines

Usage

To start using Split Lines, import the module first:

1. CommonJS

require("@barudakrosul/split-lines");

2. ESM (ECMAScript Modules)

import "@barudakrosul/split-lines";

3. TypeScript

import "@barudakrosul/split-lines";

Example of usage:

let text = "List fruit names:\nApple\nBanana\nAvocado\nPapaya\nBlueBerry\netc.";
console.log(text.splitLines());

// Result:
// [
//   'List fruit names:',
//   'Apple',
//   'Banana',
//   'Avocado',
//   'Papaya',
//   'BlueBerry',
//   'etc.'
// ]

Example if the keeplinebreaks option is set to true:

let text = "List fruit names:\nApple\nBanana\nAvocado\nPapaya\nBlueBerry\netc.";
console.log(text.splitLines(true));

// Result:
// [
//   'List fruit names:\n',
//   'Apple\n',
//   'Banana\n',
//   'Avocado\n',
//   'Papaya\n',
//   'BlueBerry\n',
//   'etc.'
// ]

Contribution

Contributions to Split Lines are greatly appreciated! Whether reporting bugs, suggesting new features, or contributing to code improvements.

License

Split Lines is licensed under the Apache-2.0 License - see the LICENSE file for details.

Acknowledge

Split Lines appreciates the support and contributions of the following individuals and open source projects:

  • @FajarKim - Lead developer and creator of the application.
  • Open source community - For valuable contributions to the tools and libraries used in this project.

Donate

We really appreciate your support to continue developing this project. If you find this project useful, you can support us with a donation:

Ko-fi Trakteer

Every donation, no matter the amount, means a lot to us. Thank you for your support! ❤️

Changelog

Keep up with the latest changes and updates of Split Lines by referring to Changelog.

Thank you for choosing Split Lines! We aim to provide an easy solution to convert strings into arrays based on line breaks.

Stand with Palestine