How to use the camaro.transform function in camaro

To help you get started, we’ve selected a few camaro 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 dsifford / academic-bloggers-toolkit / scripts / update-styles.ts View on Github external
async function parseCSL(
    filepath: string,
    isIndependent: boolean,
): Promise {
    const xml = await readfile(filepath, { encoding: 'utf-8' });
    const data: StyleQuery = await transform(xml, {
        kind: '/style/@class',
        hasBibliography: 'boolean(/style/bibliography)',
        parent: '/style/info/link[@rel="independent-parent"]/@href',
        title: '/style/info/title',
        shortTitle: '/style/info/title-short',
        updated: '/style/info/updated',
    });
    return data.kind === 'note' || (isIndependent && !data.hasBibliography)
        ? []
        : [
              {
                  kind: StyleKind.PREDEFINED,
                  value: path.basename(
                      isIndependent ? filepath : data.parent,
                      '.csl',
                  ),

camaro

Transforming XML to JSON using Node.js binding to native pugixml parser library

MIT
Latest version published 8 months ago

Package Health Score

64 / 100
Full package analysis

Popular camaro functions