From df90a282fe46f2fec748050adcbfd51a1f144f02 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 7 May 2020 21:35:48 +0300 Subject: [PATCH] docs... Signed-off-by: Alex A. Naanou --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4b24edd..3c80941 100755 --- a/README.md +++ b/README.md @@ -281,22 +281,30 @@ var utilityMixin = { var Base = object.Constructor('Base') +// normal instance prototype chain: +// b -> Base.prototype -> .. +// +var b = Base() // mixin directly into the instance... -var m = object.mixin(Base(), utilityMixin) +// +// now the prototype chain looks like this: +// b -> mixinFlat({}, utilityMixin) -> Base.prototype -> .. +// +object.mixin(b, utilityMixin) ``` `.mixin(..)` will copy the contents of `utilityMixin` into the prototype -chain between `m` and `m.__proto__`. +chain between `b` and `b.__proto__`. We can also remove the mixin... ```javascript -m = o.mixout(m, utilityMixin) +o.mixout(b, utilityMixin) ``` -The mixed-in data is removed iff an object is found in the chain with the -same attributes as `utilityMixin` and with each attribute matching -identity with the corresponding attribute in the mixin. +The mixed-in data is removed iff a [matching](#match) object is found in +the chain with the same attributes as `utilityMixin` and with each +attribute matching identity with the corresponding attribute in the mixin. Constructor-based mixin...