Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Run spider script files as javascript modules in NodeJS.

License

Notifications You must be signed in to change notification settings

sagiegurari/node-spider-script

Repository files navigation

node-spider-script

NPM Version Build Status Coverage Status Inline docs
License Total Downloads Dependency Status devDependency Status

Load spider script as any javascript modules under nodeJS runtime.

Overview

Spider is a programming language that compiles to JavaScript. It takes the best ideas of Swift, Python, C# and CoffeeScript.

See spiderlang.org for more information.

Usage

In order to use spider scripts under node, you need to first require this library as follows

require('node-spider-script');

Now you can require your spider files like any other javascript files, for example:

var jsModule = require('./my-test.spider');

var person = jsModule.create('my name');
var output = person.listen('my noise');

In your spider file, instead of doing module.exports, do return to the object you wish to export.

For example:

return {
    create: fn(name) {
        return new Person(name);
    }
};

Full example (Spider):

fn Person(name) {
  this.name = name;

  this.listen = fn (text) {
    return this.name + ' ' + text;
  };
}

return {
    create: fn(name) {
        return new Person(name);
    }
};

Full example (JavaScript):

require('node-spider-script');

var jsModule = require('./my-test.spider');

var person = jsModule.create('my name');
var output = person.listen('my noise');

Installation

In order to use this library, just run the following npm install command:

npm install --save node-spider-script

API Documentation

See full docs at: API Docs

Contributing

See contributing guide

Release History

Date Version Description
2018-10-31 v1.0.39 Maintenance
2015-02-06 v0.0.20 Grunt cleanups
2014-12-07 v0.0.16 Minor internal changes
2014-12-01 v0.0.14 Added continues integration support for the project
2014-11-30 v0.0.13 Internal changes due to spider dependency changes
2014-11-29 v0.0.12 Updated spider dependency
2014-11-29 v0.0.11 Internal improvements
2014-11-22 v0.0.7 JSDoc changes
2014-11-22 v0.0.6 Fixed pure require approach
2014-11-22 v0.0.5 Initial release

License

Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.