JSPM

readablefn

0.0.9
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q29586F
  • License MIT

Helpful and useful javascript functions

Package Exports

  • readablefn
  • readablefn/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (readablefn) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

readablefn

Publish Package

A lightweight library that provides simple validation and conversion JavaScript functions to make your code more intuitive and readable.

Installation Guide

npm install readablefn - adds the library to your project.

Feel free to import the modules you need using import or require.

Usage Example

import { isNotNull } from 'readablefn/base';
import { Numbers } from 'readablefn';

const value = 5;

if (isNotNull(value)&& Numbers.isNumber(value) && Numbers.inRange(value, { start: 1, end: 10 })) {
  console.log('Value is a valid number in range!');
}

API Reference

Base

Function Description Example
isNull Checks if value is null or undefined isNull(null) -> true
isNull(1) -> false
isNotNull Checks if value is not null or undefined isNotNull(1) -> true
isNotNull(null) -> false
isUndefined Checks if value is undefined isUndefined(undefined) -> true
isUndefined(0) -> false
isNotUndefined Checks if value is not undefined isNotUndefined(1) -> true
isNotUndefined(undefined) -> false

Strings

Function Description Example
isString Checks if value is a string isString('abc') -> true
isString(123) -> false
isEmpty Checks if value is empty ('', null, undefined) isEmpty('') -> true
isEmpty('abc') -> false
isNotEmpty Checks if value is not empty isNotEmpty('abc') -> true
isNotEmpty('') -> false

Numbers

Function Description Example
isNumber Checks if value is a number (not NaN, not Infinity) isNumber(5) -> true
isNumber('5') -> false
isNotNumber Checks if value is not a number isNotNumber('abc') -> true
isNotNumber(5) -> false
inRange Checks if number is in the given range inRange(5, {start: 1, end: 10}) -> true
inRange(0, {start: 1, end: 10}) -> false

Contributing

You are welcome to contribute to this library.

Prerequisites

  • Node.js with NPM

Setup Guide

  • npm ci - install dependencies
  • npm test - run build and tests

NOTE: Please submit your PRs to the develop branch.