michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: var ERR_CONFLICT = "Remaining conflicting property: "; michael@0: var ERR_REQUIRED = "Missing required property: "; michael@0: michael@0: exports.Data = function Data(value, enumerable, configurable, writable) { michael@0: return ({ michael@0: value: value, michael@0: enumerable: enumerable !== false, michael@0: configurable: configurable !== false, michael@0: writable: writable !== false michael@0: }); michael@0: }; michael@0: michael@0: exports.Method = function Method(method, enumerable, configurable, writable) { michael@0: return ({ michael@0: value: method, michael@0: enumerable: enumerable !== false, michael@0: configurable: configurable !== false, michael@0: writable: writable !== false michael@0: }); michael@0: }; michael@0: michael@0: exports.Accessor = function Accessor(get, set, enumerable, configurable) { michael@0: return ({ michael@0: get: get, michael@0: set: set, michael@0: enumerable: enumerable !== false, michael@0: configurable: configurable !== false michael@0: }); michael@0: }; michael@0: michael@0: exports.Required = function Required(name) { michael@0: function required() { throw new Error(ERR_REQUIRED + name) } michael@0: michael@0: return ({ michael@0: get: required, michael@0: set: required, michael@0: required: true michael@0: }); michael@0: }; michael@0: michael@0: exports.Conflict = function Conflict(name) { michael@0: function conflict() { throw new Error(ERR_CONFLICT + name) } michael@0: michael@0: return ({ michael@0: get: conflict, michael@0: set: conflict, michael@0: conflict: true michael@0: }); michael@0: }; michael@0: