New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sebastian

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sebastian

A flow-control library aimed at encouraging organized, testable code.

latest
npmnpm
Version
0.2.5
Version published
Weekly downloads
32
Maintainers
1
Weekly downloads
 
Created
Source

Sebastian

##Intro

Sebastian is a flow control library aimed at encouraging developers to write organized, testable code. It works in the browser or with Node.js.

Rationale

There are many flow-control libraries out there, but none that I am quite satisfied with at the moment. Async is great, but I don't agree with Node.js-style callback conventions and I don't like mixing success and error condition logic. Also, I have found Async-wrapped code to be difficult to test. Sebastian is built to encourage construction of discrete chunks of manageable code that can be easily tested. I'm a big fan of Deferreds. Sebastian uses jQuery Deferred $.when() wrapper to treat asynchronous and synchronous steps/code the same.

Dependencies

  • For Node.js, jquery-deferred, but Q support may be added at a later date.
  • For browser environments, jQuery.

Documentation

For full documentation, check out the Sebastian GitHub page.

Getting started

To use as a Node.js module, install with NPM, or add as a dependency in your package.json.

npm install sebastian

Then, require the module and add a flow:

var flow = require("sebastian").flow;

flow("helloFlow")
    .step("one", function() {
        console.log("hello..");
    }).step("two", function() {
        console.log("hello 2..");
    }).begin();

This creates a flow called "helloFlow", adds to steps two the flow, and starts the flow.

To use with an AMD module loader (only tested w/ RequireJS):

    require(["jquery", "path/to/sebastian"], function($, sebastian) {

        //call the local definition
        sebastian.flow("blah")
                .step("one", function() {
                    console.log("step one..");
                })
                .step("two", function() {
                    console.log("step two..");
                })
                .begin();

    });

To use with old-school sequential script tags:

<script type="text/javascript" src="vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/sebastian.js"></script>

<script type="text/javascript">

    $.Flow("firstFlow")
            .step("one", function() {
                console.log("executing step one in firstFlow...");
            })
            .step("two", function() {
                console.log("executing step two in firstFlow...");
            }).begin();


</script>

Tests/Specs

Keywords

sebastian

FAQs

Package last updated on 26 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts