Skip to content

Transform JSON into AWS SNS message attributes format

License

Notifications You must be signed in to change notification settings

shelfio/aws-sns-message-attributes

Repository files navigation

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