Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > IProtectableMapParameters > onSet

IProtectableMapParameters.onSet property

An optional hook that will be invoked before Map.set() is performed.


onSet?: (source: ProtectableMap<K, V>, key: K, value: V) => V;


If this hook is provided, the function MUST return the value parameter. This provides the opportunity to modify the value before it is added to the map.