UI for Zipcoin Blue

nan_define_own_property_helper.h 1.0KB

123456789101112131415161718192021222324252627282930
  1. /*********************************************************************
  2. * NAN - Native Abstractions for Node.js
  3. *
  4. * Copyright (c) 2018 NAN contributors
  5. *
  6. * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
  7. ********************************************************************/
  8. #ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_
  9. #define NAN_DEFINE_OWN_PROPERTY_HELPER_H_
  10. namespace imp {
  11. inline Maybe<bool> DefineOwnPropertyHelper(
  12. v8::PropertyAttribute current
  13. , v8::Handle<v8::Object> obj
  14. , v8::Handle<v8::String> key
  15. , v8::Handle<v8::Value> value
  16. , v8::PropertyAttribute attribs = v8::None) {
  17. return !(current & v8::DontDelete) || // configurable OR
  18. (!(current & v8::ReadOnly) && // writable AND
  19. !((attribs ^ current) & ~v8::ReadOnly)) // same excluding RO
  20. ? Just<bool>(obj->ForceSet(key, value, attribs))
  21. : Nothing<bool>();
  22. }
  23. } // end of namespace imp
  24. #endif // NAN_DEFINE_OWN_PROPERTY_HELPER_H_