Sha256: 398a22dbe244f62354e8929b2f122c56d89a71a74c29f009ef01786e2c445336

Contents?: true

Size: 788 Bytes

Versions: 100

Compression:

Stored size: 788 Bytes

Contents

/*!
 * Chai - flag utility
 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
 * MIT Licensed
 */

/**
 * ### flag(object ,key, [value])
 *
 * Get or set a flag value on an object. If a
 * value is provided it will be set, else it will
 * return the currently set value or `undefined` if
 * the value is not set.
 *
 *     utils.flag(this, 'foo', 'bar'); // setter
 *     utils.flag(this, 'foo'); // getter, returns `bar`
 *
 * @param {Object} object (constructed Assertion
 * @param {String} key
 * @param {Mixed} value (optional)
 * @name flag
 * @api private
 */

module.exports = function (obj, key, value) {
  var flags = obj.__flags || (obj.__flags = Object.create(null));
  if (arguments.length === 3) {
    flags[key] = value;
  } else {
    return flags[key];
  }
};

Version data entries

100 entries across 68 versions & 1 rubygems

Version Path
ende-0.4.25 vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.25 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.24 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.24 vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.23 vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.23 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.5.1 components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.22 vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.22 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.21 vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.21 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.5.0 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.20 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.19 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.18 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.17 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.4.16 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.3.13 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.3.12 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js
ende-0.3.11 vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js