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

goatee-script.js

v0.3.8

Published

Goatee is the missing complement for handlebar mustaches.

Downloads

23

Readme

goatee-script.js

Dependency Status

     _______  _______  _______  _______  _______  _______
    |    ___||       ||       ||_     _||    ___||    ___|
    |   | __ |   _   ||   _   |  |   |  |   |___ |   |___
    |   ||  ||  |_|  ||  |_|  |  |   |  |    ___||    ___|
    |   |_| ||       ||   _   |  |   |  |   |___ |   |___
    |_______||_______||__| |__|  |___|  |_______||_______|
                                     . ,
                                     (\\
                                  .--, \\__
                                   `-.     *`-.__
                                     |          ')
                                    / \__.-'-, ~;
                                   /     |   { /
                    ._..,-.-"``~"-'      ;    (
                 .;'                    ;'    ´
            ~;,./                      ;'
               ';                     ;'
                ';                 /;'|
                 |    .;._.,;';\   |  |
                 \   /  /       \  |\ |
                  \ || |         | )| )
                  | || |         | || |
            ~~~~~ | \| \  ~~~~~~ | \| \  ~~~~~~~
            "''"' `##`##' "'"''" `##`##' '"''"'"
            '"'"''"'"''"''"''"'"'''"'"'''"''"'"'
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       _______  _______  ______    ___  _______  _______
      |  _____||     __||    _ |  |   ||    _  ||_     _|
      | |_____ |    |   |   |_||_ |   ||   |_| |  |   |
      |_____  ||    |   |    __  ||   ||    ___|  |   |
       _____| ||    |__ |   |  | ||   ||   |      |   |
      |_______||_______||___|  |_||___||___|      |___|

A goatee is the perfect complement for handlebar mustaches. :-{>~

Objective

GoateeScript provides an unique language that is implemented in, modelled after and compiled to “ordinary” javascript. Sounds complicated ? It isn't ! Look at the following example:

Javascript:

(function() { var test = 1 + 2 * 3 ; return test })();

Coffeescript:

do -> test = 1 + 2 * 3

Goateescript:

test = 1 + 2 * 3

All three examples are equivalent and return the number 7.

As goatee.js provides attributes to map data into markup, I decided the best way to go would be a language that is compact, readable and (the most important feature) has a scope consisting of a chain of contexts. Still confused ? Believe me, the haze will be lifted, once the framework has reached a state where it is useable. For the time beeing there is a command-line interpreter to prove my concept.

See:

Javascript – the source and destination

The rule of thumb is: a goateescript is a single javascript expression without any declarations or a collection of expressions suiteable to fit into a single line. The last expression's value is always returned to the invoking context.

Similarities to javascript

  • The language is a subset of javascript, without any differences in syntax but with less grammar. You could take a goatee-script and run it as javascript … but usally you will get a completly different result

Differences to javascript

  • Variable assigments are always local to the given script
  • Scripts have one or multiple contexts for each execution
  • Scripts are either directly interpreted at runtime, compiled to interpretable bytecode (usefull for runtimes implemented in other languages than javascript), or pre-compiled to javascript, which is the fastest and production way to go
  • Function declarations are forbidden
    • Hence not implemented
    • Of course you can use functions, provided by the script's context
    • You could provide methods to declare them, which would be somewhat arkward, but possible
  • Regular-Expression declarations are forbidden
    • Hence not implemented
    • Of course you can use regular expressions, provided by the script's context
    • You could provide methods to declare them, which would be somewhat arkward, but possible
  • Most javascript statements are forbidden
    • With the exception of “if”/“else” statements all the others (“for”, “return” “switch”, “yield” and so on) are not implemented. This might change in future but for the time beeing all of them are not neccessary in the context of the goatee-framework.
    • Of course you can use use all of them in functions, provided by the context
    • You could provide methods to declare them, which would be somewhat arkward, but possible

Installation

$ npm install -g goatee-script.js

Usage

$ goatee-script -h

Usage: goatee-script [statements]... [options]

statements     string passed from the command line to evaluate

Options:
   -r STATEMENT, --run STATEMENT   string passed from the command line to
                                   evaluate
   -h, --help                      display this help message
   -i, --interactive               run an interactive `goatee-script` read-
                                   execute-print-loop (repl)
   -m MODE, --mode MODE            [c]ompile, [e]valuate, [p]rint, [r]ender
                                   or [s]tringify statements, default:  [eval]
   -c, --compress                  compress the abstract syntax tree (ast)
   --nodejs OPTION                 pass one option directly to the 'node'
                                   binary, repeat for muliple options
   -v, --version                   display the version number and exit

If called without options, `goatee-script` will run interactive.

Documentation

Read the annotated sources.

Development

Install dependencies …

  • node.js (≥ 6.x)

    … for production version:

     $ npm install goatee-script.js --save-prod

    … for development version:

    $ git clone https://github.com/sjorek/goatee-script.js
    $ cd goatee-script.js
    $ npm install

Run build …

$ npm run build && npm run test && npm run doc

(not tested yet)

Credits go to …