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

slimjs

v2.1.4

Published

An Async Node.js SliM server for FitNesse

Downloads

73

Readme

SlimJS

An Async Node.js SliM server for FitNesse

To use slimjs on an existing FitNesse server:

npm install -g slimjs

On windows there might be an error when java is trying to execute SlimJS even though installed globally. Try to replace COMMAND_PATTERN with an absolute path.

!define COMMAND_PATTERN {node C:\Users\<MY_USER>\AppData\Roaming\npm\node_modules\slimjs\src\SlimJS %p}

Create a test page in FitNesse and add this to the top of the page, remember on windows to replace COMMAND_PATTERN with an absolute path if needed:

!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN {SlimJS %p}
!path /Path/To/My/Fixtures

|import      |
|my-test-file|

|Hi            |
|echo |sayHi?  |
|Bob  |Hi! Bob |

/Path/To/My/Fixtures/my-test-file.js

function Hi(){
    this.setEcho = function(str){
        this.echo = str;
    }

    this.sayHi = function(){
        return "Hi! " + this.echo;
    }
}

module.exports.Hi = Hi;

If you want to do something asynchronous, return a thenable (promise):

|script  |child_process            |
|check   |exec  |node -v  |v5.4.0  |
var exec = require('child_process').exec;

function child_process() {
    this.exec = function (cmd) {

        return {
            then:function(fulfill,reject){
                exec(cmd, function (err, stdout, stderr) {
                    if(err)
                        return reject(err);

                    fulfill(stdout.trim());
                });
            }
        }
    }
}

module.exports.child_process=child_process;

Using namespaces:

|eg.Division                       |
|numerator |denominator |quotient? |
|10        |2           |$result=  |
|$result   |10          |0.5       |
|12.6      |3           |4.2       |
|100       |4           |25        |
var eg={
    Division:function(){
        var num;
        var denom;

        this.setNumerator = function(n){
            num = n;
        }
        this.setDenominator = function(n){
            denom=n;
        }
        this.quotient = function(){
            return num/denom;
        }
    }
};

module.exports.eg=eg;

Name conversion:

|should I buy milk                                              |
|cash in wallet|credit card|pints of milk remaining|go to store?|
|0             |no         |0                      |no          |
|10            |no         |0                      |yes         |
|0             |yes        |0                      |yes         |
|10            |yes        |0                      |yes         |
|0             |no         |1                      |no          |
|10            |no         |1                      |no          |
|0             |yes        |1                      |no          |
|10            |yes        |1                      |no          |
function ShouldIBuyMilk() {
    var _dollars;
    var _pints;
    var _creditCard;

    this.setCashInWallet = function(dollars) {
        _dollars = dollars;
    }

    this.setPintsOfMilkRemaining=function(pints) {
        _pints = pints;
    }

    this.setCreditCard = function(valid) {
        _creditCard = "yes"===valid;
    }

    this.goToStore = function() {
        var ret=(_pints == 0 && (_dollars > 2 || _creditCard)) ? "yes" : "no";
        return ret;
    }
}

module.exports.ShouldIBuyMilk=ShouldIBuyMilk;

Using JSON

|Json                         |
|json               |X and Y ?|
|{x:1,y:2}          |3        |
|{x:'Bar', y:' Baz'}|Bar Baz  |
function Json(){
    this.setJson = function(jsonObject){
        this.obj = jsonObject;
    }

    this.XAndY = function(){
        return this.obj.x + this.obj.y;
    }
}

module.exports.Json=Json;

--

For contributors

I'm working to pass the FitNesse Test Suite for Slim.

You can run these test locally here (after you startup): http://localhost:8080/FitNesse.SuiteAcceptanceTests.SuiteSlimTests

To start the environment:

npm install
cd fitnesse
java -jar fitnesse-standalone.jar -p 8080

http://localhost:8080

To start the UDP logger (for debugging)

node src/utils/LogUdpServer.js

Thanks to:

Tomasz @mrt123. The first user of slimjs and for the async exec example. Gregor Gramlich @ggramlich. For help with the SliM protocol, the PHP implementation and the promise proposal. Christian Gagneraud @chgans. QtSlim

Libraries: json5