How to access jcr resource property name using js
I have a requirement that there is property value textField how to get that vale using JS
This is the java code to fetch the textField value :
public String test() {
final Optional<Resource> testResource = Optional.ofNullable(this.getCurrentResource().getParent()).map(Resource::getParent);
final ValueMap valueMap = testResource.get().getValueMap();
if(valueMap.containsKey("textField")) {
return valueMap.get("textField", String.class);
}
return StringUtils.EMPTY;
}
I need same code in JS.
Please help me thanks in advance.