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 🙏

© 2026 – Pkg Stats / Ryan Hefner

grunt-docu-examples-tester

v1.1.2

Published

grunt plugin for testing examples from the documentation

Readme

grunt-docu-examples-tester Build Status

This grunt plugin is written in order to help developers test examples, that they use in their documemtation.

Installation

npm install grunt-docu-examples-tester

Usage

grunt pull-examples takes examples out of the documentation files, creates a test for each example, if it does not already exist. If it exists, the actual example will be pasted in it.

grunt push-examples takes examples from the tests and pastes them into the documentation files

Settings

"pull-examples": {
  def: {
    src: ["docs/**/*.md"], // path to the documentation files
    templates: ["lib/tasks/files/"], // path to the test-templates
    tests: ["tests/Cojoko/examples/"]  //path to the tests
  }
}

"push-examples": {
  def: {
    src: ["docs/**/*.md"], //path to the documentation files
    tests: ["tests/Cojoko/examples/"]  //path to the test files  
  }
}

examples format

The examples in the documentation files (provided as src) should be written in the format:

```javascript
//<exampleName>Example: <exampleDescription>
...
```

For example:

```js
// basicClassExample: Classes can be created

Cojoko.Class('ACME.Exchange.Share', {

  properties: {
    title: { is: 'rw', required: true, isPrivate: true },
    isin: { is: 'rw', required: true, isPrivate: true },
    wkn: { is: 'rw', required: true, isPrivate: true },
    price: { is: 'rw', required: true, isPrivate: true, type: 'ACME.Exchange.Price' }
  },

  methods: {
    toString: function () {
      return this.title+' ('+this.isin+'/'+this.wkn+')';
    }
  }
});
```

it does not matter if you use js or javascript on the code fence

test template format

  • The template can contain placeholders <exampleName> and <exampleDescription>. They will be changed correspondingly.

For example a test template could look like this:

describe("<exampleName>", function () {
  it("<exampleDescription>", function () {
    /* beginning of the example */
    /* end of the example */

    assert.equal(true, true);
  });
});
  • The test template should contain lines /* beginning of the example */ and /* end of the example */, so that the tasks can paste and parse an example correctly.

And the replaced test would look like this:

describe("basicClassExample", function () {
  it("Classes can be created", function () {
    /* beginning of the example */
    Cojoko.Class("ACME.Exchange.Share", {
      properties: { 
        title: { is: "rw", required: true, isPrivate: true }
      },
      methods: {
        toString: function () {
          return this.title + " (" + this.isin + "/" + this.wkn + ")";
        }
      }
    });
    /* end of the example */

    assert.equal(true, true);
  });
});

License

Copyright (c) 2013 ps-webforge.com, Yulia Bobkova

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.