Package Exports
- serverless-plugin-utils
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-plugin-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
serverless-plugin-utils
A collection of serverless framework utilities
Installation
npm install -D serverless-plugin-utils
# or
yarn add -D serverless-plugin-utils
Usage
Add the serverless-plugin-utils entry to the plugins section of your serverless file.
plugins:
- serverless-plugin-utils
Utility Usage
Function | Description |
---|---|
fn::lower | Converts a string to its lowercase representation |
fn::upper | Converts a string to its uppercase representation |
fn::ternary | Performs equality check and returns a defined result |
fn::join | Joins a collection of values with a given delimiter |
fn::split | Splits a string value on a given delimiter |
Caveats
All operations are done after yaml has been processed. This mean certain operations cannot be done in-line.
Example:
something:
fn::join:
delimiter: '-'
values:
- one
- two
injected: ${opt:stage}${self:custom.something}
// Serverless Error ---------------------------------------
// Trying to populate non string value into a string for variable ${self:custom.something}. Please make sure the value of the property is a string.
To work around this fully use the utils option. The above can be reworked as the following.
injected:
fn::join:
delimiter: '-'
values:
- ${opt:stage}one
- two