From fe08953434d892c7b7320e35ba071ec92d6ad341 Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 22 Jun 2020 18:57:51 +0200 Subject: [PATCH] docs: add custom module example --- resources/docs/docs/custom-module/examples.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/resources/docs/docs/custom-module/examples.md b/resources/docs/docs/custom-module/examples.md index ccca6191..75ce3486 100644 --- a/resources/docs/docs/custom-module/examples.md +++ b/resources/docs/docs/custom-module/examples.md @@ -29,6 +29,41 @@ module.exports = { } ``` +## Value conversion + +```js +module.exports = { + + oscInFilter:function(data){ + + var {address, args, host, port} = data + + if (address === '/some_address') { + + args[0].value = args[0].value * 10 + + } + + return {address, args, host, port} + + }, + + oscOutFilter:function(data){ + + var {address, args, host, port, clientId} = data + + if (address === '/some_address') { + + args[0].value = args[0].value / 10 + + } + + return {address, args, host, port} + } + +} +``` + ## Arguments split / merge ```js