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

jsy

v0.0.24

Published

A lightweight JavaScript Library contains the missing javascript functions, and make your code readable.

Downloads

6

Readme

Jsy make Javascript coding more fun

There is a difference between readble code and non readble, it's easly to read and memory, Jsy make your code clean and readble.

Exemple :

Without jsy

var email= "[email protected]"; 
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if(re.test(email)){
 console.log('valid email');
}

With jsy

var email= "[email protected]"; 
if(_jsy(email).isEmail()){
  console.log('valid email');
}

Even more :

var email= "[email protected]";   
_jsy(email).ifisEmail().log('valid email');

##Documentation

Determine the internal variable class.

.getType()
//exemple : alert the type of name
var name = "aymen";
alert(_jsy(name).getType());

Determine the internal variable class.

.ifType()
//example : alert name if the type is equal to 'string'
var name = "jhon";
_jsy(name).ifType('string').alert();

check if the internal varible is Array

.isArray()
//example : alert true if numbers is Array
var numbers = [1,2,3,4];
alert(_jsy(numbers).isArray());

check if x in the internal variable (Array)

.inArray(x)
//example : alert true if the number 3 is in the Array
var numbers = [1,2,3,4];
alert(_jsy(numbers).inArray(3));

return true if the internal variable is empty

.isEmpty()
//example : alert true if the variable emptyobject is empty
var emptyobject= {};
alert(_jsy(emptyobject).isEmpty());

run function if the internal variable is empty

.ifisEmpty()
//example : alert 'object is empty' if the variable emptyobject is empty
var emptyobject= {};
_jsy(emptyobject).ifisEmpty().alert('object is empty');

return true if the internal variable is float

.isFloat()
//example: alert true if x is float
var x = 9.3 ;
alert(_jsy(x).isFloat());

run function if the internal variable is float

.ifisFloat()
//example: log to console '9.3 is float' if x is float
var x = 9.3 ;
_jsy(x).ifisFloat().log(x+ ' is float');

check if x equal to the internal variable

.equal(x)
//example: return true if the animals varibale equal to ['puppy', 'cow', 'cat']
var animals = ['puppy', 'cow', 'cat'];
alert(_jsy(animals ).equal(['puppy', 'cow', 'cat']));

run function if x equal to the internal variable

.ifEqual(x)
//example: console to log "9 is equal to 9" if the randomumber is equal to 9
var randomumber = 9 ;
_jsy(randomumber).ifEqual(9).then(function(){
	console.log(randomumber +' is equal to 9');
});

return true if the internal variable has rows

.hasRows()
//example: return true if the animals varibale has rows
var animals = ['puppy', 'cow', 'cat'];
alert(_jsy(animals ).hasRows());

return true if the length of the internal variable between min and max

.lengthBetween(min, max)
//example : alert true if the length of the string between 5 and 9
var lastname = "labidi";
alert(_jsy(lastname).lengthBetween(5,9));

run function if the length of the internal variable between min and max

.ifLengthBetween(min, max)
//example : alert true if the length of the string between 5 and 9
var lastname = "labidi";
_jsy(lastname).ifLengthBetween(5,9).alert("true");

return true if the internal variable is email

.isEmail()
//example : alert true if the variable input is an email
var input = "[email protected]";
alert(_jsy(input ).isEmail());

run function if the internal variable is an email

.ifisEmail()
//example : alert true if the variable input is an email

var input = "[email protected]";
_jsy(input).ifisEmail().alert("true");

return true if the internal variable is integer

.isInt()
//example: alert true if x is float
var x = 7 ;
alert(_jsy(x).isInt());

run function if the internal variable is float

.ifisInt()
//example: log to console '7 is integer' if x is integer
var x = 7;
_jsy(x).ifisInt().log(x+ ' is integer');

return true if the internal variable is negative

.isNegative()
//example: alert true if x is negative
var x = -3 ;
alert(_jsy(x).isNegative());

run function if the internal variable is negative

.ifisNegative()
//example: alert -3 if x is negative
var x = -3 ;
_jsy(x).ifisNegative().alert();

return true if the internal variable is negative

.isPositive()
//example: alert true if x is positive
var x = 3 ;
alert(_jsy(x).isPositive());

run function if the internal variable is positive

.ifisPositive()
//example: alert 8 if x is positive
var x = 8 ;
_jsy(x).ifisPositive().alert();

alert the internal variable or the argument if the internal condition is true or not defined

.alert()
//example: 
//alert 8
var x = 8 ;
_jsy(x).alert();
//alert equal if x is equal to 8
_jsy(x).ifEqual(8).alert('equal');
//alert 8 if x is equak to 8
_jsy(x).ifEqual(8).alert();

log to console the internal variable or the argument if the internal condition is true or not defined

.log()
//example: 
//log to console "jhon"
var name = "jhon" ;
_jsy(name ).log();
//log to console equal if name is equal to "jhon"
_jsy(name).ifEqual("jhon").log('equal');
//log to console "jhon" if name is equak to "jhon"
_jsy(name).ifEqual("jhon").log();

run function if the internal condition is true

.then(func)
//example: console to log true if the randomumber is equal to 9
var randomumber = 9 ;
_jsy(randomumber).ifEqual(9).then(function(){
	console.log(randomumber +' is equal to 9');
});

run function if the internal condition is true

.else(func)
//example: console to log "9 is not equal to -1" if the randomumber is not equal to nextnumber 
var randomumber = 9 ;
var nextnumber = -1 ; 
_jsy(randomumber).ifEqual(nextnumber).then(function(){
	console.log(randomumber +' is equal to '+nextnumber);
}).else(function(){
	console.log(randomumber +' is not equal to '+nextnumber);
});

like finally, run a function when all the treatments ended

.end(func)
//example: console to log "9 is equal to 9" if the randomumber is equal to 9, console "end"
var randomumber = 9 ;
_jsy(randomumber).ifEqual(9).then(function(){
	console.log(randomumber +' is equal to 9');
}).end(function(){
	console.log("end")
});