how to document JS code or any other? [closed]

3

Friends, I've been looking for the correct way to document code but all the search engines throw me documentation generators, I really need to document correctly for other programmers a JS code that I have: for example.

    if (!Element.prototype.getCss || !window.getCss) {
        Element.prototype.getCss = function(hide) {
    //propDenied == 'none|align|animation|background|font|flood|flex|column|color|box|border|text|transform|transition|scroll|mask|margin|padding|max|min|list|fill|clip|grid|justify|stroke|outline|overflow|page|image|perspective|pointer|position|quotes|resize|ruby|stop|table|top|touch|vector|marker|backface|opacity|hyphens|float|empty|clear|content|counter|cursor|direction|filter|ime|isolation|letter|line|mix|object|order|height|visibility|white|width|word|writing';
    //valueDenied=='auto|none|top|inline|normal|""|rgb|padding|0%|0s|0px';
            let props = window.getComputedStyle(this);
            let propValueDenied = '""|^\-([a-z \-]+)$';
            if (!!hide) {
                if (/string/i.test(Object.prototype.toString.call(hide))) {
                    hide = hide.split(',');
                    hide.forEach(i => propValueDenied += '|${i.trim().toLowerCase()}');
                } else if (/array/i.test(Object.prototype.toString.call(hide))) {
                    hide.forEach(i => propValueDenied += '|${i.trim().toLowerCase()}');
                }
            }
            let result = {};
            let Getval = result.__proto__.getVal = function() {
                let val = String(this);
                if (/[px\s%]+/.test(val)) {
                    if (/[\s]+/.test(val)) {
                        val = val.split(/\D+/).filter(Boolean);
                        val.forEach((v, i) => val.splice(i, 1, parseFloat(v)));
                    } else {
                        val = parseFloat(val.replace(/[px\s%]+/, ''));
                    }
                }
                return val;
            }
            for (let i of props) {
                let propName = i;
                let propValue = props.getPropertyValue(propName);
                let cond1 = !RegExp('${propValueDenied}', 'i').test(propName);
                let cond2 = !RegExp('${propValueDenied}', 'i').test(propValue);
                if (cond1 && cond2) {
                    result[propName] = propValue;
                    result[propName].getVal = Getval;
                }
            }!/dims/.test(propValueDenied) ? result.dims = this.getBoundingClientRect() : result;
            return result;
        }
    }

//ejemplo: document.querySelector('elemento').getCss().heigth -> "80px" (String)
//ejemplo: document.querySelector('elemento').getCss().heigth.getVal() -> 80 (integer)

This is a function to obtain an object of all the properties and css values of a DOM element, but I do not know how to document it correctly without becoming "very informal" so to speak.

Do you have any tutorials or tools that can be used in this case for Javascript?

    
asked by Angel Zambrano 31.08.2018 в 01:30
source

0 answers