Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 3b2d36f551
Fetching contributors…

Cannot retrieve contributors at this time

executable file 41 lines (32 sloc) 1.274 kb
usage = '''
This module is a simple wrapper for node-validator
Available filters are: int, url, ip, alpha, alphanumeric, email
1. To filter out lines that do not match a filter:
$ validate [FILTER] < list.txt
2. To filter out lines that match a filter:
$ validate not [FILTER] < list.txt
nodeio = require ''
class Validate extends nodeio.JobClass
init: ->
if @options.args.length is 0 or @options.args[0] is 'help'
@status usage
run: (line) ->
invert = @options.args[0] is 'not'
filter = if invert then @options.args[1] else @options.args[0]
switch filter
when 'url' then @assert(line).isUrl()
when 'email' then @assert(line).isEmail()
when 'int' then @assert(line).isInt()
when 'ip' then @assert(line).isIp()
when 'alpha' then @assert(line).isAlpha()
when 'alphanumeric' then @assert(line).isAlphanumeric()
@status usage
if invert then @skip() else @emit line
catch error
if invert then @emit line else @skip()
@job = new Validate()
Jump to Line
Something went wrong with that request. Please try again.