3 var assign = require('es5-ext/object/assign')
4 , normalizeOpts = require('es5-ext/object/normalize-options')
5 , isCallable = require('es5-ext/object/is-callable')
6 , contains = require('es5-ext/string/#/contains')
10 d = module.exports = function (dscr, value/*, options*/) {
11 var c, e, w, options, desc;
12 if ((arguments.length < 2) || (typeof dscr !== 'string')) {
17 options = arguments[2];
23 c = contains.call(dscr, 'c');
24 e = contains.call(dscr, 'e');
25 w = contains.call(dscr, 'w');
28 desc = { value: value, configurable: c, enumerable: e, writable: w };
29 return !options ? desc : assign(normalizeOpts(options), desc);
32 d.gs = function (dscr, get, set/*, options*/) {
33 var c, e, options, desc;
34 if (typeof dscr !== 'string') {
40 options = arguments[3];
44 } else if (!isCallable(get)) {
46 get = set = undefined;
47 } else if (set == null) {
49 } else if (!isCallable(set)) {
57 c = contains.call(dscr, 'c');
58 e = contains.call(dscr, 'e');
61 desc = { get: get, set: set, configurable: c, enumerable: e };
62 return !options ? desc : assign(normalizeOpts(options), desc);