@shelf/aws-sns-message-attributes

Transform JSON into AWS SNS message attributes format

Usage no npm install needed!

<script type="module">
  import shelfAwsSnsMessageAttributes from 'https://cdn.skypack.dev/@shelf/aws-sns-message-attributes';
</script>

README

aws-sns-message-attributes CircleCI npm (scoped)

Transform JSON into AWS SNS message attributes format. See 1, 2

Install

$ yarn add @shelf/aws-sns-message-attributes

Usage

const {transformMessageAttributes} = require('@shelf/aws-sns-message-attributes');

transformMessageAttributes({
  string: 'hello',
  array: ['hello', 'world'],
  number: 1,
  bool: true,
});

/*
{
  string: {DataType: 'String', StringValue: 'hello'},
  array: {DataType: 'String.Array', StringValue: '["hello","world"]'},
  number: {DataType: 'Number', StringValue: 1},
  bool: {DataType: 'String', StringValue: 'true'},
}
 */

Note: This library does not support binary values

Publish

$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags

License

MIT © Shelf