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

filt

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filt

filt is for simple filters: node -e 'require("filt")(line => line.toUpperCase())'

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

node filt

filt is for simple filters:

node -e 'require("filt")(line => line.toUpperCase())'

This module allows you to quickly write command-line filters - programs that read standard input line by line and print something on standard output.

Known problems

It prints an extra newline at the end - the split module used internally is apparently running the callback with an extra empty line at the end when there is none - I need to fix it.

Installation

Install to use in your project, updating the dependencies in package.json:

npm install filt --save

It currently has one dependency: split ...

Usage

Require the module:

var filt = require('filt');

Now filt is a function that gets a function that is called for each line of stdin.

Most basic usage:

filt(function (line) {
    console.log(line.toUpperCase());
});

Instead of calling console.log() you can also return a line to print:

filt(function (line) {
    return line.toUpperCase();
});

The same using ES6 syntax:

filt(line => line.toUpperCase());

Using require in the same line - this is the entire program:

require('filt')(line => line.toUpperCase());

Or straight from the command line:

node -e 'require("filt")(line => line.toUpperCase());'

Issues

For any bug reports or feature requests please post an issue on GitHub.

Author

Rafał Pocztarski - https://github.com/rsp

License

MIT License (Expat). See LICENSE.md for details.

Keywords

FAQs

Package last updated on 02 Mar 2016

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