Skip to content

Commit aa10235

Browse files
committed
Add OSS issue template.
1 parent 51fb072 commit aa10235

File tree

3 files changed

+89
-41
lines changed

3 files changed

+89
-41
lines changed
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Help/Support/Questions"
2+
description: "Have a question, experiencing a problem, or just unsure where to turn? Let our team try to help."
3+
title: "Requesting help..."
4+
assignees: []
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
# We are Here to Help.
10+
This form can be filled out to have your AppKu™ team...
11+
- Triage, investigate, and resolve problems with your digital process (app).
12+
- Answer questions.
13+
- Help create documentation, including designs and concepts.
14+
- ...and in general, help out!
15+
16+
- type: dropdown
17+
attributes:
18+
label: Request Type
19+
description: What is the nature of your request?
20+
multiple: false
21+
options:
22+
- Experiencing problems.
23+
- Need questions answered.
24+
- Need help with something else.
25+
default: 0
26+
validations:
27+
required: true
28+
- type: textarea
29+
attributes:
30+
label: Subject of your Request
31+
description: "Describe the details of your request."
32+
value:
33+
validations:
34+
required: true

calku.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,13 @@ class CalKu {
495495
let args = [];
496496
//split tokens by the separator
497497
for (let ft of token.tokens) {
498-
if (ft.type !== TokenType.Comment && ft.type !== TokenType.FuncArgumentsSeparator) {
498+
if (ft.type === TokenType.Func) {
499+
console.log(JSON.stringify(ft.tokens, null , 4));
500+
ft.value = this.valueOf(target, ft.tokens);
499501
args.push(ft.value);
500-
}
501-
502+
} else if (ft.type !== TokenType.Comment && ft.type !== TokenType.FuncArgumentsSeparator) {
503+
args.push(ft.value);
504+
}
502505
}
503506
funcs.argsValid(f, args, true);
504507
//make function call to resolve value.
@@ -525,7 +528,7 @@ class CalKu {
525528
// console.log(`consol start: ${consolidator.join(', ')}`);
526529
for (let opKey of orderedOps) {
527530
for (let i = 0; i < consolidator.length; i++) {
528-
if ((Array.isArray(opKey) && opKey.indexOf(consolidator[i].op) > -1) || consolidator[i].op === opKey) {
531+
if (consolidator[i] && ((Array.isArray(opKey) && opKey.indexOf(consolidator[i].op) > -1) || consolidator[i].op === opKey)) {
529532
let opToken = consolidator[i];
530533
let op = ops[opToken.op];
531534
if (i === 0) {

calku.test.js

+48-37
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ describe('#constructor', () => {
2121
});
2222

2323
describe('#lexer', () => {
24+
it('throws on an unknown function name.', () => {
25+
expect(()=>new CalcKu('BOGUS(1,2)').lexer()).toThrow(/unknown/i);
26+
});
2427
it('extracts grouping tokens', () => {
2528
let results = new CalcKu('((10 + 10) / 4)').lexer();
2629
expect(Array.isArray(results)).toBe(true);
@@ -369,47 +372,55 @@ describe('#value', () => {
369372
}
370373
};
371374
let tests = [
372-
['10 + 5 - 1', 14],
373-
//grouping
374-
['(10 + (5 * 2))', 20],
375-
//numeric/boolean mix
376-
['true + 3', 4],
377-
['false + 3', 3],
378-
//order of operations
379-
['10 + 5 - 12 / 3 * 2', 7],
380-
['(15 - 2 * 4) + (1 + 1 / 4)', 8.25],
381-
['10 + 5 - 12 / 3 * 2 + true', 8],
382-
['false + (15 - 2 * 4) + (1 + 1 / 4) - true', 7.25],
383-
//functions
384-
['HELLOWORLD()', 'Hello world.'],
385-
['SUM(1, 2, 3)', 6],
386-
['6 / SUM(1, 2, 3) + 3', 4],
387-
//property references
388-
['{num} + 3', 334458],
389-
['{detail.more} + -4 / {detail.less}', 8],
390-
['{detail.others:0}', 1],
391-
//comments
392-
[`(15 - 2 * 4)
393-
//test comment
394-
//and again
395-
+ (1 + 1 / 4)`, 8.25],
396-
//consolidate
397-
['"hi" & " there x" & 3 & true', 'hi there x3true'],
398-
//logical
399-
['1 and true', true],
400-
['0 and true', false],
401-
['1 and false', false],
402-
['0 and false', false],
403-
['1 or true', true],
404-
['0 or true', true],
405-
['1 or false', true],
406-
['0 or false', false],
407-
['false AND true OR (true AND false)', false]
375+
// ['10 + 5 - 1', 14],
376+
// //grouping
377+
// ['(10 + (5 * 2))', 20],
378+
// //numeric/boolean mix
379+
// ['true + 3', 4],
380+
// ['false + 3', 3],
381+
// //order of operations
382+
// ['10 + 5 - 12 / 3 * 2', 7],
383+
// ['(15 - 2 * 4) + (1 + 1 / 4)', 8.25],
384+
// ['10 + 5 - 12 / 3 * 2 + true', 8],
385+
// ['false + (15 - 2 * 4) + (1 + 1 / 4) - true', 7.25],
386+
// //functions
387+
// ['HELLOWORLD()', 'Hello world.'],
388+
// ['SUM(1, 2, 3)', 6],
389+
// ['6 / SUM(1, 2, 3) + 3', 4],
390+
['SUM(SUM(1, 3), 4, 8, 5)', 21],
391+
// //property references
392+
// ['{num} + 3', 334458],
393+
// ['{detail.more} + -4 / {detail.less}', 8],
394+
// ['{detail.others:0}', 1],
395+
// //comments
396+
// [`(15 - 2 * 4)
397+
// //test comment
398+
// //and again
399+
// + (1 + 1 / 4)`, 8.25],
400+
// //consolidate
401+
// ['"hi" & " there x" & 3 & true', 'hi there x3true'],
402+
// //logical
403+
// ['1 and true', true],
404+
// ['0 and true', false],
405+
// ['1 and false', false],
406+
// ['0 and false', false],
407+
// ['1 or true', true],
408+
// ['0 or true', true],
409+
// ['1 or false', true],
410+
// ['0 or false', false],
411+
// ['false AND true OR (true AND false)', false]
408412
];
409413
for (let t of tests) {
410-
it(`expression "${t[0]}" should evaluate to ${typeof t[1] === 'string' ? `"${t[1]}"` : t[1]} on sample.`, () => {
414+
it.only(`expression "${t[0]}" should evaluate to ${typeof t[1] === 'string' ? `"${t[1]}"` : t[1]} on sample.`, () => {
411415
// console.log(JSON.stringify(new CalcKu(t[0]).lexer(), null, 4));
412416
expect(new CalcKu(t[0]).value(sample)).toBe(t[1]);
413417
});
414418
}
419+
it('handles recursively referenced objects.', () => {
420+
let sample = {
421+
abc: 123
422+
};
423+
sample.zed = sample;
424+
expect(new CalcKu('{zed.zed.zed.zed.zed.zed.zed.abc} * 2').value(sample)).toBe(246);
425+
});
415426
});

0 commit comments

Comments
 (0)