More straight forward method to negate and boolify and support ! tags as a post process

I’ve been using a helper file for a while that defines some look up tables to help in the case where I need to evaluate environment variables as boolean that don’t already match up with how strToBool operates.

Example:

custom:
  helpers: ${file(./serverless.helpers.js):helpers}
  ...
  pythonRequirements:
    dockerizePip: ${self:custom.helpers.NEGATE_${self:custom.helpers.BOOL_${env:CI, 'false'}}}

Printed this looks like this:

custom:
  helpers:
    BOOL_0: false
    BOOL_1: true
    BOOL_True: true
    BOOL_TRUE: true
    BOOL_False: false
    BOOL_FALSE: false
    NEGATE_true: false
    NEGATE_false: true
  ...
  pythonRequirements:
    dockerizePip: true

I feel as though I may be missing something… are negates possible without a lookup? Is there a better way to evaluate truthy strings to a bool? Can I lowercase in order to use strToBool more appropriately?

Also !!int only works before processing the YML. Is there a way to escape this in a way so that !!int is run just before the final yaml dump? Right now I have to use a look up table like INT_1000: 1000 in order to properly type ints.

Thanks for any info.