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

tzatziki

v0.3.0

Published

A domain rules engine based on Gherkin syntax

Downloads

4

Readme

tzatziki

A domain rules engine based on Gherkin syntax

Node.js CI

WARNING: this project is still highly experimental and its API may change in the future!

NOTE: while experimental, feedback is encouraged and really welcome!

Why?

The Gherkin syntax and the cucumber project have made writing and execuring acceptance tests a very easy and efficient activity.

However, writing the real domain code could still be a very complex and risking challenge.

In a LEAN and Agile world, requirements may change a lot along the development lifecycle. The impact of complex code refactoring can be devastating for teams, companies and client's investment.

That's the idea: why don't model the domain logic using the same approach used to write the acceptance tests?

The main advantages of this approach are:

  1. Complex code is implicitly broken in small and resusable step definitions.
  2. The cost of requirement changes become less critical and the investment more valuable.
  3. Throwing away big chunks of code when requirements change is less probable.
  4. The domain code is highly decoupled from the rest of the system, making it more clean and visible.

Getting started

First of all, let's install Tzatziki:

$ npm install --save tzatziki

We can now create features and scenarios using the Tzatziki API:

const Tzatziki = require('tzatziki')
const tzatziki = new Tzatziki()

// Create a feature for our business domain:

const feature = tzatziki.createFeature('User profile', 'As user, I request my profile details')
const scenario = feature.createScenario('A user requests her profile')

scenario.Given('a user')
scenario.When('she requests her profile')
scenario.Then('her details are returned')

// Then, populate the dictionary of definitions to provide the logic:

tzatziki.dictionary.Given('a user', function () { ... })
tzatziki.dictionary.When('she requests her profile', function () { ... })
tzatziki.dictionary.Then('her details are returned', function () { ... })

feature
  .exec(tzatziki.dictionary)
  .catch(err => console.log(err))

Alternatively, we can also use features written in Gherkin syntax to model our domain logic:

const Tzatziki = require('tzatziki')
const tzatziki = new Tzatziki()

// Cucumber-style methods can be used:

const { Given, When, Then } = tzatziki.cucumber()

Given('a user', function () { ... })
When('she requests her profile', function () { ... })
Then('her details are returned', function () { ... })

// Parse an existing feature file:

tzatziki
  .parse('features/example.feature')
  .then(feature => feature.exec(tzatziki.dictionary))

Test

$ npm test

Acknowledgements

This project is kindly sponsored by:

heply

License

Licensed under MIT