class-validator-extended icon indicating copy to clipboard operation
class-validator-extended copied to clipboard

Add mapIncludesKeys decorator

Open GFoniX opened this issue 1 year ago • 0 comments

Description

This contribution introduces a function to check if a given value is a Map and includes only the required keys without any additional ones. This ensures that the Map strictly conforms to the expected set of keys.

Motivation

In certain applications, it is crucial to validate that a Map contains precisely the set of keys that are expected, without any extraneous keys. This helps to maintain data integrity and ensures that the Map meets specific requirements.

Changes

  • Added a function to verify that a Map contains only the required keys.
  • The function will return true if the Map contains exactly the required keys and no others; otherwise, it will return false.

GFoniX avatar Jul 26 '24 09:07 GFoniX