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 🙏

© 2026 – Pkg Stats / Ryan Hefner

zoi-mobileapp-library

v1.0.6

Published

This is a new [**React Native**] validations and generic functions.

Readme

Getting Started

This is a new [React Native] validations and generic functions.

Install

npm install --save zoi-mobileapp-library

Common Validations

1.Mobile Number Validation

  • The function mobileNumberValidation is a JavaScript function that validates a mobile number
  • Here handled Required message and Error message.
import {mobileNumberValidation} from "zoi-mobileapp-library";
let val = 9634567890;
var mobileVal = mobileNumberValidation(val);

✅ A valid mobile number should start with 5, 6, 7, 8, or 9.
✅ If the input is empty, it returns 'Required'.
✅ If the mobile number does not match the pattern, it returns 'Enter valid Mobile Number'.
✅ If the mobile number is valid, it returns an empty string, indicating no validation error.

console.log(mobileValidation("9634567890")); // Output: ''
console.log(mobileValidation("123-45-678")); // Output: 'Enter valid Mobile Number'
console.log(mobileValidation("")); // Output: 'Required'

2.Email Validation

  • The function emailValidation is a JavaScript function that validates a Email.
  • Here handled Required message and Error message.
import {emailValidation} from "zoi-mobileapp-library";
let val = "[email protected]";
var emailVal = emailValidation(val);

✅ If the input is empty, it returns 'Required'.
✅ If the email does not match the pattern, it returns 'Enter valid Email'.
✅ If the email is valid, it returns an empty string, indicating no validation error.

console.log(emailValidation("[email protected]")); // Output: ''
console.log(emailValidation("invalidEmail@")); // Output: 'Enter valid Email'
console.log(emailValidation("")); // Output: 'Required'

3.Pincode Validation

  • The function pinCodeValidation is a JavaScript function that validates a pincode.
  • Here handled Required message and Error message.
  • pinCodeValidation function is designed to validate a 6-digit numeric postal code (common in countries like India)
import {pinCodeValidation} from "zoi-mobileapp-library";
let val = "560001";
var pinCodeVal = pinCodeValidation(val);

✅ If the input is empty, it returns 'Required'.
✅ If the Pincode does not match the pattern, it returns 'Enter valid Pincode'.
✅ If the Pincode is valid, it returns an empty string, indicating no validation error.

console.log(pinCodeValidation("560001")); // Output: ''
console.log(pinCodeValidation("12345")); // Output: 'Enter valid Pincode'
console.log(pinCodeValidation("")); // Output: 'Required'

4.IFSC Validation

  • The function ifscValidation is a JavaScript function that validates a IFSC code.
  • Here handled Required message and Error message. ✅ First 4 characters → Alphabetic (A-Z) ✅ 5th character → Always 0 ✅ Last 6 characters → Alphanumeric (A-Z, 0-9) ✅ Alphabets only Capital letters are allowed.
import {ifscValidation} from "zoi-mobileapp-library";
let val = "SBIN0001234";
var ifcsCodeVal = ifscValidation(val);

✅ If the input is empty, it returns 'Required'.
✅ If the IFSC code does not match the pattern, it returns 'Enter valid IFSC';
✅ If the IFSC code is valid, it returns an empty string, indicating no validation error.

console.log(ifscValidation("SBIN0001234")); // Output: ''
console.log(ifscValidation("abcd012345")); // Output: 'Enter valid IFSC'
console.log(ifscValidation("")); // Output: 'Required'

5.Account Number Validation

  • The function accountNoValidation is a JavaScript function that validates a account number.
  • Here handled Required message and Error message. ✅ Must be numeric only ✅ Length should be between 9 and 18 digits ({9,18})
import {accountNoValidation} from "zoi-mobileapp-library";
let val = "123456789";
var accountNoVal = accountNoValidation(val);

✅ If the input is empty, it returns 'Required'.
✅ If the IFSC code does not match the pattern, it returns 'Enter valid Account Number';
✅ If the IFSC code is valid, it returns an empty string, indicating no validation error.

console.log(accountNoValidation("123456789")); // Output: ''
console.log(accountNoValidation("12345678")); // Output: 'Enter valid Account Number'
console.log(accountNoValidation("")); // Output: 'Required'

6.Confirm Account Number Validation

  • The function confirmAccountNoValidation is a JavaScript function that validates a account number.
  • Here handled Required message and Error message. ✅ Must be numeric only ✅ Length should be between 9 and 18 digits ({9,18}) ✅ The Account Number and Confirm Account Number must be the same
import {confirmAccountNoValidation} from "zoi-mobileapp-library";
let val = "123456789";
let account = "123456789"
var accountNoVal = confirmAccountNoValidation(val, account);

✅ If the input is empty, it returns 'Required'.
✅ If the Confirm account number does not match the Account number, it returns 'Account No and Confirm Account No does not match';
✅ If the Confirm account number is match with Account number, it returns an empty string, indicating no validation error.

console.log(accountNoValidation("123456789","123456789")); // Output: ''
console.log(accountNoValidation("12345678",'12345678923')); // Output: 'Account No and Confirm Account No does not match'
console.log(accountNoValidation("")); // Output: 'Required'

7.UPI Validation

  • The function upiValidation is a JavaScript function that validates a upi id.
  • Here handled Required message and Error message. ✅ Allowed characters before @ → Letters (a-z, A-Z), numbers (0-9), and special characters (._-). ✅ Domain after @ → Letters (a-z, A-Z), numbers (0-9), and dots (.).
import {upiValidation} from "zoi-mobileapp-library";
let val = "user123@upi";
var upiIdVal = upiValidation(val);

✅ If the input is empty, it returns 'Required'.
✅ If the UPI ID does not match the pattern, it returns 'Enter valid UPI ID';
✅ If the UPI ID is valid, it returns an empty string, indicating no validation error.

console.log(upiValidation("user123@upi")); // Output: ''
console.log(upiValidation("user@")); // Output: 'Enter valid UPI ID'
console.log(upiValidation("")); // Output: 'Required'

8.PAN Validation

  • The function panValidation is a JavaScript function that validates a PAN.
  • Here handled Required message and Error message. ✅ First 5 characters → Capital letters (A-Z) ✅ Next 4 characters → Numbers (0-9) ✅ Last character → Capital letter (A-Z) ✅ Total length → 10 characters
import {panValidation} from "zoi-mobileapp-library";
let val = "ABCDE1234F";
var upiIdVal = panValidation(val);

✅ If the input is empty, it returns 'Required'.
✅ If the PAN does not match the pattern, it returns 'Enter valid UPI ID';
✅ If the PAN is valid, it returns an empty string, indicating no validation error.

console.log(panValidation("ABCDE1234F")); // Output: ''
console.log(panValidation("abcde1234f")); // Output: 'Enter valid PAN'
console.log(panValidation("")); // Output: 'Required'

9.Aadhar Validation

  • The function aadharValidation is a JavaScript function that validates a PAN.
  • Here handled Required message and Error message.

✅ The function aadharValidation is designed to validate an Aadhaar number, ensuring it starts with a digit from 2-9 and has a length of up to 12 digits.

import {aadharValidation} from "zoi-mobileapp-library";
let val = "234567890123";
var upiIdVal = aadharValidation(val);

✅ If the input is empty, it returns 'Required'.
✅ If the Aadhar does not match the pattern, it returns 'Enter valid Aadhar Number';
✅ If the Aadhar is valid, it returns an empty string, indicating no validation error.

console.log(aadharValidation("234567890123")); // Output: ''
console.log(aadharValidation("123456789012")); // Output: 'Enter valid Aadhar Number'
console.log(aadharValidation("")); // Output: 'Required'

Generic Functions

1. IsNotEmpty

✅ Returns true if the value is not null, undefined, or an empty string (""). ✅ Returns false otherwise.

 import {isNotEmpty} from "zoi-mobileapp-library";

 if(isNotEmpty(val)){
    console.log(true);
 }
 else{
     console.log(false);
 }

2. IsNotEmpty without Object or withour array

  • undefined, null, empty and empty object is handled
  • This function don't use the Array or objects list, only use to the single text data only.

Example

✅ It returns false if val is an object (typeof val === "object")—even if the object is not empty ✅ It incorrectly excludes arrays, since typeof [] is "object".

 import {isNotEmptyObject} from "zoi-mobileapp-library";

 if(isNotEmptyObject(val)){
    console.log(true);
 }
 else{
     console.log(false);
 }

3. Capitalize First Letter

  • The function capitalizeFirstLetter takes a string as input and returns the string with the first letter capitalized while converting the rest of the string to lowercase. If the input is not a string, it returns an empty string
 import {capitalizeFirstLetter} from "zoi-mobileapp-library";

console.log(capitalizeFirstLetter("hello"));      // "Hello"
console.log(capitalizeFirstLetter("hELLo"));      // "Hello"
console.log(capitalizeFirstLetter("WORLD"));      // "World"
console.log(capitalizeFirstLetter("javaScript")); // "Javascript"
console.log(capitalizeFirstLetter(123));          // ""

4. Numbers only

  • The function numbersOnly checks if a given input contains only numeric characters (0-9).
  • It returns true if the input consists only of numbers or an empty string (""). Otherwise, it returns false.
 import {numbersOnly} from "zoi-mobileapp-library";

 var value = 1234;

 if(numbersOnly(value)){
    console.log(true);
 }
 else{
     console.log(false);
 }

 console.log(numbersOnly("12345"));     // true
 console.log(numbersOnly(67890));       // true (numbers are converted to string)
 console.log(numbersOnly("12a34"));     // false (contains a non-numeric character)

5. Decimal only

The function decimalOnly checks if the input is a valid decimal number with up to 8 decimal places. It ensures: ✅ At least one digit before the decimal point. ✅ At most 8 digits after the decimal point. ✅ No spaces or non-numeric characters (except .).

 import {decimalOnly} from "zoi-mobileapp-library";

var value = 123.456;

 if(decimalOnly(value)){
    console.log(true);
 }
 else{
     console.log(false);
 }

console.log(decimalOnly("123.456"));     // true  (valid decimal)
console.log(decimalOnly(45.6789));       // true  (valid decimal, auto-converted to string)
console.log(decimalOnly("100."));        // false (no digits after decimal)
console.log(decimalOnly(".5"));          // false (missing digit before decimal)

6. Alphanumeric

  • The function alphaNumeric checks if the input consists of only letters (a-z, A-Z), numbers (0-9), and spaces. It ensures:

✅ No special characters (like @, #, !, etc.). ✅ No leading spaces (but spaces are allowed inside).

 import {alphaNumeric} from "zoi-mobileapp-library";

var value = "Hello123";

 if(alphaNumeric(value)){
    console.log(true);
 }
 else{
     console.log(false);
 }

console.log(alphaNumeric("Hello123"));      // true  (valid alphanumeric)
console.log(alphaNumeric("Test 456"));      // true  (space allowed inside)
console.log(alphaNumeric("Hello World"));   // true  (space between words)
console.log(alphaNumeric("   Hello"));      // false (leading space)
console.log(alphaNumeric("Hello!"));        // false (special character `!`)

7. Alphabet only

  • The function alphabetOnly checks if the input consists of only letters (A-Z, a-z) and spaces while ensuring:

✅ The first character must be a letter. ✅ Spaces are allowed, but not at the start. ✅ No numbers or special characters.

 import {alphabetOnly} from "zoi-mobileapp-library";

var value = "Hello";

 if(alphabetOnly(value)){
    console.log(true);
 }
 else{
     console.log(false);
 }

console.log(alphabetOnly("Hello"));         // true  (valid alphabet-only)
console.log(alphabetOnly("Hello World"));   // true  (spaces allowed inside)
console.log(alphabetOnly("ABC123"));        // false (numbers not allowed)
console.log(alphabetOnly("Hello!"));        // false (special character `!` not allowed)

8. IFSC valid

  • The function ifscValidOnly is designed to validate IFSC (Indian Financial System Code) formats.
 import {ifscValidOnly} from "zoi-mobileapp-library";

var value = "HDFC0001234";

 if(ifscValidOnly(value)){
    console.log(true);
 }
 else{
     console.log(false);
 }

console.log(ifscValidOnly("HDFC0001234"));  // true  (valid IFSC)
console.log(ifscValidOnly("abcd0123456"));  // false (lowercase not allowed)
console.log(ifscValidOnly("HDFC000123"));   // false (only 5 characters after 0)

9. Email valid

  • emailValidOnly function to validate the email-ID
 import {emailValidOnly} from "zoi-mobileapp-library";

var value = "[email protected]";

 if(emailValidOnly(value)){
    console.log(true);
 }
 else{
     console.log(false);
 }

console.log(emailValidOnly("[email protected]"));     // true  (valid)
console.log(emailValidOnly("[email protected]"));  // true  (valid)
console.log(emailValidOnly("[email protected]"));    // false (double dots)
console.log(emailValidOnly("[email protected]"));       // false (TLD should be at least 2 chars)
console.log(emailValidOnly("[email protected]")); // false (TLD too long)

10. PAN valid

  • panValidOnly function is meant to validate PAN (Permanent Account Number) cards in India
 import {panValidOnly} from "zoi-mobileapp-library";

var value = "ABCDE1234F";

 if(panValidOnly(value)){
    console.log(true);
 }
 else{
     console.log(false);
 }

console.log(panValidOnly("ABCDE1234F"));  // true  (valid PAN)
console.log(panValidOnly("XYZPQ6789L"));  // true  (valid PAN)
console.log(panValidOnly("AB123CD456"));  // false (incorrect format)
console.log(panValidOnly("A12345678Z"));  // false (missing letters)

11. Aadhar valid

  • aadharValidOnly function attempts to validate Aadhar numbers (India's unique identity number)
 import {aadharValidOnly} from "zoi-mobileapp-library";

var value = "234567890123";

 if(aadharValidOnly(value)){
    console.log(true);
 }
 else{
     console.log(false);
 }

console.log(aadharValidOnly("234567890123"));  // true  (valid Aadhaar)
console.log(aadharValidOnly("123456789012"));  // false (cannot start with 1)
console.log(aadharValidOnly("012345678901"));  // false (cannot start with 0)
console.log(aadharValidOnly("9876543210"));    // false (only 10 digits, Aadhaar must be 12 digits)
console.log(aadharValidOnly("9876543210987")); // false (more than 12 digits)
console.log(aadharValidOnly("98765 432109"));  // false (space not allowed)

12.Number Sign - To find the color code of sign(+/-)

  • This function is useful for dynamically setting colors based on positive, negative, or zero values, such as for financial or statistical data visualization.
import React,{useState} from 'react';
import { View, Text } from 'react-native';
import {numberSign} from "zoi-mobileapp-library";

const NumberSign = (props) => {
    const [postiveValue, setPostiveValue] = useState(100);
    const [negativeValue, setNegativeValue] = useState(-50);
    return (
        <View> 
            
            <Text style={{
                color:numberSign(value)
            }}>
                {value}   // Here value showing with Green color
            </Text>

            <Text style={{
                color:numberSign(value, '#111111')
            }}>
                {value}  // Here value showing with black color
            </Text>

             <Text style={{
                color:numberSign(negativeValue)
            }}>
                {negativeValue} // Here value showing with Red color
            </Text>
        </View>
    )
}  

export default NumberSign;

// Note
✅ If you are send the value only, it will return  negative or positive  value with color.
✅ If you are send the value and color, it will return  negative or positive  value with your color.


// Example values
const positiveValue = 10;
const negativeValue = -5;
const zeroValue = 0;

// Custom colors
const mainColor = "#2D9E64";  // Green
const errorColor = "#E20001"; // Red
const zeroValueColor = "#111111"; // Black

console.log(numberSign(positiveValue, mainColor, errorColor, zeroValueColor)); // Output: "#2D9E64" (Green) - Text showing Green color
console.log(numberSign(negativeValue, mainColor, errorColor, zeroValueColor)); // Output: "#E20001" (Red) - Text showing Red color
console.log(numberSign(zeroValue, mainColor, errorColor, zeroValueColor));     // Output: "#111111" (Black) - - Text showing Black color

// Example with default colors (assuming Colors.green, Colors.red, Colors.black exist)
console.log(numberSign(20));   // Output: green color with value
console.log(numberSign(-10));  // Output: red color with value
console.log(numberSign(0));    // Output: black color with value

13.IndianRupee Format

  • Here's an example of how you can use the toIndianRupee function to format numbers in the Indian currency format.
 import {toIndianRupee } from "zoi-mobileapp-library";

console.log(toIndianRupee(1000));       // Output: "1,000"
console.log(toIndianRupee(100000));     // Output: "1,00,000"
console.log(toIndianRupee(12345678.90)); // Output: "1,23,45,678.90"
console.log(toIndianRupee(500));        // Output: "500"
console.log(toIndianRupee(null));       // Output: undefined (or no output)
console.log(toIndianRupee(""));         // Output: undefined (or no output)

14.Money Formatter

  • Here's an example of how you can use the moneyFormatter function to format large numbers into commonly used financial abbreviations (K, L, Cr in the Indian numbering system).
 import {moneyFormatter} from "zoi-mobileapp-library";

console.log(moneyFormatter(500));         // Output: "500"
console.log(moneyFormatter(1500));        // Output: "1.5K"
console.log(moneyFormatter(25000));       // Output: "25K"
console.log(moneyFormatter(7500000));     // Output: "75L"
console.log(moneyFormatter(10000000));    // Output: "1Cr"

15.Pascal case

  • Here's an example of how you can use the pascalCase function to format camelCase and snake_case strings into a more readable format ✅ Its used for input key is change from "customerName" to "Customer Name" like this..
 import {pascalCase} from "zoi-mobileapp-library";

console.log(pascalCase("firstName"));       // Output: "First Name"
console.log(pascalCase("last_name"));       // Output: "Last Name"
console.log(pascalCase("userEmailAddress"));// Output: "User Email Address"
console.log(pascalCase("order_id"));        // Output: "Order Id"