Move processOptions to utils

master
Futago-za Ryuu 7 years ago
parent b5d01f7505
commit 1fca2daff6

@ -15,17 +15,6 @@ const Session = require( "./session" );
const util = require( "../util" );
const vm = require( "./vm" );
function processOptions( options, defaults ) {
const processedOptions = {};
util.extend( processedOptions, options );
util.extend( processedOptions, defaults );
return processedOptions;
}
const compiler = {
Session: Session,
@ -64,7 +53,7 @@ const compiler = {
options = typeof options !== "undefined" ? options : {};
options = processOptions( options, {
options = util.processOptions( options, {
allowedStartRules: [ ast.rules[ 0 ].name ],
cache: false,
context: {},

@ -538,8 +538,6 @@ declare namespace peg {
interface IObjectUtils {
convertPasses( stages: IStageMap ): compiler.IPassesMap;
clone( source: {} ): {};
each( object: {}, iterator: IIterator<void> ): void;
extend( target: {}, source: {} ): {};
@ -550,7 +548,9 @@ declare namespace peg {
}
interface util extends IObjectUtils {
noop(): void;
convertPasses( stages: IStageMap ): compiler.IPassesMap;
processOptions( options: {}, defaults: {} ): {};
}
const util: util;

@ -181,3 +181,9 @@ declare module "pegjs/lib/util/objects" {
export default objects;
}
declare module "pegjs/lib/util/process-options" {
export default peg.util.processOptions;
}

@ -5,5 +5,6 @@ const objects = require( "./objects" );
exports.noop = function noop() { };
exports.convertPasses = require( "./convert-passes" );
exports.processOptions = require( "./process-options" );
objects.extend( exports, objects );

@ -0,0 +1,16 @@
"use strict";
const objects = require( "./objects" );
function processOptions( options, defaults ) {
const processedOptions = {};
objects.extend( processedOptions, options );
objects.extend( processedOptions, defaults );
return processedOptions;
}
module.exports = processOptions;
Loading…
Cancel
Save