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

especially

v2.0.1

Published

Abstract operations and other functions drawn from the ECMAScript specification

Downloads

637

Readme

ECMAScript Spec Operations, in ECMAScript

Have you ever wanted to write a to-the-letter implementation of some ECMAScript spec function? Maybe you want to run tests against it; maybe you're just crazy and like self-hosting JavaScript in JavaScript. In either case, this is the package for you!

Especially has a small-but-growing collection of meta-textual and abstract operations drawn directly from the pages of the ECMAScript 2015 draft specification. From common things like Get to dealing with internal slots, Especially has you covered.

APIs

Especially has no main module (gasp). Instead, you'll require one of the top-level modules that contain the stuff you want.

require("especially/abstract-operations")

require("especially/math")

A variety of math operations from the Algorithm Conventions section of the spec:

  • abs(x)
  • sign(x)
  • min(x1, x2, …, xn)
  • floor(x)

require("especially/meta")

  • assert: ensures you pass it a boolean, then throws if it's not true
  • define_built_in_data_property: a shortcut for defining a built-in data property with the usual property descriptor.
  • Internal slot management:
    • make_slots(object, arrayOfSlotNames): call this to initialize an object's internal slots. Often referenced in the spec as "instances of (something) are initially created with the internal slots listed in (some table)."
    • get_slot(object, name): get the value of an internal slot. Often referenced in the spec as "the value of (object)'s [[SlotName]] internal slot."
    • set_slot(object, name): set the value of an internal slot. Often referenced in the spec as "Set (object)'s [[SlotName]] internal slot to (a value)."
    • has_slot(object): check whether an object has an internal slot with the given name. Often referenced in the spec as "If (object) does not have a [[SlotName]] internal slot."

require("especially/well-known-symbols")

One well-known symbol is included:

  • "@@iterator" will give you a symbol that is used by GetIterator. (It is the same as V8's default Symbol.iterator.)
  • "@@species" will give the symbol that is used by SpeciesConstructor. (It is a freshly-minted symbol, since V8 doesn't have Symbol.species yet.)

require("especially/intrinsics")

Some of the well-known intrinsic objects are included by name, e.g. "%ObjectPrototype%". These are used by GetPrototypeFromConstructor and related operations.

Usage Notes

Especially is meant to run in io.js (not Node.js™). It uses certain ES2015 features only implemented in modern V8.

Install it from npm into your project with npm install especially.

You can see examples of it in use in the reference implementation of the ES2015 promises specification.