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

ki

v0.2.5

Published

lisp + mori, sweet.js

Downloads

98

Readme

ki

lisp + mori, sweet.js

ki

See ki-lang.org for more information or try ki straight in your browser.

ki is a lisp with Clojure data structures and semantics that can be intermixed with Javascript code at any level.

ki is a thin macro layer on top of mori plus a few constructs.

ki is in flux, feel free to test it out but expect glitches.

Currently available functions / special forms

All of mori.

The following list of functions / special forms

[] {} [$ ] {$ } add and apply atom bind catch chain cond def defmethod defmulti 
defn deref div do doto eq falsey finally fn fnth geq gt if ifNot js leq letc 
let lt loop mod mul neq nil not ns or prn recur reset str sub swap threadf 
threadl truthy try use when whenNot while 

Plus destructuring and source maps.

Take a look at the tests to keep up with the latest additions.

Examples

Require ki (this in turns expands into an appropriate require for mori)

ki require core

Mori's persistent data structures and Clojure(Script)-like api at your fingertips

var foo = ki (vector 1 2 3)
ki (conj foo 4)
// => [1 2 3 4]

Plus lambdas

ki (map (fn [a] (inc a)) (range 5))
// => (1 2 3 4 5)

Interoperability: write js in a ki form

var fn1 = ki (js function (a,b) { return a + b + 2; })

at any level - e.g. you can use infix where it makes sense

var fn2 = ki (fn [a b] (js a + b + 2))

and you can use ki wherever in js code

function somefunc (a) {
  ki (toJs (filter (fn [el] (isEven el)) (range a))).forEach(function(el) {
      console.log(el);
      });
  return [0, 1, 2, 3, 4].filter(ki (fn [el] (isEven el)));
}
console.log(somefunc(5));
// => 0 
// => 2 
// => 4 
// [0 2 4]

Like a pro

ki (take 6 (map (fn [x] (js x * 2)) (range 1000)))
// => (0 2 4 6 8 10)

Get it

$ npm install -g ki

All set. Now to compile a JavaScript file containing ki code into a plain JavaScript file do

$ ki -o foo_build.js foo.js

To watch the file and have it automatically compiled whenever the file changes on disk

$ ki -w -o foo_build.js foo.js

License

MIT license http://www.opensource.org/licenses/mit-license.php/

Copyright (C) 2014-2015 Luca Antiga http://lantiga.github.io