How to use the oniguruma/build/Release/onig_scanner.node.OnigScanner.prototype function in oniguruma

To help you get started, we’ve selected a few oniguruma 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 phenomic / phenomic / jest-setup.js View on Github external
if (startPosition == null) startPosition = 0;
    if (typeof startPosition === "function") {
      callback = startPosition;
      startPosition = 0;
    }

    string = this.convertToString(string);
    startPosition = this.convertToNumber(startPosition);

    this._findNextMatch(string, startPosition, (error, match) => {
      if (match) match.scanner = this;
      return callback(error, match);
    });
  };

  OnigScanner.prototype.findNextMatchSync = function(string, startPosition) {
    if (startPosition == null) {
      startPosition = 0;
    }
    string = this.convertToString(string);
    startPosition = this.convertToNumber(startPosition);

    let match = this._findNextMatchSync(string, startPosition);
    if (match) match.scanner = this;
    return match;
  };

  OnigScanner.prototype.convertToString = function(value) {
    if (value === undefined) return "undefined";
    if (value === null) return "null";
    if (value.constructor == OnigString) return value;
    return value.toString();
github phenomic / phenomic / jest-setup.js View on Github external
string = this.convertToString(string);
    startPosition = this.convertToNumber(startPosition);

    let match = this._findNextMatchSync(string, startPosition);
    if (match) match.scanner = this;
    return match;
  };

  OnigScanner.prototype.convertToString = function(value) {
    if (value === undefined) return "undefined";
    if (value === null) return "null";
    if (value.constructor == OnigString) return value;
    return value.toString();
  };

  OnigScanner.prototype.convertToNumber = function(value) {
    value = parseInt(value);
    if (!isFinite(value)) {
      value = 0;
    }
    value = Math.max(value, 0);
    return value;
  };

  OnigString.prototype.substring = function(start, end) {
    return this.content.substring(start, end);
  };

  OnigString.prototype.toString = function(start, end) {
    return this.content;
  };
github phenomic / phenomic / jest-setup.js View on Github external
);
  };

  OnigRegExp.prototype.testSync = function(string) {
    return this.searchSync(string) != null;
  };

  OnigRegExp.prototype.test = function(string, callback) {
    return this.search(string, 0, function(error, result) {
      return typeof callback === "function"
        ? callback(error, result != null)
        : void 0;
    });
  };

  OnigScanner.prototype.findNextMatch = function(
    string,
    startPosition,
    callback,
  ) {
    if (startPosition == null) startPosition = 0;
    if (typeof startPosition === "function") {
      callback = startPosition;
      startPosition = 0;
    }

    string = this.convertToString(string);
    startPosition = this.convertToNumber(startPosition);

    this._findNextMatch(string, startPosition, (error, match) => {
      if (match) match.scanner = this;
      return callback(error, match);
github phenomic / phenomic / jest-setup.js View on Github external
});
  };

  OnigScanner.prototype.findNextMatchSync = function(string, startPosition) {
    if (startPosition == null) {
      startPosition = 0;
    }
    string = this.convertToString(string);
    startPosition = this.convertToNumber(startPosition);

    let match = this._findNextMatchSync(string, startPosition);
    if (match) match.scanner = this;
    return match;
  };

  OnigScanner.prototype.convertToString = function(value) {
    if (value === undefined) return "undefined";
    if (value === null) return "null";
    if (value.constructor == OnigString) return value;
    return value.toString();
  };

  OnigScanner.prototype.convertToNumber = function(value) {
    value = parseInt(value);
    if (!isFinite(value)) {
      value = 0;
    }
    value = Math.max(value, 0);
    return value;
  };

  OnigString.prototype.substring = function(start, end) {