Skip to content

Commit

Permalink
improve funcs descriptions and warning
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Jan 11, 2023
1 parent d620833 commit 68b112c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/scriptlets/set-constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,16 @@ export function setConstant(source, property, value, stack) {
};

/**
* Following code is scriptlet's core functionality
* that duplicates trusted-set-constant scriptlet
* Reorganizing this to common helpers will most definitely complicate debugging
*/

/**
* Safely (re-)sets property on a base object
* Safely sets property on a given object
*
* IMPORTANT! this duplicates corresponding func in trusted-set-constant scriptlet as
* reorganizing this to common helpers will most definitely complicate debugging
*
* @param {Object} base arbitrary reachable object
* @param {string} prop property name
* @param {boolean} configurable if set property should be configurable
* @param {Object} handler custom property descriptor object
* @returns {boolean} if prop was trapped successfully
* @returns {boolean} true if prop was trapped successfully
*/
const trapProp = (base, prop, configurable, handler) => {
if (!handler.init(base[prop])) {
Expand Down Expand Up @@ -215,6 +212,9 @@ export function setConstant(source, property, value, stack) {
* Chains that yet include non-object values (e.g null) are valid and will be
* traversed when appropriate chain member is set by an external script
*
* IMPORTANT! this duplicates corresponding func in trusted-set-constant scriptlet as
* reorganizing this to common helpers will most definitely complicate debugging
*
* @param {Object} owner object that owns chain
* @param {string} property chain of owner properties
*/
Expand Down
16 changes: 8 additions & 8 deletions src/scriptlets/trusted-set-constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,16 @@ export function trustedSetConstant(source, property, value, stack) {
};

/**
* Following code is scriptlet's core functionality
* that duplicates set-constant scriptlet
* Reorganizing this to common helpers will most definitely complicate debugging
*/

/**
* Safely (re-)sets property on a base object
* Safely sets property on a given object
*
* IMPORTANT! this duplicates corresponding func in set-constant scriptlet as
* reorganizing this to common helpers will most definitely complicate debugging
*
* @param {Object} base arbitrary reachable object
* @param {string} prop property name
* @param {boolean} configurable if set property should be configurable
* @param {Object} handler custom property descriptor object
* @returns {boolean} if prop was trapped successfully
* @returns {boolean} true if prop was trapped successfully
*/
const trapProp = (base, prop, configurable, handler) => {
if (!handler.init(base[prop])) {
Expand Down Expand Up @@ -162,6 +159,9 @@ export function trustedSetConstant(source, property, value, stack) {
* Chains that yet include non-object values (e.g null) are valid and will be
* traversed when appropriate chain member is set by an external script
*
* IMPORTANT! this duplicates corresponding func in set-constant scriptlet as
* reorganizing this to common helpers will most definitely complicate debugging
*
* @param {Object} owner object that owns chain
* @param {string} property chain of owner properties
*/
Expand Down

0 comments on commit 68b112c

Please sign in to comment.