Skip to content

Commit

Permalink
chored: edited the rules
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsper2nd committed Apr 1, 2024
1 parent 31946e7 commit fa5accb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion generate/idcac/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,29 @@ func main() {
var commons, rules string
var javascriptFixes = make(map[int]string)

// err = jsonextract.Reader(strings.NewReader(string(rulesContent)), func(b []byte) error {
// var data map[string]interface{}
// if err := json.Unmarshal(b, &data); err != nil {
// return err
// }

err = jsonextract.Reader(strings.NewReader(string(rulesContent)), func(b []byte) error {
var data map[string]interface{}
var data []map[string]interface{}
if err := json.Unmarshal(b, &data); err != nil {
return err
}

for _, item := range data {
// Process each rule here
// Example:
if isRules(item) {
rules = string(b)
break // Assuming there's only one ruleset, you can adjust this logic if needed
}
}
return nil
})

if isCommons(data) {
commons = string(b)
} else if isRules(data) {
Expand Down

0 comments on commit fa5accb

Please sign in to comment.