UNPKG

node-red-contrib-agilite-utils

Version:

A set of Agilit-e Node-RED Nodes to perform various adhoc tasks without calling 3rd party web services

57 lines (53 loc) 1.68 kB
<script type='text/javascript'> RED.nodes.registerType('type-detect', { category: 'utilities', color: '#ffa4a2', icon: 'type-detect.png', inputs: 1, outputs: 1, paletteLabel: 'type-detect', defaults: { name: { value: '' }, field: { value: 'payload' }, fieldType: { value: 'msg' } }, label: function () { return this.name || 'Type-Detect' }, oneditprepare: function () { if (!this.fieldType) { this.fieldType = 'msg' } $('#node-input-field').typedInput({ default: 'msg', types: ['msg', 'flow', 'global'], typeField: $('#node-input-fieldType') }) } }) </script> <script type='text/x-red' data-template-name='type-detect'> <div class='form-row'> <label for='node-input-field'><i class='fa fa-edit'></i> <span data-i18n='template.label.property'>Output to</span></label> <input type='text' id='node-input-field' placeholder='payload' style='width:250px'> <input type='hidden' id='node-input-fieldType'> </div> <div class='form-row'> <label for='node-input-name'><i class='fa fa-tag'></i> Name</label> <input type='text' id='node-input-name' placeholder='Node Name' /> <div> </script> <script type='text/x-red' data-help-name='type-detect'> <p>Detects Payload type</p> <p>Based on the Node Module: <a href='https://www.npmjs.com/package/type-detect' target='_blank'>type-detect</a></p> <h4>Input</h4> <p>Any type of payload i.e. (Objects, Integers, Strings, Arrays, Boolean)</p> <h4>Output</h4> <p>Payload type</p> </script>