From d36fba8b0f1fcf61f84122842822c8a1b3206011 Mon Sep 17 00:00:00 2001 From: Paul Sheraton Date: Thu, 10 May 2018 14:59:54 -0700 Subject: [PATCH] Add info about salt's usage in percentSale --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eaae6fb..0a95759 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ Provided an object containing an "id" property, brie evaluates the presence of t `Always` asks brie to "always" respond with the given input. Why? Code consistency, mainly. #### percentScale(object, opts) +The `object.id` is used to calculate a percentage, modified by the salt value. If the resulting, salted, number is within range, returns true; otherwise false. + ``` opts = { percentMin:[0-1], @@ -67,9 +69,10 @@ Provided an object containing an "id" property, brie evaluates the presence of t testPhase:[string] } ``` -"testPhase" is used for logging and debugging only, and does not impact the algorithm. -The `object.id` is used to calculate a percentage, modified by the salt value. If the resulting, salted, number is within range, returns true; otherwise false. +`testPhase` is used for logging and debugging only, and does not impact the algorithm. + +`salt` is used to allow the same `id` to map to a different boolean amongst the feature flags. Thus you can have one flag with the `{ percentMin: 0, percentMax: 50, salt:0.5 }` return true, and another with `{ percentMin: 0, percentMax: 50, salt: 0.9 }` return false. Conversely you can tie together a booleans using the same salt. #### has(test data [object], comparison data [object]) The most complex criteria mechanism, `has` will evaluate the test data (first argument) against the trait, comparator and value provided in the second argument. If the test data has the trait and the associated value evaluates properly considering the comparison value, then true is returned.