How to use the licia.extend function in licia

To help you get started, we’ve selected a few licia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github liriliri / licia / lib / update.js View on Github external
const regDependency = /\s*\b_\(\s*['"]([\w\s$]+)['"]\s*\);?/m;

    for (const file of files) {
        let modName = last(file.split('/')).slice(0, -3);

        const data = await fs.readFile(file, 'utf8');

        let desc = 'No description.';
        let comments = extractBlockCmts(data);

        if (comments.length > 0) {
            desc = trim(comments[0]).split('\n')[0];
        }

        let modInfo = extend(
            {
                description: desc,
                dependencies: extractDependencies(data)
            },
            extractCmts(comments)
        );
        output[modName] = modInfo;
    }

    function extractDependencies(data) {
        let dependencies = regDependency.exec(data);
        dependencies = dependencies ? trim(dependencies[1]).split(/\s+/) : [];

        return dependencies;
    }