Browse Source

Export utils explicitly

master
Futago-za Ryuu 3 years ago
parent
commit
3986ca7048
  1. 35
      packages/pegjs/lib/util/index.js

35
packages/pegjs/lib/util/index.js

@ -5,13 +5,6 @@ const js = require( "./js" );
const objects = require( "./objects" );
const vm = require( "./vm" );
objects.extend( exports, arrays );
objects.extend( exports, js );
objects.extend( exports, objects );
objects.extend( exports, vm );
exports.noop = function noop() { };
/**
* ```ts
* type Session = peg.compiler.Session;
@ -26,7 +19,7 @@ exports.noop = function noop() { };
*
* This method takes a `StageMap`, returning a `PassMap` that can be used by the compiler.
*/
exports.convertPasses = ( () => {
const convertPasses = ( () => {
function convertStage( passes ) {
@ -46,7 +39,7 @@ exports.convertPasses = ( () => {
} )();
exports.processOptions = function processOptions( options, defaults ) {
function processOptions( options, defaults ) {
const processedOptions = {};
@ -55,4 +48,28 @@ exports.processOptions = function processOptions( options, defaults ) {
return processedOptions;
}
module.exports = {
find: arrays.find,
findIndex: arrays.findIndex,
stringEscape: js.stringEscape,
regexpEscape: js.regexpEscape,
reservedWords: js.reservedWords,
clone: objects.clone,
each: objects.each,
extend: objects.extend,
map: objects.map,
values: objects.values,
enforceFastProperties: objects.enforceFastProperties,
evalModule: vm.evalModule,
convertPasses,
processOptions,
noop() { },
};
Loading…
Cancel
Save