Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
56a1e571
Commit
56a1e571
authored
Dec 15, 2022
by
Samir Sadyhov
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interpreter_library - add parseAsfTable
parent
7fa22411
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
interpreter/interpreter_library.js
interpreter/interpreter_library.js
+50
-0
No files found.
interpreter/interpreter_library.js
View file @
56a1e571
...
...
@@ -247,6 +247,56 @@ UTILS.getParams = function(str){
});
};
UTILS
.
parseAsfValue
=
function
(
asfDataValue
){
if
(
!
asfDataValue
)
return
null
;
if
(
asfDataValue
.
hasOwnProperty
(
'
key
'
))
{
return
{
type
:
asfDataValue
.
type
,
value
:
asfDataValue
.
value
||
''
,
key
:
asfDataValue
.
key
||
''
}
}
else
{
return
{
type
:
asfDataValue
.
type
,
value
:
asfDataValue
.
value
||
''
}
}
}
UTILS
.
parseAsfTable
=
function
(
asfTable
){
let
result
=
[];
try
{
if
(
!
asfTable
||
!
asfTable
.
hasOwnProperty
(
'
data
'
))
return
result
;
let
data
=
asfTable
.
data
.
filter
(
function
(
x
){
if
(
x
.
type
!=
'
label
'
)
return
x
;
});
if
(
!
data
.
length
)
return
result
;
let
tmpids
=
[];
data
.
forEach
(
function
(
x
){
tmpids
.
push
(
x
.
id
.
slice
(
0
,
x
.
id
.
indexOf
(
'
-b
'
)));
});
let
ids
=
tmpids
.
uniq
();
let
tbi
=
data
.
slice
(
-
1
)[
0
].
id
;
tbi
=
Number
(
tbi
.
slice
(
tbi
.
indexOf
(
'
-b
'
)
+
2
));
for
(
let
i
=
1
;
i
<=
tbi
;
i
++
)
{
let
item
=
{};
ids
.
forEach
(
function
(
id
){
let
cmpID
=
id
+
'
-b
'
+
i
;
let
parseValue
=
UTILS
.
parseAsfValue
(
UTILS
.
getValue
(
asfTable
,
cmpID
));
if
(
parseValue
)
item
[
id
]
=
parseValue
;
});
result
.
push
(
item
);
}
return
result
;
}
catch
(
err
)
{
return
result
;
}
}
//выпиливыние из массива повторяющихся елементов
Array
.
prototype
.
uniq
=
function
()
{
return
this
.
filter
(
function
(
v
,
i
,
a
){
return
i
==
a
.
indexOf
(
v
)
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment