Sha256: 1787aa876cc9eac0e063a040f9363a77c18f93e139a6620dad115e0fceaf342f

Contents?: true

Size: 1.45 KB

Versions: 47

Compression:

Stored size: 1.45 KB

Contents

'use strict';

var assign        = require('es5-ext/object/assign')
  , normalizeOpts = require('es5-ext/object/normalize-options')
  , isCallable    = require('es5-ext/object/is-callable')
  , contains      = require('es5-ext/string/#/contains')

  , d;

d = module.exports = function (dscr, value/*, options*/) {
	var c, e, w, options, desc;
	if ((arguments.length < 2) || (typeof dscr !== 'string')) {
		options = value;
		value = dscr;
		dscr = null;
	} else {
		options = arguments[2];
	}
	if (dscr == null) {
		c = w = true;
		e = false;
	} else {
		c = contains.call(dscr, 'c');
		e = contains.call(dscr, 'e');
		w = contains.call(dscr, 'w');
	}

	desc = { value: value, configurable: c, enumerable: e, writable: w };
	return !options ? desc : assign(normalizeOpts(options), desc);
};

d.gs = function (dscr, get, set/*, options*/) {
	var c, e, options, desc;
	if (typeof dscr !== 'string') {
		options = set;
		set = get;
		get = dscr;
		dscr = null;
	} else {
		options = arguments[3];
	}
	if (get == null) {
		get = undefined;
	} else if (!isCallable(get)) {
		options = get;
		get = set = undefined;
	} else if (set == null) {
		set = undefined;
	} else if (!isCallable(set)) {
		options = set;
		set = undefined;
	}
	if (dscr == null) {
		c = true;
		e = false;
	} else {
		c = contains.call(dscr, 'c');
		e = contains.call(dscr, 'e');
	}

	desc = { get: get, set: set, configurable: c, enumerable: e };
	return !options ? desc : assign(normalizeOpts(options), desc);
};

Version data entries

47 entries across 37 versions & 10 rubygems

Version Path
govuk_publishing_components-16.29.0 node_modules/d/index.js
govuk_publishing_components-16.28.0 node_modules/d/index.js
govuk_publishing_components-16.27.1 node_modules/d/index.js
govuk_publishing_components-16.27.0 node_modules/d/index.js
govuk_publishing_components-16.26.0 node_modules/d/index.js
govuk_publishing_components-16.25.0 node_modules/d/index.js
govuk_publishing_components-16.24.0 node_modules/d/index.js
govuk_publishing_components-16.23.0 node_modules/d/index.js
govuk_publishing_components-16.22.0 node_modules/d/index.js
govuk_publishing_components-16.21.0 node_modules/d/index.js
govuk_publishing_components-16.20.1 node_modules/d/index.js
govuk_publishing_components-16.20.0 node_modules/d/index.js
govuk_publishing_components-16.19.0 node_modules/d/index.js
govuk_publishing_components-16.18.0 node_modules/d/index.js
govuk_publishing_components-16.17.0 node_modules/d/index.js
optimacms-0.4.3 spec/dummy/node_modules/d/index.js
optimacms-0.4.2 spec/dummy/node_modules/d/index.js
cortex-0.1.3 spec/dummy/node_modules/d/index.js
guard-sass-lint-0.1.2 node_modules/d/index.js
guard-sass-lint-0.1.1 node_modules/d/index.js