Optimize NodeGit objects creation. by julianmesa-gitkraken · Pull Request #1924 · nodegit/nodegit
v8::Local<v8::Value> toJavascript() { v8::Local<v8::Value> toJavascript(v8::Local<v8::Function> GitCommitTemplate, v8::Local<v8::Function> GitRepositoryTemplate) { v8::Local<v8::Object> historyEntry = Nan::New<v8::Object>(); v8::Local<v8::Array> owners = Nan::New<Array>(0); Nan::Set( owners, Nan::New<v8::Number>(owners->Length()), Nan::To<v8::Object>(GitRepository::New( GitRepositoryTemplate, git_commit_owner(commit), true )).ToLocalChecked() ); Nan::Set(historyEntry, Nan::New("commit").ToLocalChecked(), GitCommit::New(commit, true, owners)); Nan::Set(historyEntry, Nan::New("commit").ToLocalChecked(), GitCommit::New(GitCommitTemplate, commit, true, owners)); commit = NULL; Nan::Set(historyEntry, Nan::New("status").ToLocalChecked(), Nan::New<Number>(type)); Nan::Set(historyEntry, Nan::New("isMergeCommit").ToLocalChecked(), Nan::New(isMergeCommit));