Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refac(purify): Add utils jsdoc & code consistency tasks #843

Merged
merged 3 commits into from Aug 3, 2023

Conversation

ssi02014
Copy link
Contributor

@ssi02014 ssi02014 commented Aug 3, 2023

Summary

Hello 馃憢 @cure53
This time I added the jsdoc of the utils functions.
I also worked on consistency in the code, similar to before.

Please review this pull request to see if it's appropriate. 馃檹

Tasks

  • Add jsdoc
  • Refactoring purify.js

@@ -195,7 +196,7 @@ function createDOMPurify(window = getGlobal()) {
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
*/
let CUSTOM_ELEMENT_HANDLING = Object.seal(
Object.create(null, {
create(null, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified to import and utilize the create function from utils.js

return fun.apply(thisValue, args);
};
}

Copy link
Contributor Author

@ssi02014 ssi02014 Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I placed it above construct (Reflect-related)

* @param {Function} func - The function to be wrapped and called.
* @returns {Function} A new function that applies the original function with provided thisArg and arguments.
*/
function unapply(func) {
return (thisArg, ...args) => apply(func, thisArg, args);
}
Copy link
Contributor Author

@ssi02014 ssi02014 Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from adding jsdoc, I moved export to the bottom.

@@ -9,12 +9,6 @@ const {
let { freeze, seal, create } = Object; // eslint-disable-line import/no-mutable-exports
Copy link
Contributor Author

@ssi02014 ssi02014 Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I exported the create here.

@cure53
Copy link
Owner

cure53 commented Aug 3, 2023

LGTM, thank you!

@cure53 cure53 merged commit d6a4c8f into cure53:main Aug 3, 2023
6 checks passed
@ssi02014 ssi02014 deleted the refac/purify branch August 4, 2023 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants