Skip to content

Instantly share code, notes, and snippets.

@elubow
Forked from mraleph/gist:825124
Created February 13, 2011 21:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elubow/825135 to your computer and use it in GitHub Desktop.
Save elubow/825135 to your computer and use it in GitHub Desktop.
std::string tag_key, tag_value;
bool has_tags = false;
map<string,string> tags;
if (!args[1]->IsUndefined()) {
Local<Object> tagsObj = args[1]->ToObject();
Local<Array> tagNames = tagsObj->GetPropertyNames();
uint32_t length = tagNames->Length();
for (uint32_t i=0; i<length;i++) {
Local<String> v8TagKey = tagNames->Get(i)->ToString();
Local<String> v8TagValue = tagsObj->Get(v8TagKey)->ToString();
std::string tagKey(*String::AsciiValue(v8TagKey));
std::string tagValue(*String::AsciiValue(v8TagValue));
tags[tagKey] = tagValue;
}
has_tags = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment