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

esleon

v0.0.1

Published

esleon是leon化的es6包

Readme

esleon

esleon是一个Leon化的ES6语法的实现包。

仅供学习使用,无法用于生产

特性

Promise => Promiseon

Promiseon是一个实现了Promise/A+规范的类。支持Promise的异步微任务、链式调用、resolve、reject、all等功能。

new Promiseon((resolve) => {
  resolve(1);
})
  .then((value) => {
    console.log("获取结果", value);
    return Promiseon.resolve(2);
  })
  .finally(() => {
    console.log("结束");
  });

async/await => asynceon

asynceon实现了类似于async/await的效果。不过由于没有语法层面的await,所以改为了yield。使用asynceon包装函数,和ES6使用async修饰函数一样。函数体内部异步转同步,最终返回的是一个Promiseon。

// ES6的async语法
const asyncFunction = async (base: number) => {
  const a = await asyncGetA();
  const b = await asyncGetB();
  return base + a + b;
}
// asynceon语法
const asynceonFunction = asynceon(function* (base: number) {
  const a = yield asyncGetA();
  const b = yield asyncGetB();
  return base + a + b;
});

Class => Classeon

ES6的Class也是需要语法支持的,比如classsupernewextendsstatic这些关键字。我们自己去实现的话,只能通过函数去处理。

最终实现的功能有new对象实例静态方法调父类构造函数成员方法和静态方法继承等。

// ES6的class语法
class Person {
  name: string;

  constructor(name: string) {
    this.name = name;
  }

  greet() {
    return `Hello, my name is ${this.name}`;
  }

  static run() {
    return "run";
  }
}

class SuperMan extends Person {
  power: string;

  constructor(name: string, power: string) {
    super(name);
    this.power = power;
  }

  shoot() {
    return `I can shoot ${this.power}`;
  }

  static fly() {
    return "fly";
  }
}

// defClasseon/newClasseon语法
const PersonClasseon = defClasseon(
  function (name: string) {
    this.name = name;
  },
  null,
  {
    greet() {
      return `Hello, my name is ${this.name}`;
    },
  },
  {
    run() {
      return "run";
    },
  }
);

const SuperManClasseon = defClasseon(
  function (name: string, power: string) {
    this.super(name);
    this.power = power;
  },
  PersonClasseon,
  {
    shoot() {
      return `I can shoot ${this.power}`;
    },
  },
  {
    fly() {
      return "fly";
    },
  }
);

文档和仓库

源码地址:https://github.com/missmess/leon-build-wheel/tree/main/packages/reacteon