All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.nan_define_own_property_helper.h Maven / Gradle / Ivy

Go to download

Native Abstractions for Node.js: C++ header for Node 0.8 -> 18 compatibility

There is a newer version: 2.19.0
Show newest version
/*********************************************************************
 * NAN - Native Abstractions for Node.js
 *
 * Copyright (c) 2018 NAN contributors
 *
 * MIT License 
 ********************************************************************/

#ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_
#define NAN_DEFINE_OWN_PROPERTY_HELPER_H_

namespace imp {

inline Maybe DefineOwnPropertyHelper(
    v8::PropertyAttribute current
  , v8::Handle obj
  , v8::Handle key
  , v8::Handle value
  , v8::PropertyAttribute attribs = v8::None) {
  return !(current & v8::DontDelete) ||                     // configurable OR
                  (!(current & v8::ReadOnly) &&             // writable AND
                   !((attribs ^ current) & ~v8::ReadOnly))  // same excluding RO
             ? Just(obj->ForceSet(key, value, attribs))
             : Nothing();
}

}  // end of namespace imp

#endif  // NAN_DEFINE_OWN_PROPERTY_HELPER_H_




© 2015 - 2024 Weber Informatics LLC | Privacy Policy