Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
jest.doMock("oniguruma", function mockOniguruma() {
// https://github.com/atom/node-oniguruma/blob/3664b41e615697a3abd3b13e67226d177fa4143b/src/oniguruma.js
// with just "configurable: true" on Object.defineProperty
"use strict";
const OnigScanner = require("oniguruma/build/Release/onig_scanner.node")
.OnigScanner;
const OnigString = require("oniguruma/build/Release/onig_scanner.node")
.OnigString;
function OnigRegExp(source) {
this.source = source;
this.scanner = new OnigScanner([this.source]);
}
OnigRegExp.prototype.captureIndicesForMatch = function(string, match) {
var capture, captureIndices, i, len;
if (match != null) {
captureIndices = match.captureIndices;
string = this.scanner.convertToString(string);
for (i = 0, len = captureIndices.length; i < len; i++) {
capture = captureIndices[i];
capture.match = string.slice(capture.start, capture.end);
}