How to use the @terrestris/base-util/dist/StringUtil/StringUtil.stringDivider function in @terrestris/base-util

To help you get started, we’ve selected a few @terrestris/base-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github terrestris / react-geo / src / Button / DigitizeButton / DigitizeButton.tsx View on Github external
setTextOnFeature = (feat, onModalOkCbk) => {
    const {
      maxLabelLineLength
    } = this.props;

    const {
      textLabel
    } = this.state;

    let label = textLabel;
    if (maxLabelLineLength) {
      label = StringUtil.stringDivider(
        textLabel, maxLabelLineLength, '\n'
      );
    }
    feat.set('label', label);
    this.setState({
      textLabel: ''
    }, () => {
      if (_isFunction(onModalOkCbk)) {
        onModalOkCbk(feat, label);
      }
    });
  }