Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1c663e3

Browse files
committed
small test for bug fix only for lib
1 parent d69ea3b commit 1c663e3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎src/test/index.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
interface Group {
2+
objectId: number;
3+
name: string;
4+
}
5+
6+
const test = function (group: Group[] | Group): string {
7+
const mapping: string[] = Object.keys(group);
8+
let query: string = '';
9+
if (mapping[0] === 'objectId') {
10+
query = `&objectId=${group[mapping[0]]}`;
11+
} else {
12+
let i: number = 0;
13+
while (i < mapping.length) {
14+
query += `$objectId=${group[i].objectId}`;
15+
i++;
16+
}
17+
}
18+
19+
return query;
20+
};
21+
22+
const arr = test([
23+
{ objectId: 1, name: 'test' },
24+
{ objectId: 2, name: 'test2' },
25+
]);
26+
const obj = test({ objectId: 1, name: 'test' });
27+
28+
console.log('_arr', arr);
29+
console.log('_obj', obj);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /