mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 20:55:30 +02:00
* Lots of progress on PEG.js ACS parsing and validation implementation
This commit is contained in:
parent
bae2e788e1
commit
a1d3ab9f0e
6 changed files with 504 additions and 294 deletions
22
core/acs_util.js
Normal file
22
core/acs_util.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
// ENiGMA½
|
||||
var acsParser = require('./acs_parser.js');
|
||||
|
||||
var _ = require('lodash');
|
||||
var assert = require('assert');
|
||||
|
||||
exports.getConditionalValue = getConditionalValue;
|
||||
|
||||
function getConditionalValue(client, condArray, memberName) {
|
||||
assert(_.isObject(client));
|
||||
assert(_.isArray(condArray));
|
||||
assert(_.isString(memberName));
|
||||
|
||||
condArray.forEach(function cond(c) {
|
||||
if(acsParser.parse( { client : client }, c.acs)) {
|
||||
return c[memberName];
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue