Skip to content

Commit 88dad11

Browse files
author
Isaac Wagner
committed
Cleaned up prototype property list
1 parent 3ec9e01 commit 88dad11

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/hashtable.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ void HashTable::init(Handle<Object> exports) {
88
Local<FunctionTemplate> constructor = FunctionTemplate::New(Constructor);
99
constructor->SetClassName(String::NewSymbol("HashTable"));
1010
constructor->InstanceTemplate()->SetInternalFieldCount(1);
11-
constructor->PrototypeTemplate()->Set(String::New("put"), FunctionTemplate::New(Put)->GetFunction());
12-
constructor->PrototypeTemplate()->Set(String::New("get"), FunctionTemplate::New(Get)->GetFunction());
13-
constructor->PrototypeTemplate()->Set(String::New("remove"), FunctionTemplate::New(Remove)->GetFunction());
14-
constructor->PrototypeTemplate()->Set(String::New("clear"), FunctionTemplate::New(Clear)->GetFunction());
15-
constructor->PrototypeTemplate()->Set(String::New("size"), FunctionTemplate::New(Size)->GetFunction());
16-
constructor->PrototypeTemplate()->Set(String::New("rehash"), FunctionTemplate::New(Rehash)->GetFunction());
17-
constructor->PrototypeTemplate()->Set(String::New("reserve"), FunctionTemplate::New(Reserve)->GetFunction());
18-
constructor->PrototypeTemplate()->Set(String::New("max_load_factor"), FunctionTemplate::New(MaxLoadFactor)->GetFunction());
11+
12+
auto prototype = constructor->PrototypeTemplate();
13+
prototype->Set("put", FunctionTemplate::New(Put)->GetFunction());
14+
prototype->Set("get", FunctionTemplate::New(Get)->GetFunction());
15+
prototype->Set("remove", FunctionTemplate::New(Remove)->GetFunction());
16+
prototype->Set("clear", FunctionTemplate::New(Clear)->GetFunction());
17+
prototype->Set("size", FunctionTemplate::New(Size)->GetFunction());
18+
prototype->Set("rehash", FunctionTemplate::New(Rehash)->GetFunction());
19+
prototype->Set("reserve", FunctionTemplate::New(Reserve)->GetFunction());
20+
prototype->Set("max_load_factor", FunctionTemplate::New(MaxLoadFactor)->GetFunction());
1921

2022
exports->Set(String::NewSymbol("HashTable"), Persistent<Function>::New(constructor->GetFunction()));
2123
}

0 commit comments

Comments
 (0)