Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import ret from "ret";
import DRange from "discontinuous-range";
import _range from "lodash.range";
const LOWERCASE_RANGE = [97, 122];
const UPPERCASE_RANGE = [65, 90];
const ASCII_RANGE = [32, 126];
const UNICODE_RANGE = [0, 65535];
const AsciiDRange = DRange(...ASCII_RANGE);
const UnicodeDRange = DRange(...UNICODE_RANGE);
const inRange = ([min, max], n) => n >= min && n <= max;
const changeCase = (code) => {
const lowercase = inRange(LOWERCASE_RANGE, code);
const uppercase = inRange(UPPERCASE_RANGE, code);
return lowercase || uppercase ? code + (lowercase ? -32 : 32) : code;
};
const createChar = (code, ignoreCase, prng) =>
code === null ? '' : String.fromCharCode(
ignoreCase && boolean.random(prng) ? changeCase(code) : code);
const expandCharacter = ({value}) => DRange(value);
const expandRange = ({from, to}) => DRange(from, to);
const expandRange = ({from, to}) => DRange(from, to);
const expandSet = (token, range) => {
let drange = DRange();
let setRanges = token.set.map((code) => expand(code, range));
setRanges.forEach((setRange) => drange.add(setRange));
return token.not ? range.clone().subtract(drange) : drange;
};
import integer from "./integer";
import set from "./set";
import ret from "ret";
import DRange from "discontinuous-range";
import _range from "lodash.range";
const LOWERCASE_RANGE = [97, 122];
const UPPERCASE_RANGE = [65, 90];
const ASCII_RANGE = [32, 126];
const UNICODE_RANGE = [0, 65535];
const AsciiDRange = DRange(...ASCII_RANGE);
const UnicodeDRange = DRange(...UNICODE_RANGE);
const inRange = ([min, max], n) => n >= min && n <= max;
const changeCase = (code) => {
const lowercase = inRange(LOWERCASE_RANGE, code);
const uppercase = inRange(UPPERCASE_RANGE, code);
return lowercase || uppercase ? code + (lowercase ? -32 : 32) : code;
};
const createChar = (code, ignoreCase, prng) =>
code === null ? '' : String.fromCharCode(
ignoreCase && boolean.random(prng) ? changeCase(code) : code);
const expandCharacter = ({value}) => DRange(value);
const generateCharacterFromRange = ([min, max], {prng}) =>
generateStringFromRange(DRange(min, max), '.', {prng});
const expandCharacter = ({value}) => DRange(value);