Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

lineder

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

lineder

Finds and returns information on each line of the file that matches a regular expression,

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

Lineder Build Status

Finds and returns information on each line of the file that matches a regular expression.

Features

Lineder finds and returns information on each line of the file that matches your search.

  • Search with regular expressions.
  • Get the line number(s) that the matched result was found on.
  • Get the entire line(s) that the matched result was found in.

Getting Started

  • Install with NPM - npm install --save lineder

Usage

var lineder = require( "lineder" );

/* file.txt
   1. this is the text for line one.
   2. this is the text for line two.
   3. this is the text for line three.
*/

lineder( "file.txt", "line two", function( err, results ) {
  //=> [ { line: 2, value "this is the text for line two." } ]
});

API

lineder( path )

NameTypeArgumentDescription
pathstring<required>the path of the file to be searched.

lineder.find( regex, callback )

NameTypeArgumentDescription
regex`stringregex`<required>
callbackfunction<required>callback that returns the results of the search

callback( error, results )

NameTypeArgumentDescription
errorerror<required>any errors that may have occured.
resultsarray<required>an array of objects containg the line number and values from the results of the search.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

License

Copyright (c) 2015 Jason Bellamy
Licensed under the MIT license.

Keywords

line

FAQs

Package last updated on 07 Jan 2015

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