npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fjl-input-filter

v1.2.9

Published

[![Build Status](https://travis-ci.org/functional-jslib/fjl-input-filter.png)](https://travis-ci.org/functional-jslib/fjl-input-filter) [![GitHub version](https://badge.fury.io/gh/functional-jslib%2Ffjl-input-filter.svg)](http://badge.fury.io/gh/function

Downloads

21

Readme

Build Status GitHub version NPM version Dependencies

fjl-input-filter

Input filter validation functions - These allows you to create input and input-filter objects that can be used (by included utility functions) to easily validate a body of input fields quickly and easily (see usage examples further below).

Sections in Readme:

Basic idea:

  • Validators - Functions that validate a given input and return a validation result.
  • Filters - Functions that take a value and give you a 'possibly' transformed value.
  • Inputs - Objects that contain rules used for validation (breakOnFailure, a list of validators, a list of filters etc.)
  • InputFilters - Collection of input objects that can be validated together as a whole. (see usage example(s) below):

Requirements:

  • Javascript Ecmascript 5+.

Supported Platforms:

Browsers

  • IE9+, and all other modern day browsers.

NodeJs

  • 8+

Getting Started:

In NodeJs:

Using es2015 modules:

import {...} from 'fjl-input-filter';

Using CommonJs modules:

const {...} = require('fjl-input-filter');

In Browser:

See desired export type below:

  • './dist/amd/' - Asynchronous module format.
  • './dist/cjs/' - CommonJs module format.
  • './dist/umd/' - Universal module definition format.
  • './dist/iife/' - Immediately Invoked Function Execution - (exports fjlInputFilter as a global).
  • './dist/es6-module/' - Ecmascript 6 module format.

Docs

JSDocs are here (https://functional-jslib.github.io/fjl-input-filter/) [https://functional-jslib.github.io/fjl-input-filter/].

Docs in readme aren't fully fleshed out yet (see jsdocs, usage examples, and/or tests instead).

Input methods

noValidationRequired, validateInput, validateIOInput, runValidators,
runIOValidators, runFilters, runIOFilters, toInput,
toInputValidationResult, Input

InputFilter methods

validateInputFilter, validateIOInputFilter, validateIOInputWithName,
toInputFilter, toInputFilterResult, InputFilter

In-line summary docs follow:

Api:

validateInputFilter(inputFilter, incomingData)

validateIOInputFilter(inputFilter, incomingData, ioErrorHandler)

validateInput(inputObj, value)

validateIOInput(inputObj, value, ioErrorHandler)

toInputFilter(inputsObj, breakOnFailure {Boolean}, out = {})

toInputFilterResult(resultObj, out = {})

toInputValidationResult(resultObj)

toInput(inputOptions, out = {})

Constructors

Input(options)

Methods

  • validate(data) : InputValidationResult
  • validateIO(data) : Promise.<InputValidationResult>

InputFilter(inputsObj, breakOnFailure {Boolean})

Methods

  • validate(data) : InputFilterResult
  • validateIO(data) : Promise.<InputFilterResult>

Virtual Types

InputValidationResult

InputFilterResult

External Virtual Types

See: fjl-validator repo/module

ValidationResult

ValidatorOptions

Development:

  • For commands see './package.json' scripts.

Dir structure

  • Everything is in './src'.
  • Distribution is in './dist'.
  • Docs are in './docs'.

Testing

Using jest (see './package.json' scripts).

License:

BSD 3 Clause - Included in sources.

Resources:

  • Zend/InputFilter: https://docs.zendframework.com/zend-inputfilter/intro/
  • fjl-validator: https://github.com/functional-jslib/fjl-validator
  • fjl-filter (WIP): https://github.com/functional-jslib/fjl-filter

Change log

1.2.5

  • Dependencies and dev-dependencies updated to latest.
  • Tests updated to reflect updated dev-dependencies (jest complained about nested 'describe' blocks and nested 'test' blocks (primarily issue had to do with async and non-async tests)).

0.18.0

Breaking changes

  • Removed uncurried methods (methods ending with $) (use curried methods instead). Removed:

  • errorIfNotTypeOnTarget$ - ('fjl' provides this now)

  • errorIfNotTypeOnTarget - ("")

  • defineEnumProps$

  • defineProps$

  • Renamed auxillary methods:

    • _descriptorForSettable becomes createTypedDescriptor.
    • _makeDescriptorEnumerable becomes toEnumerableDescriptor.
    • _targetDescriptorTuple becomes toTargetDescriptorTuple.

Other changes:

  • Normalized API (removed un-curried methods from exports and non-api specific (un-required) methods).
  • Updated build process (using babel7 now).
  • Replaced mocha and chai with jest.
  • Changed license from "MIT" to "BSD3".
  • Version and build tag links to top of readme file.
  • Et. al.