Create a new JavaScript object.

Equivalent to evaluating "new Object()".
@param scope the scope to search for the constructor and to evaluate
against
@return the new object
977253
public Scriptable newObject(Scriptable scope)
    {
        NativeObject result = new NativeObject();
        ScriptRuntime.setBuiltinProtoAndParent(result, scope,
                TopLevel.Builtins.Object);
        return result;
    }
261249
@Override
    public XValue call(Scope scope) {
        Elements context = new Elements();
        for (Element el:scope.context()){
            context.addAll(el.children());
            String  txt = el.ownText();
            if (StringUtils.isNotBlank(txt)){
                Element et = new Element("");
                et.appendText(txt);
                context.add(et);
            }
        }
        return XValue.create(context);
    }
901399
def in_scope(self, *args, **kw):
    
    new_self = self.copy()
    new_scopes = Object.translate_to_scopes(*args, **kw)
    new_self._scopes = new_self._scopes + new_scopes
    return new_self
1064162
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof Document)){
    return new Document(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(Document.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
744511
def scope= (new_scope)
      raise JSS::InvalidDataError, "JSS::Scopable::Scope instance required" unless new_criteria.kind_of?(JSS::Scopable::Scope)
      raise JSS::InvalidDataError, "Scope object must have target_key of :#{self.class::SCOPE_TARGET_KEY}" unless self.class::SCOPE_TARGET_KEY == new_scope.target_key
      @scope = new_scope
      @need_to_update = true
    end
481113
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof TextValue)){
    return new TextValue(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(TextValue.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
1118538
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof NamePart)){
    return new NamePart(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(NamePart.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
310620
@PostConstruct
    void init() {
        LOGGER.info("I'm being created: {}", this);
        setMargin(true);
        setSpacing(true);

        final Label label = new Label(String.format("This is a prototype scoped view. A new instance is created every time this view is shown. " +
                "This particular instance is <b>%s</b>. If you navigate away from this view and back, you'll notice that the instance changes every time.", this));
        label.setContentMode(ContentMode.HTML);
        addComponent(label);

        addComponent(new Button("Invoke a UI scoped business object", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                addComponent(new Label(uiScopedBusinessObject.sayHello()));
            }
        }));
    }
637805
public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj)
    {
        if (obj instanceof Scriptable) {
            return (Scriptable)obj;
        }
        Class<?> cls = obj.getClass();
        if (cls.isArray()) {
            return NativeJavaArray.wrap(scope, obj);
        }
        return wrapAsJavaObject(cx, scope, obj, null);
    }
913065
public ScriptEvaluator createObject(Tuple<ScriptEngine, String> key) {
        return new ScriptEvaluator(key.first, key.second);
    }
1219807
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof OnlineAccount)){
    return new OnlineAccount(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(OnlineAccount.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
1030612
function(json){
    
    // Protect against forgetting the new keyword when calling the constructor
    if(!(this instanceof Link)){
      return new Link(json);
    }
    
    // If the given object is already an instance then just return it. DON'T copy it.
    if(Link.isInstance(json)){
      return json;
    }
    
    // TODO: Enforce spec constraint that requires either an href or a template?
    
    this.init(json);
  }
1307265
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof Subject)){
    return new Subject(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(Subject.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
558790
@Override
  public <T> void inject(T obj, Scope scope) {
    Class<? super T> currentClass = (Class<T>) obj.getClass();
    do {
      MemberInjector<? super T> memberInjector = MemberInjectorLocator.getMemberInjector(currentClass);
      if (memberInjector != null) {
        memberInjector.inject(obj, scope);
        return;
      } else {
        currentClass = currentClass.getSuperclass();
      }
    } while (currentClass != null);
  }
573659
public <T> void newInstance(Local<T> target, MethodId<T, Void> constructor, Local<?>... args) {
        if (target == null) {
            throw new IllegalArgumentException();
        }
        addInstruction(new ThrowingCstInsn(Rops.NEW_INSTANCE, sourcePosition,
                RegisterSpecList.EMPTY, catches, constructor.declaringType.constant));
        moveResult(target, true);
        invokeDirect(constructor, null, target, args);
    }
961127
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof Fact)){
    return new Fact(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(Fact.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
876275
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof Note)){
    return new Note(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(Note.isInstance(json)){
    return json;
  }
  
  this.init(json);
}