nsify
v0.2.1
Published
NetSuite-side require() the node.js
Downloads
8
Maintainers
Readme
nsify
NetSuite-side require() the node.js
You can use require()
the node.js freely on yours JavaScripts.
Required
- node.js 4+
Install
sudo npm install nsify -g
Command Line
Generate your SuiteScripts:
- input: restlet-with-require.js
- output: suite-script-nsify-restlet.js
nsify ./test/_files/RE-process-restlet.js >> suite-script-process-restlet.js
Usage NS Annotations
var nsify = require('nsify'),
filePath = './test/_files/custom/schedule-simple.js',
nsObj = nsify.annotation(filePath);
console.log(nsObj); // see output
- input: schedule-simple.js
- output:
{
"id": "sp-schedule",
"type": "schedule",
"alias": "MySchedule",
"function": "MySchedule.process",
"libs": [
"my-lib.js"
],
"params": {
"param1": {"name": "Param 1", "type": "INTEGER"}
}
}
Compatibility with nsmockup
var nsify = require('nsify'),
nsmockup = require('nsmockup');
nsmockup.init(function() {
let filePath = './test/_files/custom/schedule-simple.js',
script = nsify.annotation(filePath, 'nsmockup');
console.log(script); // see output
nsmockup.createSuiteScript(script.type, script, function($ctx) {
let alias = script.alias;
if ($ctx[alias]) {
console.log(':D works!!');
}
});
});