Narcissistic Piano Mover

    yaml-cfn
    TypeScript icon, indicating that this package has built-in type declarations

    0.3.1 • Public • Published

    yaml-cfn

    CI npm version

    Parser and schema for CloudFormation YAML template tags.

    Implements support for AWS-specific CloudFormation YAML schema.

    The implementation and tests are based on the official AWS Python client aws-cli. It supports all intrinsic CloudFormation functions listed in AWS docs as of October 2017.

    Installation

    npm install --save-dev yaml-cfn

    Usage

    const { yamlParse, yamlDump } = require('yaml-cfn');
    
    const input = `
    Key:
      - !GetAtt Foo.Bar
      - !Equals [!Ref Baz, "hello"]
    `;
    
    const parsed = {
      "Key": [
        {"Fn::GetAtt": ["Foo", "Bar"]},
        {"Fn::Equals": [{"Ref": "Baz"}, "hello"]}
      ]
    };
    
    assert.deepEqual(yamlParse(input), parsed);
    assert.deepEqual(yamlParse(yamlDump(parsed)), parsed);

    The module uses js-yaml. The schema it uses is also exported, and may be used e.g. like so:

    const { schema } = require('yaml-cfn');
    const yaml = require('js-yaml');
    yaml.safeLoad(input, { schema: schema })

    Install

    npm i yaml-cfn

    DownloadsWeekly Downloads

    40,106

    Version

    0.3.1

    License

    Apache-2.0

    Unpacked Size

    21.6 kB

    Total Files

    11

    Last publish

    Collaborators

    • dsagal2