-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(optim): migrate the publiopti source code inside the model repo
- Loading branch information
1 parent
9834282
commit b8c6f3f
Showing
6 changed files
with
1,143 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { RuleNode } from "publicodes"; | ||
import RawPublicodes from "publicodes"; | ||
|
||
export type RuleName = string; | ||
export type ParsedRules = Record<RuleName, RuleNode<RuleName>>; | ||
export type RawRules = RawPublicodes<RuleName>; | ||
|
||
export function getRawNodes(parsedRules: ParsedRules): RawRules { | ||
return Object.fromEntries( | ||
Object.values(parsedRules).reduce((acc: any, rule) => { | ||
const { nom, ...rawNode } = rule.rawNode; | ||
acc.push([nom, rawNode]); | ||
return acc; | ||
}, []) | ||
) as RawRules; | ||
} | ||
|
||
function consumeMsg(_: string): void {} | ||
|
||
export const disabledLogger = { | ||
log: consumeMsg, | ||
warn: consumeMsg, | ||
error: consumeMsg, | ||
}; |
Oops, something went wrong.