New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@particle/detect-newline-style

Package Overview
Dependencies
Maintainers
29
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@particle/detect-newline-style

Determine a string's preferred newline character

  • 3.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-94.12%
Maintainers
29
Weekly downloads
 
Created
Source

@particle/detect-newline-style

Determine a string's preferred newline character

Installation

npm install @particle/detect-newline-style --save

API

@particle/detect-newline-style


module.exports(input, [options]) ⇒ string

Figure out which newline style a given string uses (windows: \r\n or unix: \n)

Kind: Exported function
Returns: string - Either \r\n or \n based on string contents

ParamTypeDefaultDescription
inputstringThe string you want to analyze
[options]object
[options.defaultEOL]string"'\n'"Default newline character

Example

const newline = detectNewlineStyle('foo\nbar\r\n\baz\n');
console.log(newline); // '\n'

NOTE: Unfortunately, docs have a nasty habit of falling out of date. When in doubt, check usage in tests

FAQs

Package last updated on 12 Aug 2022

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