How to execute serverless commands from within NodeJS script

If I have a NodeJS script, is there a way I can require('serverless') and then trigger a serverless command like I would from the CLI? Something like

var sls = require('serverless'); sls.invoke({function: 'myFunc', data: '{"data": "value"}'});