How to use common-tags - 10 common examples

To help you get started, we’ve selected a few common-tags 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 DefinitelyTyped / DefinitelyTyped / common-tags / common-tags-tests.ts View on Github external
new commonTags.TemplateTag({});

new commonTags.TemplateTag({
    onEndResult: endResult => `${endResult}!`
});

new commonTags.TemplateTag({
    onSubstitution: substitution => `${substitution}!`,
    onEndResult: endResult => `${endResult}!`
});

/* Tests Built-in Transformers */

new commonTags.TemplateTag(commonTags.trimResultTransformer());
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));

new commonTags.TemplateTag(commonTags.stripIndentTransformer());
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));

new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));

new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));

new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
github DefinitelyTyped / DefinitelyTyped / common-tags / common-tags-tests.ts View on Github external
});

new commonTags.TemplateTag({
    onSubstitution: substitution => `${substitution}!`,
    onEndResult: endResult => `${endResult}!`
});

/* Tests Built-in Transformers */

new commonTags.TemplateTag(commonTags.trimResultTransformer());
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));

new commonTags.TemplateTag(commonTags.stripIndentTransformer());
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));

new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));

new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));

new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
github DefinitelyTyped / DefinitelyTyped / common-tags / common-tags-tests.ts View on Github external
/* Tests Built-in Transformers */

new commonTags.TemplateTag(commonTags.trimResultTransformer());
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));

new commonTags.TemplateTag(commonTags.stripIndentTransformer());
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));

new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));

new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));

new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
github DefinitelyTyped / DefinitelyTyped / common-tags / common-tags-tests.ts View on Github external
new commonTags.TemplateTag({
    onSubstitution: substitution => `${substitution}!`,
    onEndResult: endResult => `${endResult}!`
});

/* Tests Built-in Transformers */

new commonTags.TemplateTag(commonTags.trimResultTransformer());
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));

new commonTags.TemplateTag(commonTags.stripIndentTransformer());
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));

new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));

new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));

new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
github salesforce / lwc / packages / @lwc / babel-plugin-component / src / __tests__ / utils / test-transform.js View on Github external
const transformTest = function(actual, expected) {
        if (expected.error) {
            let transformError;

            try {
                testTransform(actual);
            } catch (error) {
                transformError = error;
            }

            expect(transformError.toString()).toContain(expected.error.message);
            expect(transformError.loc).toEqual(expected.error.loc);
        } else if (expected.output) {
            const output = testTransform(actual);
            if (expected.output.code !== undefined) {
                const normalizedActual = output && output.code && stripIndents(output.code);
                const normalizedExpected = stripIndents(expected.output.code);

                if (normalizedActual !== normalizedExpected) {
                    // we should fail, but with style
                    expect(prettier.format(normalizedActual, { parser: 'babel' })).toBe(
                        prettier.format(normalizedExpected, { parser: 'babel' })
                    );
                } else {
                    expect(normalizedActual).toBe(normalizedExpected);
                }
            }
        } else {
            throw new TypeError(`Transform test expect an object with either error or output.`);
        }
    };
github salesforce / lwc / packages / @lwc / babel-plugin-component / src / __tests__ / utils / test-transform.js View on Github external
if (expected.error) {
            let transformError;

            try {
                testTransform(actual);
            } catch (error) {
                transformError = error;
            }

            expect(transformError.toString()).toContain(expected.error.message);
            expect(transformError.loc).toEqual(expected.error.loc);
        } else if (expected.output) {
            const output = testTransform(actual);
            if (expected.output.code !== undefined) {
                const normalizedActual = output && output.code && stripIndents(output.code);
                const normalizedExpected = stripIndents(expected.output.code);

                if (normalizedActual !== normalizedExpected) {
                    // we should fail, but with style
                    expect(prettier.format(normalizedActual, { parser: 'babel' })).toBe(
                        prettier.format(normalizedExpected, { parser: 'babel' })
                    );
                } else {
                    expect(normalizedActual).toBe(normalizedExpected);
                }
            }
        } else {
            throw new TypeError(`Transform test expect an object with either error or output.`);
        }
    };
github DefinitelyTyped / DefinitelyTyped / common-tags / common-tags-tests.ts View on Github external
onEndResult: endResult => `${endResult}!`
});

new commonTags.TemplateTag({
    onSubstitution: substitution => `${substitution}!`,
    onEndResult: endResult => `${endResult}!`
});

/* Tests Built-in Transformers */

new commonTags.TemplateTag(commonTags.trimResultTransformer());
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));

new commonTags.TemplateTag(commonTags.stripIndentTransformer());
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));

new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));

new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));

new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
github DefinitelyTyped / DefinitelyTyped / common-tags / common-tags-tests.ts View on Github external
new commonTags.TemplateTag({
    onEndResult: endResult => `${endResult}!`
});

new commonTags.TemplateTag({
    onSubstitution: substitution => `${substitution}!`,
    onEndResult: endResult => `${endResult}!`
});

/* Tests Built-in Transformers */

new commonTags.TemplateTag(commonTags.trimResultTransformer());
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));

new commonTags.TemplateTag(commonTags.stripIndentTransformer());
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));

new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));

new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));

new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
github DefinitelyTyped / DefinitelyTyped / common-tags / common-tags-tests.ts View on Github external
]);

new commonTags.TemplateTag({});

new commonTags.TemplateTag({
    onEndResult: endResult => `${endResult}!`
});

new commonTags.TemplateTag({
    onSubstitution: substitution => `${substitution}!`,
    onEndResult: endResult => `${endResult}!`
});

/* Tests Built-in Transformers */

new commonTags.TemplateTag(commonTags.trimResultTransformer());
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));

new commonTags.TemplateTag(commonTags.stripIndentTransformer());
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));

new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));

new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));

new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
github DefinitelyTyped / DefinitelyTyped / common-tags / common-tags-tests.ts View on Github external
new commonTags.TemplateTag({});

new commonTags.TemplateTag({
    onEndResult: endResult => `${endResult}!`
});

new commonTags.TemplateTag({
    onSubstitution: substitution => `${substitution}!`,
    onEndResult: endResult => `${endResult}!`
});

/* Tests Built-in Transformers */

new commonTags.TemplateTag(commonTags.trimResultTransformer());
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));

new commonTags.TemplateTag(commonTags.stripIndentTransformer());
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));

new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));

new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));

new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));