-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added hooking.js within the features
and assigned an id to each feature for future implementation of function hooking (sharing instantiated server > client and client > server objects). The hooking.js feature simply adds text before the file only if certain features match
- Loading branch information
Showing
11 changed files
with
74 additions
and
21 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
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,32 @@ | ||
let hooks = [] | ||
|
||
function AddHook(id, content) { // id can be an array with multiple valid id | ||
hooks.push({id: id, content: content+";"}) | ||
} | ||
|
||
function HookFunctionsOfMatched(body, matchedFeatures) { | ||
for (let matched of matchedFeatures) { | ||
for (let hook of hooks) { | ||
// Check if we need to skip the hook creation | ||
if (typeof hook.id == "string") { | ||
if (hook.id != matched) { | ||
continue | ||
} | ||
} else { | ||
let found = hook.id.some( id => { | ||
if (id == matched) return true | ||
}) | ||
|
||
if (found) { | ||
continue | ||
} | ||
} | ||
|
||
body = hook.content + body | ||
} | ||
} | ||
|
||
return body | ||
} | ||
|
||
export {AddHook, HookFunctionsOfMatched} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
let NotEqual = { | ||
id: "notEqual", | ||
from: "!=", | ||
to: "~=" | ||
} | ||
|
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
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