"name" is a reserved property.
See original GitHub issueWhile trying to add a “meta” property parallel to value
named name
I was greeted to the full name of the token and not the value I placed there.
e.g.
{
"a": {
"b": {
"c": {
"value": "1",
"name": "ds"
}
}
},
"d": {
"e": {
"f": {
"value": "{a.b.c.name}"
}
}
}
}
tokens:
"a-b-c": "1",
"d-e-f": "a-b-c"
}
My use case:
declaration
const path = require("path");
module.exports = {
asset: {
font: {
"primary": {
value: path.resolve(
__dirname,
"path/to/font"
),
name: "Font-name",
"content-type": "application/x-font-woff",
charset: "utf-8",
format: "woff"
}
}
}
};
referencing
module.exports = {
font: {
family: {
primary: { value: '{asset.font.primary.name}, sans-serif' }
}
}
}
replacing name
with something else works.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Reserved Property Definition | Law Insider
Reserved Property means the Land beneath any mobile telephone switching office and other permanent structures (for the avoidance of doubt, other than a...
Read more >Solved: Naming a property with a reserved keyword for name
Solved: Hi all, I need to write a contract to act as a schema for the rest messages which a legacy system sends....
Read more >How do I use a C# reserve keyword as a property name - MSDN
according to situation i need to design a class where one property name has to be "return" but when i create a property...
Read more >javascript - Using reserved words as property names, revisited
In ECMAScript, starting from ES5, reserved words may be used as object property names "in the buff". This means that they don't need...
Read more >JavaScript Reserved Words - W3Schools
JavaScript Objects, Properties, and Methods ; Array, Date, eval ; hasOwnProperty, Infinity, isFinite ; isPrototypeOf, length, Math ; name, Number, Object ; String ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rjoaopereira my suggestion is not to mess too much with the expected format of the properties, but t confine all the meta-informations in just a few custom and very controlled fields.
For example, I would avoid this:
in favour of this:
The risk of conflict with reserved words and future extensions of the default attributes attached to a property is reduced, and also makes everything semantically more organised.
My 2 cents 😃
in general terms, we never mutate the actual values of value and name, and instead create new keys on the object with Symbol('name') and Symbol('value') and then reference those in the formats?
That would be the idea.
So if you supply a name, it will also always be in original
It’s good to know but I prefer to use another key. You never know when the inner workings will change.
I guess using Symbols would negate the need for that.
I believe so.