package.nan_define_own_property_helper.h Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nan Show documentation
Show all versions of nan Show documentation
Native Abstractions for Node.js: C++ header for Node 0.8 -> 18 compatibility
/*********************************************************************
* 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