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

emit

v0.0.2

Published

A reactive toolkit for JavaScript

Downloads

66

Readme

( ( (emit) ) )

(emit) is a functional reactive programming toolkit based on JavaScript primitives, allowing you to compose functional applications using the APIs you already know.

(emit) is a very rough work in progress. It can run both in the browser and on node.js.

Example

emit = require("emit")

// emit method APIs are identical to their native counterparts...
Math.pow(2, 2)       // 4
emit.Math.pow(2, 2)  // 4
 
Array(1, 2, 3)       // [1, 2, 3]
emit.Array(1, 2, 3)  // [1, 2, 3]
 
1 / 2                // .5
emit.ops["/"](1, 2)  // .5

// with one exception: emit methods can also take functions, which are
// treated as yet-unevaluated values that can be "watched". All emit
// methods compose these (possibly unevaluated) values into a single
// value; if any of these values are functions, the returned value will
// also be a function.

// Here's an example of such a function; it reports an incremented number
// back to its listener every second.
function count(cb) {
  var send = function(){ cb(null, i++) }
  	, i = 0

  send()
  setInterval(send, 1000)
}

// Since the value reported by count changes every second, so does
// the value of any method that uses it. So these are all functions:
emit.Math.pow(2, count)  // [Function]
emit.Array(1, 2, count)  // [Function]
emit.ops["/"](1, count)  // [Function]

// We can observe these changing values through the console.
function log(e, data){ console.log(e || data) }

emit.Math.pow(2, count)(log)  // 1, 2, 4, 8, 16, 32...
emit.Array(1, 2, count)(log)  // [1, 2, 0], [1, 2, 1], [1, 2, 2]...
emit.ops["/"](1, count)(log)  // Infinity, 1, .5, .25...

// Now we can now start to compose these into increasingly
// complex values.
random   = emit.Math.random(ping)
randBin  = emit.Math.round(random)
coinToss = emit.ops["?:"](randBin, "heads", "tails")
message  = emit.ops["+"]("The coin landed on ", coinToss)

message(log)  // "The coin landed on heads"
              // "The coin landed on tails"
              // "The coin landed on heads"
              // ...

Installation

To install, head to your terminal and enter:

npm install emit

Support

Current

  • Array: all ES3/ES5 methods
  • Function: apply, and call
  • Math: all statics and function
  • operators: most accessors, including !, ~, typeof, void, *, /, %, +, -, <<, >>, >>>, <, <=, >, >=, ==, !=, ===, !==, &, ^, |, &&, ||, , , ?:, [], and in

Planned

  • RegExp, String, Date, Number, Boolean
  • Function::bind
  • DOM/HTML
  • DOM events
  • JSON
  • node.js file system, etc.

License

Copyright (c) 2012 Jed Schmidt, http://jed.is/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.