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

@edcartech/js-utils-pro

v1.0.12

Published

JavaScript Utilities For Programmers

Downloads

19

Readme

@edcartech/js-utils-pro

npm (scoped) npm bundle size (minified)

JavaScript Utilities For Programmers

Install

$ npm install @edcartech/js-utils-pro

Usage

1. Closing All spaces in a string

//Cloding the Space of a string
const closeStringSpace = require('@edcartech/js-utils-pro');

closeStringSpace('So much space!');
//=> "Somuchspace!"

closeStringSpace(1337);
//=> Uncaught TypeError: closeStringSpace wants a string!
//    at closeStringSpace (<anonymous>:2:41)
//    at <anonymous>:1:1

2. Check if a String is a valid Email ( Email Validation)

//Import validation Function from js-utils-pro
const validateEmail = require('@edcartech/js-utils-pro');

//Example 1
validateEmail('[email protected]') === true
  ? "Wooow it's an Email"
  : "Awwww it's an Invalid Email";
//=> "Wooow it's an Email"

//Example 2
const Validate = validateEmail('example2@gmailcom');
if (Validate === true) {
  console.log("Wooow it's an Email");
} else {
  console.log("Awwww it's an Invalid Email");
}
//=> "Awwww it's an Invalid Email"

3. Select One record from an Array object in JSON Format of Object[{...}]

//Consider a JSON array object of an unordered collection of records. 
//Note --->The conditions here are that only of the object element is labeled "id" 
// and the object should be in form of ie object[{}] (An Array Object)
let data = [
    {
        id:1,
        name:"Edorh Carlos",
        email:"[email protected]",
        school:"UEW"
    },
    {
        id:2,
        name:"Doris Apasu",
        email:"[email protected]",
        school:"CCT"
    },
    {
        id:3,
        name:"Hoegah",
        email:"[email protected]",
        school:"A.Polly"
    },
    {
        id:4,
        name:"Edorh Ottis",
        email:"[email protected]",
        school:"ULM"
    },
]

//Our required function to pull the unique one record
const selectOneByIdFromArrayObject = require('@edcartech/js-utils-pro');

//Querying the object element
selectOneByIdFromArrayObject(data,4,"email");
//=> [email protected]
//=This return [email protected] because it bears the id=4 in the object
// data is the name of the JSON object created above
// 4 Represents the id number of the object we need
// email is the field we need the value/record from

4. Check if a Field Value exist in an Array JSON object in Format Object[{...}]

//Consider a JSON array objectData of an unordered collection of records. 
//Note --->The object field/attribute value must be a unique field
//object type object[{}] (An Array Object)
let objectData = [
    {
        id:1,
        name:"Edorh Carlos",
        email:"[email protected]",
        school:"UEW"
    },
    {
        id:2,
        name:"Doris Apasu",
        email:"[email protected]",
        school:"CCT"
    },
    {
        id:3,
        name:"Hoegah",
        email:"[email protected]",
        school:"A.Polly"
    },
    {
        id:4,
        name:"Edorh Ottis",
        email:"[email protected]",
        school:"ULM"
    },
]

//Our required function to check input value
const checkIfExist = require('@edcartech/js-utils-pro');

//Checking the object element
checkIfExist(objectData,"email","[email protected]");
//=> False
//=>This return False because there is no match for [email protected] on email field/property objectData 
// objectData is the name of the JSON object created above
// email represent the field/property of the the object
// [email protected] is the value we are checking for
checkIfExist(objectData,"email","[email protected]");
//=> True
//Returns True because the [email protected] exist on field email in objectData