text: const intRegex = /^-?\d+$/;
  
  function fixFloatLiteral(f) {
    return intRegex.test(f) ? f.concat('.0') : f;
  }
  
  export default {
    title: 'Divide',
    inputs: 2,
    outputs: 1,
    data() {
      return {
        value: '',
        valueType: 'none',
        categories: ['number-value'],
      };
    },
    form: ['read-only-value'],
    calculateValue(drawflow, node) {
      let value = '';
      let valueType = 'none';
      if (
        node.inputs.input_1.connections.length &&
        node.inputs.input_2.connections.length
      ) {
        const node1 = drawflow.getNodeFromId(
          node.inputs.input_1.connections[0].node
        );
        const node2 = drawflow.getNodeFromId(
          node.inputs.input_2.connections[0].node
        );
        if (
          (node1.data.valueType === 'integer' ||
            node1.data.valueType === 'float') &&
          (node2.data.valueType === 'integer' || node2.data.valueType === 'float')
        ) {
          valueType = 'float';
          const value1 = Number(node1.data.value);
          const value2 = Number(node2.data.value);
          value = (value1 / value2).toString();
          value = fixFloatLiteral(value);
        }
      }
      return {value, valueType};
    },
    getValueListeners(node) {
      return node.outputs.output_1.connections.map(connection => connection.node);
    },
  };
  