Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nan_define_own_property_helper.h 1.0KB

1234567891011121314151617181920212223242526272829
  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_