in src/main/java/org/apache/sling/scripting/javascript/wrapper/ScriptableNode.java [90:100]
public Object jsFunction_addNode(String path, String primaryType) throws RepositoryException {
Node n = null;
if(primaryType == null || "undefined".equals(primaryType)) {
n = node.addNode(path);
} else {
n = node.addNode(path, primaryType);
}
final Object result = ScriptRuntime.toObject(this, n);
return result;
}