🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

detect-newline-at-eof

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-newline-at-eof

Detect newline at end of file

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

detect-newline-at-eof

Node.js package Linux Build Status Windows Build Status

Detect newline at end of file

detect-newline-at-eof is similar to trailing-newline but will also match \n on Windows and \r\n on macOS.

Installation

$ npm install detect-newline-at-eof

Usage

const fs = require('fs')
const detectNewlineAtEof = require('detect-newline-at-eof')

const fileContents = fs.readFileSync('file.txt', 'utf8')
const newlineCharacter = detectNewlineAtEof(fileContents)

console.log(newlineCharacter)
// => \n, \r\n, or null if no newline character at the end was found

Changelog

This project follows Semantic Versioning 2.

  • v1.0.0 (2018-07-20):
    • Add support for Node.js v6, v8, and v10
    • Drop support for Node.js versions older than v6
    • Drop support for io.js
  • v0.1.0 (2015-07-18): Initial release.

Keywords

detect

FAQs

Package last updated on 20 Jul 2018

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