Metadata
- Source
- FLUID-5933
- Type
- Bug
- Priority
- Major
- Status
- Open
- Resolution
- N/A
- Assignee
- Colin Clark
- Reporter
- Tony Atkins [RtF]
- Created
2016-07-21T06:25:45.378-0400 - Updated
2024-07-22T09:23:38.329-0400 - Versions
- N/A
- Fixed Versions
- N/A
- Component
-
- Model Transformation System
Description
In the wiki entry for fluid.transforms.literalValue
, we give an example of using input
as a fallback if there is no value found at inputPath
. This is not actually the case, at least not for literalValue
. For example, here is a wrapper around the actual example code:
/* eslint-env node */
"use strict";
var fluid = fluid || require("infusion");
var rules = {
"": {
transform: {
type: "fluid.transforms.literalValue",
input: "balloon",
inputPath: "some.path"
}
}
};
console.log("Empty Object Produces:");
console.log(fluid.model.transformWithRules({}, rules));
console.log("Non-empty Object Produces:");
console.log(fluid.model.transformWithRules({ some: { path: "*POP*"}}, rules));
That produces the following output:
Empty Object Produces:
balloon
Non-empty Object Produces:
balloon
The input
value always wins, which is not at all what the docs suggest. However, if we use fluid.transforms.value
instead of fluid.transforms.literalValue
, the results are as expected:
Empty Object Produces:
balloon
Non-empty Object Produces:
*POP*
The wording there specifically says "like all transforms", fluid.transforms.literalValue
will fallback, so if literalValue
is not meant to support this, the example should be moved under fluid.transforms.value
and the wording should be changed to "like most transforms" or something more accurate.