Load spider script as any javascript modules under nodeJS runtime.
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.
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');
In order to use this library, just run the following npm install command:
npm install --save node-spider-script
See full docs at: API Docs
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 |
Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.