WARNING: The [sjs-3] engine was deprecated, use [sjs-4] instead. See sjs-4: chainAttrStr.

File.prototype.chainAttrStr()

Get a string file attribute from the closest file on the type chain that defines it.

Syntax

file.chainAttrStr(key string) string

Parameters

key string

Name of the attribute.

Description

Get a string file attribute from the file or the closest file on its type chain that defines it.

Additionally, this method enforces that the attribute has the same type on all files of the type chain, or is undefined. In case there is a type conflict, an error is thrown.

Examples

The empty value for the type is returned when the attribute is not defined. (An empty string.)

When the attribute is defined, it is simply returned.

When the attribute is not defined on the file itself but it is defined on the file’s type chain, the first value found will be returned.

If the attribute is defined with a different type, an error is thrown.

If the attribute is defined as conflicting types on the file’s type chain, an error is thrown.