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

esy-language

v1.3.6

Published

Esy is a new JS preprocessor allows you to use custom block structures.

Downloads

22

Readme

Esy

NPM

CircleCI npm version downloads dependencies license Join the chat at https://gitter.im/Slye-team/esy-language

Esy Logo

Esy is a new JS preprocessor allows you to use custom block structures.

What does it mean?

Right now in JavaScript and many other languages that support the block structure, you're only able to use some predefined structures like:

  1. if (){...}
  2. for (){...}
  3. while (){...}
  4. do {...} while();
  5. switch (){...}
  6. else {...}
  7. try {...}
  8. catch (){...}
  9. finally (){...}
  10. etc...

Those are all familiar structures to you, but have you ever thought about the following structure?

timeout 200 {
   console.log("Hello World!");
}

Certainly, it's easier than what we have in JS right now:

setTimeout(function() {
   console.log("Hello World!");
}, 200);

Or even with arrow functions:

 setTimeout(() => {
    console.log("Hello World!");
 }, 200);

That why Esy comes from Easy

Install

You can install this package globally by running:

npm install esy-language -g

but if you're interested in the core API and wants to use it in your own package just run:

npm install esy-language --save

Example

After installing the Esy, save this file as ex.esy

// Cache sum for 500ms
cache 500 sum(a,b){
	console.log('Computing...');
	return a+b;
} key (c,d){
	// We don't care about numbers order in sum function (a+b=b+a)
	return [c, d].sort();
}

// Compute 5+7 once
console.log(sum(5,7))

// Load theme from cache without computing
console.log(sum(5,7))
console.log(sum(7,5))

// Wait 100ms more than cache's lifetime.
timeout 600{
	// It should compute 5+7 again
	console.log(sum(7,5))
}

and then cd to the directory that your file is and run this command to run program:

esy ex.esy

for saving result to a file run:

esy compile ex.esy -s

Docs

Read official docs for more details.

Testing

To run tests just run:

git clone https://github.com/Slye-team/esy-language.git
cd esy-language
npm run test