index.js
function extractVariables(value) {
        let regex = [/var\((.*?)\)/g, /\$([a-zA-Z0-9_\-]*)/g ],
            result = [],
            matchResult;

        regex.forEach(expression => {
            while (matchResult = expression.exec(value)) {
                result.push({ origin: matchResult[0], variable: matchResult[1] });
            }
        });

        return result;
    }
function extractVariables(value) {
        let regex = [/var\((.*?)\)/g, /\$([a-zA-Z0-9_\-]*)/g ],
            result = [],
            matchResult;

        regex.forEach(expression => {
            while (matchResult = expression.exec(value)) {
                result.push({ origin: matchResult[0], variable: matchResult[1] });
            }
        });

        return result;
    }
function extractVariables ( value ) { let regex = [ / var\((.*?)\) / g , / \$([a-zA-Z0-9_\-]*) / g ] , result = [ ] , matchResult ; regex . forEach ( expression => { while ( matchResult = expression . exec ( value ) ) { result . push ( { origin : matchResult [ 0 ] , variable : matchResult [ 1 ] } ) ; } } ) ; return result ; }
Extract custom properties and sass like variables from value.
Return each found variable as array with objects.

@example 'test vars(--var1) + $width'
result in array with objects:
[{origin:'vars(--var1)', variable: '--var1'},{origin:'$width', variable: 'width'}]
@param value
@returns {Array}
Extract custom properties and sass like variables from value . Return each found variable as array with objects .