ende 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assets/javascripts/aura/extensions/devise.js.coffee +0 -2
  3. data/lib/assets/javascripts/aura/extensions/platform.js.coffee +3 -0
  4. data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +17 -1
  5. data/lib/assets/javascripts/aura/extensions/routes.js.coffee +8 -7
  6. data/lib/assets/javascripts/aura/extensions/states.js.coffee +13 -1
  7. data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +4 -2
  8. data/lib/assets/javascripts/config/load_components.js.coffee +19 -12
  9. data/lib/assets/javascripts/ende.js.coffee +33 -12
  10. data/lib/ende/version.rb +1 -1
  11. data/vendor/assets/components/build.css +111 -0
  12. data/vendor/assets/components/ende_build.js +160 -41
  13. data/vendor/components/indefinido-indemma/build/development.js +3 -118
  14. data/vendor/components/indefinido-indemma/build/release.js +39 -4170
  15. data/vendor/components/indefinido-indemma/build/test.js +3 -118
  16. data/vendor/components/indefinido-indemma/lib/record/associable.js +10 -2
  17. data/vendor/components/indefinido-indemma/lib/record/restfulable.js +26 -15
  18. data/vendor/components/indefinido-indemma/lib/record.js +3 -1
  19. data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +15 -1
  20. data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +37 -12
  21. data/vendor/components/indefinido-indemma/src/lib/record.coffee +3 -1
  22. data/vendor/components/indefinido-observable/.gitignore +15 -0
  23. data/vendor/components/indefinido-observable/.ruby-gemset +1 -0
  24. data/vendor/components/indefinido-observable/.ruby-version +1 -0
  25. data/vendor/components/indefinido-observable/Gemfile +13 -0
  26. data/vendor/components/indefinido-observable/Guardfile +39 -0
  27. data/vendor/components/indefinido-observable/History.md +0 -0
  28. data/vendor/components/indefinido-observable/Readme.md +116 -0
  29. data/vendor/components/indefinido-observable/build/build.js +14798 -0
  30. data/vendor/components/indefinido-observable/build/development.js +339 -0
  31. data/vendor/components/indefinido-observable/build/release.js +14937 -0
  32. data/vendor/components/indefinido-observable/build/test.js +339 -0
  33. data/vendor/components/indefinido-observable/component.json +5 -1
  34. data/vendor/components/indefinido-observable/components/chaijs-chai/component.json +46 -0
  35. data/vendor/components/indefinido-observable/components/chaijs-chai/index.js +1 -0
  36. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/assertion.js +132 -0
  37. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
  38. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/error.js +60 -0
  39. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/assert.js +1060 -0
  40. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
  41. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/should.js +76 -0
  42. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
  43. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
  44. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
  45. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/eql.js +124 -0
  46. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
  47. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
  48. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
  49. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
  50. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
  51. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
  52. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
  53. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/index.js +108 -0
  54. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/inspect.js +316 -0
  55. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
  56. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
  57. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
  58. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/test.js +26 -0
  59. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
  60. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/type.js +45 -0
  61. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai.js +79 -0
  62. data/vendor/components/indefinido-observable/components/component-jquery/component.json +14 -0
  63. data/vendor/components/indefinido-observable/components/component-jquery/index.js +9601 -0
  64. data/vendor/components/indefinido-observable/components/kapit-observe-shim/component.json +11 -0
  65. data/vendor/components/indefinido-observable/components/kapit-observe-utils/component.json +13 -0
  66. data/vendor/components/indefinido-observable/karma.conf.js +92 -0
  67. data/vendor/components/indefinido-observable/lib/adapters/rivets.js +3 -1
  68. data/vendor/components/indefinido-observable/lib/observable.js +47 -13
  69. data/vendor/components/indefinido-observable/spec/legacy/observable_spec.js +126 -0
  70. data/vendor/components/indefinido-observable/spec/observable_spec.js +92 -0
  71. data/vendor/components/indefinido-observable/spec/spec_helper.js +8 -0
  72. data/vendor/components/indefinido-observable/spec/vendor/accessors_spec.js +63 -0
  73. data/vendor/components/indefinido-observable/src/lib/adapters/rivets.js.coffee +15 -0
  74. data/vendor/components/indefinido-observable/src/spec/legacy/observable_spec.coffee +132 -0
  75. data/vendor/components/indefinido-observable/src/spec/observable_spec.coffee +85 -0
  76. data/vendor/components/indefinido-observable/src/spec/spec_helper.coffee +5 -0
  77. data/vendor/components/indefinido-observable/src/spec/vendor/accessors_spec.coffee +59 -0
  78. data/vendor/components/indefinido-observable/vendor/shims/accessors.js +71 -9
  79. data/vendor/components/indefinido-observable/vendor/spec/boot.js +104 -0
  80. data/vendor/components/indefinido-observable/vendor/spec/jasmine.js +2054 -0
  81. metadata +58 -2
@@ -238,87 +238,6 @@ require.register("indefinido-advisable/index.js", Function("exports, require, mo
238
238
  require.register("indefinido-advisable/lib/advisable.js", Function("exports, require, module",
239
239
  "var $, advice, mixin;\n\n$ = require('jquery');\n\nadvice = {\n around: function(base, wrapped) {\n return function() {\n var args;\n\n args = $.makeArray(arguments);\n return wrapped.apply(this, [$.proxy(base, this)].concat(args));\n };\n },\n before: function(base, before) {\n return this.around(base, function() {\n var args, orig;\n\n args = $.makeArray(arguments);\n orig = args.shift();\n before.apply(this, args);\n return orig.apply(this, args);\n });\n },\n after: function(base, after) {\n return this.around(base, function() {\n var args, orig, res;\n\n args = $.makeArray(arguments);\n orig = args.shift();\n res = orig.apply(this, args);\n after.apply(this, args);\n return res;\n });\n }\n};\n\nmixin = {\n before: function(method, advicer) {\n if (typeof this[method] === 'function') {\n return this[method] = advice.before(this[method], advicer);\n }\n throw new TypeError(\"Can only advice functions, attribute \" + method + \" of \" + this + \" is of type \" + (typeof this[method]));\n },\n after: function(method, advicer) {\n if (typeof this[method] === 'function') {\n return this[method] = advice.after(this[method], advicer);\n }\n throw new TypeError(\"Can only advice functions, attribute \" + method + \" of \" + this + \" is of type \" + (typeof this[method]));\n },\n around: function(method, advicer) {\n if (typeof this[method] === 'function') {\n return this[method] = advice.around(this[method], advicer);\n }\n throw new TypeError(\"Can only advice functions, attribute \" + method + \" of \" + this + \" is of type \" + (typeof this[method]));\n }\n};\n\nexports.mixin = function(object) {\n return $.extend(object, mixin);\n};\n//@ sourceURL=indefinido-advisable/lib/advisable.js"
240
240
  ));
241
- require.register("chaijs-assertion-error/index.js", Function("exports, require, module",
242
- "/*!\n * assertion-error\n * Copyright(c) 2013 Jake Luer <jake@qualiancy.com>\n * MIT Licensed\n */\n\n/*!\n * Return a function that will copy properties from\n * one object to another excluding any originally\n * listed. Returned function will create a new `{}`.\n *\n * @param {String} excluded properties ...\n * @return {Function}\n */\n\nfunction exclude () {\n var excludes = [].slice.call(arguments);\n\n function excludeProps (res, obj) {\n Object.keys(obj).forEach(function (key) {\n if (!~excludes.indexOf(key)) res[key] = obj[key];\n });\n }\n\n return function extendExclude () {\n var args = [].slice.call(arguments)\n , i = 0\n , res = {};\n\n for (; i < args.length; i++) {\n excludeProps(res, args[i]);\n }\n\n return res;\n };\n};\n\n/*!\n * Primary Exports\n */\n\nmodule.exports = AssertionError;\n\n/**\n * ### AssertionError\n *\n * An extension of the JavaScript `Error` constructor for\n * assertion and validation scenarios.\n *\n * @param {String} message\n * @param {Object} properties to include (optional)\n * @param {callee} start stack function (optional)\n */\n\nfunction AssertionError (message, _props, ssf) {\n var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')\n , props = extend(_props || {});\n\n // default values\n this.message = message || 'Unspecified AssertionError';\n this.showDiff = false;\n\n // copy from properties\n for (var key in props) {\n this[key] = props[key];\n }\n\n // capture stack trace\n ssf = ssf || arguments.callee;\n if (ssf && Error.captureStackTrace) {\n Error.captureStackTrace(this, ssf);\n }\n}\n\n/*!\n * Inherit from Error.prototype\n */\n\nAssertionError.prototype = Object.create(Error.prototype);\n\n/*!\n * Statically set name\n */\n\nAssertionError.prototype.name = 'AssertionError';\n\n/*!\n * Ensure correct constructor\n */\n\nAssertionError.prototype.constructor = AssertionError;\n\n/**\n * Allow errors to be converted to JSON for static transfer.\n *\n * @param {Boolean} include stack (default: `true`)\n * @return {Object} object that can be `JSON.stringify`\n */\n\nAssertionError.prototype.toJSON = function (stack) {\n var extend = exclude('constructor', 'toJSON', 'stack')\n , props = extend({ name: this.name }, this);\n\n // include stack if exists and not turned off\n if (false !== stack && this.stack) {\n props.stack = this.stack;\n }\n\n return props;\n};\n//@ sourceURL=chaijs-assertion-error/index.js"
243
- ));
244
- require.register("chaijs-chai/index.js", Function("exports, require, module",
245
- "module.exports = require('./lib/chai');\n//@ sourceURL=chaijs-chai/index.js"
246
- ));
247
- require.register("chaijs-chai/lib/chai.js", Function("exports, require, module",
248
- "/*!\n * chai\n * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar used = []\n , exports = module.exports = {};\n\n/*!\n * Chai version\n */\n\nexports.version = '1.7.2';\n\n/*!\n * Assertion Error\n */\n\nexports.AssertionError = require('assertion-error');\n\n/*!\n * Utils for plugins (not exported)\n */\n\nvar util = require('./chai/utils');\n\n/**\n * # .use(function)\n *\n * Provides a way to extend the internals of Chai\n *\n * @param {Function}\n * @returns {this} for chaining\n * @api public\n */\n\nexports.use = function (fn) {\n if (!~used.indexOf(fn)) {\n fn(this, util);\n used.push(fn);\n }\n\n return this;\n};\n\n/*!\n * Primary `Assertion` prototype\n */\n\nvar assertion = require('./chai/assertion');\nexports.use(assertion);\n\n/*!\n * Core Assertions\n */\n\nvar core = require('./chai/core/assertions');\nexports.use(core);\n\n/*!\n * Expect interface\n */\n\nvar expect = require('./chai/interface/expect');\nexports.use(expect);\n\n/*!\n * Should interface\n */\n\nvar should = require('./chai/interface/should');\nexports.use(should);\n\n/*!\n * Assert interface\n */\n\nvar assert = require('./chai/interface/assert');\nexports.use(assert);\n//@ sourceURL=chaijs-chai/lib/chai.js"
249
- ));
250
- require.register("chaijs-chai/lib/chai/assertion.js", Function("exports, require, module",
251
- "/*!\n * chai\n * http://chaijs.com\n * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nmodule.exports = function (_chai, util) {\n /*!\n * Module dependencies.\n */\n\n var AssertionError = _chai.AssertionError\n , flag = util.flag;\n\n /*!\n * Module export.\n */\n\n _chai.Assertion = Assertion;\n\n /*!\n * Assertion Constructor\n *\n * Creates object for chaining.\n *\n * @api private\n */\n\n function Assertion (obj, msg, stack) {\n flag(this, 'ssfi', stack || arguments.callee);\n flag(this, 'object', obj);\n flag(this, 'message', msg);\n }\n\n /*!\n * ### Assertion.includeStack\n *\n * User configurable property, influences whether stack trace\n * is included in Assertion error message. Default of false\n * suppresses stack trace in the error message\n *\n * Assertion.includeStack = true; // enable stack on error\n *\n * @api public\n */\n\n Assertion.includeStack = false;\n\n /*!\n * ### Assertion.showDiff\n *\n * User configurable property, influences whether or not\n * the `showDiff` flag should be included in the thrown\n * AssertionErrors. `false` will always be `false`; `true`\n * will be true when the assertion has requested a diff\n * be shown.\n *\n * @api public\n */\n\n Assertion.showDiff = true;\n\n Assertion.addProperty = function (name, fn) {\n util.addProperty(this.prototype, name, fn);\n };\n\n Assertion.addMethod = function (name, fn) {\n util.addMethod(this.prototype, name, fn);\n };\n\n Assertion.addChainableMethod = function (name, fn, chainingBehavior) {\n util.addChainableMethod(this.prototype, name, fn, chainingBehavior);\n };\n\n Assertion.overwriteProperty = function (name, fn) {\n util.overwriteProperty(this.prototype, name, fn);\n };\n\n Assertion.overwriteMethod = function (name, fn) {\n util.overwriteMethod(this.prototype, name, fn);\n };\n\n /*!\n * ### .assert(expression, message, negateMessage, expected, actual)\n *\n * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.\n *\n * @name assert\n * @param {Philosophical} expression to be tested\n * @param {String} message to display if fails\n * @param {String} negatedMessage to display if negated expression fails\n * @param {Mixed} expected value (remember to check for negation)\n * @param {Mixed} actual (optional) will default to `this.obj`\n * @api private\n */\n\n Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {\n var ok = util.test(this, arguments);\n if (true !== showDiff) showDiff = false;\n if (true !== Assertion.showDiff) showDiff = false;\n\n if (!ok) {\n var msg = util.getMessage(this, arguments)\n , actual = util.getActual(this, arguments);\n throw new AssertionError(msg, {\n actual: actual\n , expected: expected\n , showDiff: showDiff\n }, (Assertion.includeStack) ? this.assert : flag(this, 'ssfi'));\n }\n };\n\n /*!\n * ### ._obj\n *\n * Quick reference to stored `actual` value for plugin developers.\n *\n * @api private\n */\n\n Object.defineProperty(Assertion.prototype, '_obj',\n { get: function () {\n return flag(this, 'object');\n }\n , set: function (val) {\n flag(this, 'object', val);\n }\n });\n};\n//@ sourceURL=chaijs-chai/lib/chai/assertion.js"
252
- ));
253
- require.register("chaijs-chai/lib/chai/core/assertions.js", Function("exports, require, module",
254
- "/*!\n * chai\n * http://chaijs.com\n * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nmodule.exports = function (chai, _) {\n var Assertion = chai.Assertion\n , toString = Object.prototype.toString\n , flag = _.flag;\n\n /**\n * ### Language Chains\n *\n * The following are provide as chainable getters to\n * improve the readability of your assertions. They\n * do not provide an testing capability unless they\n * have been overwritten by a plugin.\n *\n * **Chains**\n *\n * - to\n * - be\n * - been\n * - is\n * - that\n * - and\n * - have\n * - with\n * - at\n * - of\n * - same\n *\n * @name language chains\n * @api public\n */\n\n [ 'to', 'be', 'been'\n , 'is', 'and', 'have'\n , 'with', 'that', 'at'\n , 'of', 'same' ].forEach(function (chain) {\n Assertion.addProperty(chain, function () {\n return this;\n });\n });\n\n /**\n * ### .not\n *\n * Negates any of assertions following in the chain.\n *\n * expect(foo).to.not.equal('bar');\n * expect(goodFn).to.not.throw(Error);\n * expect({ foo: 'baz' }).to.have.property('foo')\n * .and.not.equal('bar');\n *\n * @name not\n * @api public\n */\n\n Assertion.addProperty('not', function () {\n flag(this, 'negate', true);\n });\n\n /**\n * ### .deep\n *\n * Sets the `deep` flag, later used by the `equal` and\n * `property` assertions.\n *\n * expect(foo).to.deep.equal({ bar: 'baz' });\n * expect({ foo: { bar: { baz: 'quux' } } })\n * .to.have.deep.property('foo.bar.baz', 'quux');\n *\n * @name deep\n * @api public\n */\n\n Assertion.addProperty('deep', function () {\n flag(this, 'deep', true);\n });\n\n /**\n * ### .a(type)\n *\n * The `a` and `an` assertions are aliases that can be\n * used either as language chains or to assert a value's\n * type.\n *\n * // typeof\n * expect('test').to.be.a('string');\n * expect({ foo: 'bar' }).to.be.an('object');\n * expect(null).to.be.a('null');\n * expect(undefined).to.be.an('undefined');\n *\n * // language chain\n * expect(foo).to.be.an.instanceof(Foo);\n *\n * @name a\n * @alias an\n * @param {String} type\n * @param {String} message _optional_\n * @api public\n */\n\n function an (type, msg) {\n if (msg) flag(this, 'message', msg);\n type = type.toLowerCase();\n var obj = flag(this, 'object')\n , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a ';\n\n this.assert(\n type === _.type(obj)\n , 'expected #{this} to be ' + article + type\n , 'expected #{this} not to be ' + article + type\n );\n }\n\n Assertion.addChainableMethod('an', an);\n Assertion.addChainableMethod('a', an);\n\n /**\n * ### .include(value)\n *\n * The `include` and `contain` assertions can be used as either property\n * based language chains or as methods to assert the inclusion of an object\n * in an array or a substring in a string. When used as language chains,\n * they toggle the `contain` flag for the `keys` assertion.\n *\n * expect([1,2,3]).to.include(2);\n * expect('foobar').to.contain('foo');\n * expect({ foo: 'bar', hello: 'universe' }).to.include.keys('foo');\n *\n * @name include\n * @alias contain\n * @param {Object|String|Number} obj\n * @param {String} message _optional_\n * @api public\n */\n\n function includeChainingBehavior () {\n flag(this, 'contains', true);\n }\n\n function include (val, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n this.assert(\n ~obj.indexOf(val)\n , 'expected #{this} to include ' + _.inspect(val)\n , 'expected #{this} to not include ' + _.inspect(val));\n }\n\n Assertion.addChainableMethod('include', include, includeChainingBehavior);\n Assertion.addChainableMethod('contain', include, includeChainingBehavior);\n\n /**\n * ### .ok\n *\n * Asserts that the target is truthy.\n *\n * expect('everthing').to.be.ok;\n * expect(1).to.be.ok;\n * expect(false).to.not.be.ok;\n * expect(undefined).to.not.be.ok;\n * expect(null).to.not.be.ok;\n *\n * @name ok\n * @api public\n */\n\n Assertion.addProperty('ok', function () {\n this.assert(\n flag(this, 'object')\n , 'expected #{this} to be truthy'\n , 'expected #{this} to be falsy');\n });\n\n /**\n * ### .true\n *\n * Asserts that the target is `true`.\n *\n * expect(true).to.be.true;\n * expect(1).to.not.be.true;\n *\n * @name true\n * @api public\n */\n\n Assertion.addProperty('true', function () {\n this.assert(\n true === flag(this, 'object')\n , 'expected #{this} to be true'\n , 'expected #{this} to be false'\n , this.negate ? false : true\n );\n });\n\n /**\n * ### .false\n *\n * Asserts that the target is `false`.\n *\n * expect(false).to.be.false;\n * expect(0).to.not.be.false;\n *\n * @name false\n * @api public\n */\n\n Assertion.addProperty('false', function () {\n this.assert(\n false === flag(this, 'object')\n , 'expected #{this} to be false'\n , 'expected #{this} to be true'\n , this.negate ? true : false\n );\n });\n\n /**\n * ### .null\n *\n * Asserts that the target is `null`.\n *\n * expect(null).to.be.null;\n * expect(undefined).not.to.be.null;\n *\n * @name null\n * @api public\n */\n\n Assertion.addProperty('null', function () {\n this.assert(\n null === flag(this, 'object')\n , 'expected #{this} to be null'\n , 'expected #{this} not to be null'\n );\n });\n\n /**\n * ### .undefined\n *\n * Asserts that the target is `undefined`.\n *\n * expect(undefined).to.be.undefined;\n * expect(null).to.not.be.undefined;\n *\n * @name undefined\n * @api public\n */\n\n Assertion.addProperty('undefined', function () {\n this.assert(\n undefined === flag(this, 'object')\n , 'expected #{this} to be undefined'\n , 'expected #{this} not to be undefined'\n );\n });\n\n /**\n * ### .exist\n *\n * Asserts that the target is neither `null` nor `undefined`.\n *\n * var foo = 'hi'\n * , bar = null\n * , baz;\n *\n * expect(foo).to.exist;\n * expect(bar).to.not.exist;\n * expect(baz).to.not.exist;\n *\n * @name exist\n * @api public\n */\n\n Assertion.addProperty('exist', function () {\n this.assert(\n null != flag(this, 'object')\n , 'expected #{this} to exist'\n , 'expected #{this} to not exist'\n );\n });\n\n\n /**\n * ### .empty\n *\n * Asserts that the target's length is `0`. For arrays, it checks\n * the `length` property. For objects, it gets the count of\n * enumerable keys.\n *\n * expect([]).to.be.empty;\n * expect('').to.be.empty;\n * expect({}).to.be.empty;\n *\n * @name empty\n * @api public\n */\n\n Assertion.addProperty('empty', function () {\n var obj = flag(this, 'object')\n , expected = obj;\n\n if (Array.isArray(obj) || 'string' === typeof object) {\n expected = obj.length;\n } else if (typeof obj === 'object') {\n expected = Object.keys(obj).length;\n }\n\n this.assert(\n !expected\n , 'expected #{this} to be empty'\n , 'expected #{this} not to be empty'\n );\n });\n\n /**\n * ### .arguments\n *\n * Asserts that the target is an arguments object.\n *\n * function test () {\n * expect(arguments).to.be.arguments;\n * }\n *\n * @name arguments\n * @alias Arguments\n * @api public\n */\n\n function checkArguments () {\n var obj = flag(this, 'object')\n , type = Object.prototype.toString.call(obj);\n this.assert(\n '[object Arguments]' === type\n , 'expected #{this} to be arguments but got ' + type\n , 'expected #{this} to not be arguments'\n );\n }\n\n Assertion.addProperty('arguments', checkArguments);\n Assertion.addProperty('Arguments', checkArguments);\n\n /**\n * ### .equal(value)\n *\n * Asserts that the target is strictly equal (`===`) to `value`.\n * Alternately, if the `deep` flag is set, asserts that\n * the target is deeply equal to `value`.\n *\n * expect('hello').to.equal('hello');\n * expect(42).to.equal(42);\n * expect(1).to.not.equal(true);\n * expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' });\n * expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });\n *\n * @name equal\n * @alias equals\n * @alias eq\n * @alias deep.equal\n * @param {Mixed} value\n * @param {String} message _optional_\n * @api public\n */\n\n function assertEqual (val, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n if (flag(this, 'deep')) {\n return this.eql(val);\n } else {\n this.assert(\n val === obj\n , 'expected #{this} to equal #{exp}'\n , 'expected #{this} to not equal #{exp}'\n , val\n , this._obj\n , true\n );\n }\n }\n\n Assertion.addMethod('equal', assertEqual);\n Assertion.addMethod('equals', assertEqual);\n Assertion.addMethod('eq', assertEqual);\n\n /**\n * ### .eql(value)\n *\n * Asserts that the target is deeply equal to `value`.\n *\n * expect({ foo: 'bar' }).to.eql({ foo: 'bar' });\n * expect([ 1, 2, 3 ]).to.eql([ 1, 2, 3 ]);\n *\n * @name eql\n * @alias eqls\n * @param {Mixed} value\n * @param {String} message _optional_\n * @api public\n */\n\n function assertEql(obj, msg) {\n if (msg) flag(this, 'message', msg);\n this.assert(\n _.eql(obj, flag(this, 'object'))\n , 'expected #{this} to deeply equal #{exp}'\n , 'expected #{this} to not deeply equal #{exp}'\n , obj\n , this._obj\n , true\n );\n }\n\n Assertion.addMethod('eql', assertEql);\n Assertion.addMethod('eqls', assertEql);\n\n /**\n * ### .above(value)\n *\n * Asserts that the target is greater than `value`.\n *\n * expect(10).to.be.above(5);\n *\n * Can also be used in conjunction with `length` to\n * assert a minimum length. The benefit being a\n * more informative error message than if the length\n * was supplied directly.\n *\n * expect('foo').to.have.length.above(2);\n * expect([ 1, 2, 3 ]).to.have.length.above(2);\n *\n * @name above\n * @alias gt\n * @alias greaterThan\n * @param {Number} value\n * @param {String} message _optional_\n * @api public\n */\n\n function assertAbove (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n if (flag(this, 'doLength')) {\n new Assertion(obj, msg).to.have.property('length');\n var len = obj.length;\n this.assert(\n len > n\n , 'expected #{this} to have a length above #{exp} but got #{act}'\n , 'expected #{this} to not have a length above #{exp}'\n , n\n , len\n );\n } else {\n this.assert(\n obj > n\n , 'expected #{this} to be above ' + n\n , 'expected #{this} to be at most ' + n\n );\n }\n }\n\n Assertion.addMethod('above', assertAbove);\n Assertion.addMethod('gt', assertAbove);\n Assertion.addMethod('greaterThan', assertAbove);\n\n /**\n * ### .least(value)\n *\n * Asserts that the target is greater than or equal to `value`.\n *\n * expect(10).to.be.at.least(10);\n *\n * Can also be used in conjunction with `length` to\n * assert a minimum length. The benefit being a\n * more informative error message than if the length\n * was supplied directly.\n *\n * expect('foo').to.have.length.of.at.least(2);\n * expect([ 1, 2, 3 ]).to.have.length.of.at.least(3);\n *\n * @name least\n * @alias gte\n * @param {Number} value\n * @param {String} message _optional_\n * @api public\n */\n\n function assertLeast (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n if (flag(this, 'doLength')) {\n new Assertion(obj, msg).to.have.property('length');\n var len = obj.length;\n this.assert(\n len >= n\n , 'expected #{this} to have a length at least #{exp} but got #{act}'\n , 'expected #{this} to have a length below #{exp}'\n , n\n , len\n );\n } else {\n this.assert(\n obj >= n\n , 'expected #{this} to be at least ' + n\n , 'expected #{this} to be below ' + n\n );\n }\n }\n\n Assertion.addMethod('least', assertLeast);\n Assertion.addMethod('gte', assertLeast);\n\n /**\n * ### .below(value)\n *\n * Asserts that the target is less than `value`.\n *\n * expect(5).to.be.below(10);\n *\n * Can also be used in conjunction with `length` to\n * assert a maximum length. The benefit being a\n * more informative error message than if the length\n * was supplied directly.\n *\n * expect('foo').to.have.length.below(4);\n * expect([ 1, 2, 3 ]).to.have.length.below(4);\n *\n * @name below\n * @alias lt\n * @alias lessThan\n * @param {Number} value\n * @param {String} message _optional_\n * @api public\n */\n\n function assertBelow (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n if (flag(this, 'doLength')) {\n new Assertion(obj, msg).to.have.property('length');\n var len = obj.length;\n this.assert(\n len < n\n , 'expected #{this} to have a length below #{exp} but got #{act}'\n , 'expected #{this} to not have a length below #{exp}'\n , n\n , len\n );\n } else {\n this.assert(\n obj < n\n , 'expected #{this} to be below ' + n\n , 'expected #{this} to be at least ' + n\n );\n }\n }\n\n Assertion.addMethod('below', assertBelow);\n Assertion.addMethod('lt', assertBelow);\n Assertion.addMethod('lessThan', assertBelow);\n\n /**\n * ### .most(value)\n *\n * Asserts that the target is less than or equal to `value`.\n *\n * expect(5).to.be.at.most(5);\n *\n * Can also be used in conjunction with `length` to\n * assert a maximum length. The benefit being a\n * more informative error message than if the length\n * was supplied directly.\n *\n * expect('foo').to.have.length.of.at.most(4);\n * expect([ 1, 2, 3 ]).to.have.length.of.at.most(3);\n *\n * @name most\n * @alias lte\n * @param {Number} value\n * @param {String} message _optional_\n * @api public\n */\n\n function assertMost (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n if (flag(this, 'doLength')) {\n new Assertion(obj, msg).to.have.property('length');\n var len = obj.length;\n this.assert(\n len <= n\n , 'expected #{this} to have a length at most #{exp} but got #{act}'\n , 'expected #{this} to have a length above #{exp}'\n , n\n , len\n );\n } else {\n this.assert(\n obj <= n\n , 'expected #{this} to be at most ' + n\n , 'expected #{this} to be above ' + n\n );\n }\n }\n\n Assertion.addMethod('most', assertMost);\n Assertion.addMethod('lte', assertMost);\n\n /**\n * ### .within(start, finish)\n *\n * Asserts that the target is within a range.\n *\n * expect(7).to.be.within(5,10);\n *\n * Can also be used in conjunction with `length` to\n * assert a length range. The benefit being a\n * more informative error message than if the length\n * was supplied directly.\n *\n * expect('foo').to.have.length.within(2,4);\n * expect([ 1, 2, 3 ]).to.have.length.within(2,4);\n *\n * @name within\n * @param {Number} start lowerbound inclusive\n * @param {Number} finish upperbound inclusive\n * @param {String} message _optional_\n * @api public\n */\n\n Assertion.addMethod('within', function (start, finish, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , range = start + '..' + finish;\n if (flag(this, 'doLength')) {\n new Assertion(obj, msg).to.have.property('length');\n var len = obj.length;\n this.assert(\n len >= start && len <= finish\n , 'expected #{this} to have a length within ' + range\n , 'expected #{this} to not have a length within ' + range\n );\n } else {\n this.assert(\n obj >= start && obj <= finish\n , 'expected #{this} to be within ' + range\n , 'expected #{this} to not be within ' + range\n );\n }\n });\n\n /**\n * ### .instanceof(constructor)\n *\n * Asserts that the target is an instance of `constructor`.\n *\n * var Tea = function (name) { this.name = name; }\n * , Chai = new Tea('chai');\n *\n * expect(Chai).to.be.an.instanceof(Tea);\n * expect([ 1, 2, 3 ]).to.be.instanceof(Array);\n *\n * @name instanceof\n * @param {Constructor} constructor\n * @param {String} message _optional_\n * @alias instanceOf\n * @api public\n */\n\n function assertInstanceOf (constructor, msg) {\n if (msg) flag(this, 'message', msg);\n var name = _.getName(constructor);\n this.assert(\n flag(this, 'object') instanceof constructor\n , 'expected #{this} to be an instance of ' + name\n , 'expected #{this} to not be an instance of ' + name\n );\n };\n\n Assertion.addMethod('instanceof', assertInstanceOf);\n Assertion.addMethod('instanceOf', assertInstanceOf);\n\n /**\n * ### .property(name, [value])\n *\n * Asserts that the target has a property `name`, optionally asserting that\n * the value of that property is strictly equal to `value`.\n * If the `deep` flag is set, you can use dot- and bracket-notation for deep\n * references into objects and arrays.\n *\n * // simple referencing\n * var obj = { foo: 'bar' };\n * expect(obj).to.have.property('foo');\n * expect(obj).to.have.property('foo', 'bar');\n *\n * // deep referencing\n * var deepObj = {\n * green: { tea: 'matcha' }\n * , teas: [ 'chai', 'matcha', { tea: 'konacha' } ]\n * };\n\n * expect(deepObj).to.have.deep.property('green.tea', 'matcha');\n * expect(deepObj).to.have.deep.property('teas[1]', 'matcha');\n * expect(deepObj).to.have.deep.property('teas[2].tea', 'konacha');\n *\n * You can also use an array as the starting point of a `deep.property`\n * assertion, or traverse nested arrays.\n *\n * var arr = [\n * [ 'chai', 'matcha', 'konacha' ]\n * , [ { tea: 'chai' }\n * , { tea: 'matcha' }\n * , { tea: 'konacha' } ]\n * ];\n *\n * expect(arr).to.have.deep.property('[0][1]', 'matcha');\n * expect(arr).to.have.deep.property('[1][2].tea', 'konacha');\n *\n * Furthermore, `property` changes the subject of the assertion\n * to be the value of that property from the original object. This\n * permits for further chainable assertions on that property.\n *\n * expect(obj).to.have.property('foo')\n * .that.is.a('string');\n * expect(deepObj).to.have.property('green')\n * .that.is.an('object')\n * .that.deep.equals({ tea: 'matcha' });\n * expect(deepObj).to.have.property('teas')\n * .that.is.an('array')\n * .with.deep.property('[2]')\n * .that.deep.equals({ tea: 'konacha' });\n *\n * @name property\n * @alias deep.property\n * @param {String} name\n * @param {Mixed} value (optional)\n * @param {String} message _optional_\n * @returns value of property for chaining\n * @api public\n */\n\n Assertion.addMethod('property', function (name, val, msg) {\n if (msg) flag(this, 'message', msg);\n\n var descriptor = flag(this, 'deep') ? 'deep property ' : 'property '\n , negate = flag(this, 'negate')\n , obj = flag(this, 'object')\n , value = flag(this, 'deep')\n ? _.getPathValue(name, obj)\n : obj[name];\n\n if (negate && undefined !== val) {\n if (undefined === value) {\n msg = (msg != null) ? msg + ': ' : '';\n throw new Error(msg + _.inspect(obj) + ' has no ' + descriptor + _.inspect(name));\n }\n } else {\n this.assert(\n undefined !== value\n , 'expected #{this} to have a ' + descriptor + _.inspect(name)\n , 'expected #{this} to not have ' + descriptor + _.inspect(name));\n }\n\n if (undefined !== val) {\n this.assert(\n val === value\n , 'expected #{this} to have a ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}'\n , 'expected #{this} to not have a ' + descriptor + _.inspect(name) + ' of #{act}'\n , val\n , value\n );\n }\n\n flag(this, 'object', value);\n });\n\n\n /**\n * ### .ownProperty(name)\n *\n * Asserts that the target has an own property `name`.\n *\n * expect('test').to.have.ownProperty('length');\n *\n * @name ownProperty\n * @alias haveOwnProperty\n * @param {String} name\n * @param {String} message _optional_\n * @api public\n */\n\n function assertOwnProperty (name, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n this.assert(\n obj.hasOwnProperty(name)\n , 'expected #{this} to have own property ' + _.inspect(name)\n , 'expected #{this} to not have own property ' + _.inspect(name)\n );\n }\n\n Assertion.addMethod('ownProperty', assertOwnProperty);\n Assertion.addMethod('haveOwnProperty', assertOwnProperty);\n\n /**\n * ### .length(value)\n *\n * Asserts that the target's `length` property has\n * the expected value.\n *\n * expect([ 1, 2, 3]).to.have.length(3);\n * expect('foobar').to.have.length(6);\n *\n * Can also be used as a chain precursor to a value\n * comparison for the length property.\n *\n * expect('foo').to.have.length.above(2);\n * expect([ 1, 2, 3 ]).to.have.length.above(2);\n * expect('foo').to.have.length.below(4);\n * expect([ 1, 2, 3 ]).to.have.length.below(4);\n * expect('foo').to.have.length.within(2,4);\n * expect([ 1, 2, 3 ]).to.have.length.within(2,4);\n *\n * @name length\n * @alias lengthOf\n * @param {Number} length\n * @param {String} message _optional_\n * @api public\n */\n\n function assertLengthChain () {\n flag(this, 'doLength', true);\n }\n\n function assertLength (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n new Assertion(obj, msg).to.have.property('length');\n var len = obj.length;\n\n this.assert(\n len == n\n , 'expected #{this} to have a length of #{exp} but got #{act}'\n , 'expected #{this} to not have a length of #{act}'\n , n\n , len\n );\n }\n\n Assertion.addChainableMethod('length', assertLength, assertLengthChain);\n Assertion.addMethod('lengthOf', assertLength, assertLengthChain);\n\n /**\n * ### .match(regexp)\n *\n * Asserts that the target matches a regular expression.\n *\n * expect('foobar').to.match(/^foo/);\n *\n * @name match\n * @param {RegExp} RegularExpression\n * @param {String} message _optional_\n * @api public\n */\n\n Assertion.addMethod('match', function (re, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n this.assert(\n re.exec(obj)\n , 'expected #{this} to match ' + re\n , 'expected #{this} not to match ' + re\n );\n });\n\n /**\n * ### .string(string)\n *\n * Asserts that the string target contains another string.\n *\n * expect('foobar').to.have.string('bar');\n *\n * @name string\n * @param {String} string\n * @param {String} message _optional_\n * @api public\n */\n\n Assertion.addMethod('string', function (str, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n new Assertion(obj, msg).is.a('string');\n\n this.assert(\n ~obj.indexOf(str)\n , 'expected #{this} to contain ' + _.inspect(str)\n , 'expected #{this} to not contain ' + _.inspect(str)\n );\n });\n\n\n /**\n * ### .keys(key1, [key2], [...])\n *\n * Asserts that the target has exactly the given keys, or\n * asserts the inclusion of some keys when using the\n * `include` or `contain` modifiers.\n *\n * expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']);\n * expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar');\n *\n * @name keys\n * @alias key\n * @param {String...|Array} keys\n * @api public\n */\n\n function assertKeys (keys) {\n var obj = flag(this, 'object')\n , str\n , ok = true;\n\n keys = keys instanceof Array\n ? keys\n : Array.prototype.slice.call(arguments);\n\n if (!keys.length) throw new Error('keys required');\n\n var actual = Object.keys(obj)\n , len = keys.length;\n\n // Inclusion\n ok = keys.every(function(key){\n return ~actual.indexOf(key);\n });\n\n // Strict\n if (!flag(this, 'negate') && !flag(this, 'contains')) {\n ok = ok && keys.length == actual.length;\n }\n\n // Key string\n if (len > 1) {\n keys = keys.map(function(key){\n return _.inspect(key);\n });\n var last = keys.pop();\n str = keys.join(', ') + ', and ' + last;\n } else {\n str = _.inspect(keys[0]);\n }\n\n // Form\n str = (len > 1 ? 'keys ' : 'key ') + str;\n\n // Have / include\n str = (flag(this, 'contains') ? 'contain ' : 'have ') + str;\n\n // Assertion\n this.assert(\n ok\n , 'expected #{this} to ' + str\n , 'expected #{this} to not ' + str\n );\n }\n\n Assertion.addMethod('keys', assertKeys);\n Assertion.addMethod('key', assertKeys);\n\n /**\n * ### .throw(constructor)\n *\n * Asserts that the function target will throw a specific error, or specific type of error\n * (as determined using `instanceof`), optionally with a RegExp or string inclusion test\n * for the error's message.\n *\n * var err = new ReferenceError('This is a bad function.');\n * var fn = function () { throw err; }\n * expect(fn).to.throw(ReferenceError);\n * expect(fn).to.throw(Error);\n * expect(fn).to.throw(/bad function/);\n * expect(fn).to.not.throw('good function');\n * expect(fn).to.throw(ReferenceError, /bad function/);\n * expect(fn).to.throw(err);\n * expect(fn).to.not.throw(new RangeError('Out of range.'));\n *\n * Please note that when a throw expectation is negated, it will check each\n * parameter independently, starting with error constructor type. The appropriate way\n * to check for the existence of a type of error but for a message that does not match\n * is to use `and`.\n *\n * expect(fn).to.throw(ReferenceError)\n * .and.not.throw(/good function/);\n *\n * @name throw\n * @alias throws\n * @alias Throw\n * @param {ErrorConstructor} constructor\n * @param {String|RegExp} expected error message\n * @param {String} message _optional_\n * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types\n * @api public\n */\n\n function assertThrows (constructor, errMsg, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n new Assertion(obj, msg).is.a('function');\n\n var thrown = false\n , desiredError = null\n , name = null\n , thrownError = null;\n\n if (arguments.length === 0) {\n errMsg = null;\n constructor = null;\n } else if (constructor && (constructor instanceof RegExp || 'string' === typeof constructor)) {\n errMsg = constructor;\n constructor = null;\n } else if (constructor && constructor instanceof Error) {\n desiredError = constructor;\n constructor = null;\n errMsg = null;\n } else if (typeof constructor === 'function') {\n name = (new constructor()).name;\n } else {\n constructor = null;\n }\n\n try {\n obj();\n } catch (err) {\n // first, check desired error\n if (desiredError) {\n this.assert(\n err === desiredError\n , 'expected #{this} to throw #{exp} but #{act} was thrown'\n , 'expected #{this} to not throw #{exp}'\n , desiredError\n , err\n );\n\n return this;\n }\n // next, check constructor\n if (constructor) {\n this.assert(\n err instanceof constructor\n , 'expected #{this} to throw #{exp} but #{act} was thrown'\n , 'expected #{this} to not throw #{exp} but #{act} was thrown'\n , name\n , err\n );\n\n if (!errMsg) return this;\n }\n // next, check message\n var message = 'object' === _.type(err) && \"message\" in err\n ? err.message\n : '' + err;\n\n if ((message != null) && errMsg && errMsg instanceof RegExp) {\n this.assert(\n errMsg.exec(message)\n , 'expected #{this} to throw error matching #{exp} but got #{act}'\n , 'expected #{this} to throw error not matching #{exp}'\n , errMsg\n , message\n );\n\n return this;\n } else if ((message != null) && errMsg && 'string' === typeof errMsg) {\n this.assert(\n ~message.indexOf(errMsg)\n , 'expected #{this} to throw error including #{exp} but got #{act}'\n , 'expected #{this} to throw error not including #{act}'\n , errMsg\n , message\n );\n\n return this;\n } else {\n thrown = true;\n thrownError = err;\n }\n }\n\n var actuallyGot = ''\n , expectedThrown = name !== null\n ? name\n : desiredError\n ? '#{exp}' //_.inspect(desiredError)\n : 'an error';\n\n if (thrown) {\n actuallyGot = ' but #{act} was thrown'\n }\n\n this.assert(\n thrown === true\n , 'expected #{this} to throw ' + expectedThrown + actuallyGot\n , 'expected #{this} to not throw ' + expectedThrown + actuallyGot\n , desiredError\n , thrownError\n );\n };\n\n Assertion.addMethod('throw', assertThrows);\n Assertion.addMethod('throws', assertThrows);\n Assertion.addMethod('Throw', assertThrows);\n\n /**\n * ### .respondTo(method)\n *\n * Asserts that the object or class target will respond to a method.\n *\n * Klass.prototype.bar = function(){};\n * expect(Klass).to.respondTo('bar');\n * expect(obj).to.respondTo('bar');\n *\n * To check if a constructor will respond to a static function,\n * set the `itself` flag.\n *\n * Klass.baz = function(){};\n * expect(Klass).itself.to.respondTo('baz');\n *\n * @name respondTo\n * @param {String} method\n * @param {String} message _optional_\n * @api public\n */\n\n Assertion.addMethod('respondTo', function (method, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , itself = flag(this, 'itself')\n , context = ('function' === _.type(obj) && !itself)\n ? obj.prototype[method]\n : obj[method];\n\n this.assert(\n 'function' === typeof context\n , 'expected #{this} to respond to ' + _.inspect(method)\n , 'expected #{this} to not respond to ' + _.inspect(method)\n );\n });\n\n /**\n * ### .itself\n *\n * Sets the `itself` flag, later used by the `respondTo` assertion.\n *\n * function Foo() {}\n * Foo.bar = function() {}\n * Foo.prototype.baz = function() {}\n *\n * expect(Foo).itself.to.respondTo('bar');\n * expect(Foo).itself.not.to.respondTo('baz');\n *\n * @name itself\n * @api public\n */\n\n Assertion.addProperty('itself', function () {\n flag(this, 'itself', true);\n });\n\n /**\n * ### .satisfy(method)\n *\n * Asserts that the target passes a given truth test.\n *\n * expect(1).to.satisfy(function(num) { return num > 0; });\n *\n * @name satisfy\n * @param {Function} matcher\n * @param {String} message _optional_\n * @api public\n */\n\n Assertion.addMethod('satisfy', function (matcher, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n this.assert(\n matcher(obj)\n , 'expected #{this} to satisfy ' + _.objDisplay(matcher)\n , 'expected #{this} to not satisfy' + _.objDisplay(matcher)\n , this.negate ? false : true\n , matcher(obj)\n );\n });\n\n /**\n * ### .closeTo(expected, delta)\n *\n * Asserts that the target is equal `expected`, to within a +/- `delta` range.\n *\n * expect(1.5).to.be.closeTo(1, 0.5);\n *\n * @name closeTo\n * @param {Number} expected\n * @param {Number} delta\n * @param {String} message _optional_\n * @api public\n */\n\n Assertion.addMethod('closeTo', function (expected, delta, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n this.assert(\n Math.abs(obj - expected) <= delta\n , 'expected #{this} to be close to ' + expected + ' +/- ' + delta\n , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta\n );\n });\n\n function isSubsetOf(subset, superset) {\n return subset.every(function(elem) {\n return superset.indexOf(elem) !== -1;\n })\n }\n\n /**\n * ### .members(set)\n *\n * Asserts that the target is a superset of `set`,\n * or that the target and `set` have the same members.\n *\n * expect([1, 2, 3]).to.include.members([3, 2]);\n * expect([1, 2, 3]).to.not.include.members([3, 2, 8]);\n *\n * expect([4, 2]).to.have.members([2, 4]);\n * expect([5, 2]).to.not.have.members([5, 2, 1]);\n *\n * @name members\n * @param {Array} set\n * @param {String} message _optional_\n * @api public\n */\n\n Assertion.addMethod('members', function (subset, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n\n new Assertion(obj).to.be.an('array');\n new Assertion(subset).to.be.an('array');\n\n if (flag(this, 'contains')) {\n return this.assert(\n isSubsetOf(subset, obj)\n , 'expected #{this} to be a superset of #{act}'\n , 'expected #{this} to not be a superset of #{act}'\n , obj\n , subset\n );\n }\n\n this.assert(\n isSubsetOf(obj, subset) && isSubsetOf(subset, obj)\n , 'expected #{this} to have the same members as #{act}'\n , 'expected #{this} to not have the same members as #{act}'\n , obj\n , subset\n );\n });\n};\n//@ sourceURL=chaijs-chai/lib/chai/core/assertions.js"
255
- ));
256
- require.register("chaijs-chai/lib/chai/interface/assert.js", Function("exports, require, module",
257
- "/*!\n * chai\n * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n\nmodule.exports = function (chai, util) {\n\n /*!\n * Chai dependencies.\n */\n\n var Assertion = chai.Assertion\n , flag = util.flag;\n\n /*!\n * Module export.\n */\n\n /**\n * ### assert(expression, message)\n *\n * Write your own test expressions.\n *\n * assert('foo' !== 'bar', 'foo is not bar');\n * assert(Array.isArray([]), 'empty arrays are arrays');\n *\n * @param {Mixed} expression to test for truthiness\n * @param {String} message to display on error\n * @name assert\n * @api public\n */\n\n var assert = chai.assert = function (express, errmsg) {\n var test = new Assertion(null);\n test.assert(\n express\n , errmsg\n , '[ negation message unavailable ]'\n );\n };\n\n /**\n * ### .fail(actual, expected, [message], [operator])\n *\n * Throw a failure. Node.js `assert` module-compatible.\n *\n * @name fail\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @param {String} operator\n * @api public\n */\n\n assert.fail = function (actual, expected, message, operator) {\n throw new chai.AssertionError({\n actual: actual\n , expected: expected\n , message: message\n , operator: operator\n , stackStartFunction: assert.fail\n });\n };\n\n /**\n * ### .ok(object, [message])\n *\n * Asserts that `object` is truthy.\n *\n * assert.ok('everything', 'everything is ok');\n * assert.ok(false, 'this will fail');\n *\n * @name ok\n * @param {Mixed} object to test\n * @param {String} message\n * @api public\n */\n\n assert.ok = function (val, msg) {\n new Assertion(val, msg).is.ok;\n };\n\n /**\n * ### .notOk(object, [message])\n *\n * Asserts that `object` is falsy.\n *\n * assert.notOk('everything', 'this will fail');\n * assert.notOk(false, 'this will pass');\n *\n * @name notOk\n * @param {Mixed} object to test\n * @param {String} message\n * @api public\n */\n\n assert.notOk = function (val, msg) {\n new Assertion(val, msg).is.not.ok;\n };\n\n /**\n * ### .equal(actual, expected, [message])\n *\n * Asserts non-strict equality (`==`) of `actual` and `expected`.\n *\n * assert.equal(3, '3', '== coerces values to strings');\n *\n * @name equal\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @api public\n */\n\n assert.equal = function (act, exp, msg) {\n var test = new Assertion(act, msg);\n\n test.assert(\n exp == flag(test, 'object')\n , 'expected #{this} to equal #{exp}'\n , 'expected #{this} to not equal #{act}'\n , exp\n , act\n );\n };\n\n /**\n * ### .notEqual(actual, expected, [message])\n *\n * Asserts non-strict inequality (`!=`) of `actual` and `expected`.\n *\n * assert.notEqual(3, 4, 'these numbers are not equal');\n *\n * @name notEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @api public\n */\n\n assert.notEqual = function (act, exp, msg) {\n var test = new Assertion(act, msg);\n\n test.assert(\n exp != flag(test, 'object')\n , 'expected #{this} to not equal #{exp}'\n , 'expected #{this} to equal #{act}'\n , exp\n , act\n );\n };\n\n /**\n * ### .strictEqual(actual, expected, [message])\n *\n * Asserts strict equality (`===`) of `actual` and `expected`.\n *\n * assert.strictEqual(true, true, 'these booleans are strictly equal');\n *\n * @name strictEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @api public\n */\n\n assert.strictEqual = function (act, exp, msg) {\n new Assertion(act, msg).to.equal(exp);\n };\n\n /**\n * ### .notStrictEqual(actual, expected, [message])\n *\n * Asserts strict inequality (`!==`) of `actual` and `expected`.\n *\n * assert.notStrictEqual(3, '3', 'no coercion for strict equality');\n *\n * @name notStrictEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @api public\n */\n\n assert.notStrictEqual = function (act, exp, msg) {\n new Assertion(act, msg).to.not.equal(exp);\n };\n\n /**\n * ### .deepEqual(actual, expected, [message])\n *\n * Asserts that `actual` is deeply equal to `expected`.\n *\n * assert.deepEqual({ tea: 'green' }, { tea: 'green' });\n *\n * @name deepEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @api public\n */\n\n assert.deepEqual = function (act, exp, msg) {\n new Assertion(act, msg).to.eql(exp);\n };\n\n /**\n * ### .notDeepEqual(actual, expected, [message])\n *\n * Assert that `actual` is not deeply equal to `expected`.\n *\n * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });\n *\n * @name notDeepEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @api public\n */\n\n assert.notDeepEqual = function (act, exp, msg) {\n new Assertion(act, msg).to.not.eql(exp);\n };\n\n /**\n * ### .isTrue(value, [message])\n *\n * Asserts that `value` is true.\n *\n * var teaServed = true;\n * assert.isTrue(teaServed, 'the tea has been served');\n *\n * @name isTrue\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isTrue = function (val, msg) {\n new Assertion(val, msg).is['true'];\n };\n\n /**\n * ### .isFalse(value, [message])\n *\n * Asserts that `value` is false.\n *\n * var teaServed = false;\n * assert.isFalse(teaServed, 'no tea yet? hmm...');\n *\n * @name isFalse\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isFalse = function (val, msg) {\n new Assertion(val, msg).is['false'];\n };\n\n /**\n * ### .isNull(value, [message])\n *\n * Asserts that `value` is null.\n *\n * assert.isNull(err, 'there was no error');\n *\n * @name isNull\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isNull = function (val, msg) {\n new Assertion(val, msg).to.equal(null);\n };\n\n /**\n * ### .isNotNull(value, [message])\n *\n * Asserts that `value` is not null.\n *\n * var tea = 'tasty chai';\n * assert.isNotNull(tea, 'great, time for tea!');\n *\n * @name isNotNull\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isNotNull = function (val, msg) {\n new Assertion(val, msg).to.not.equal(null);\n };\n\n /**\n * ### .isUndefined(value, [message])\n *\n * Asserts that `value` is `undefined`.\n *\n * var tea;\n * assert.isUndefined(tea, 'no tea defined');\n *\n * @name isUndefined\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isUndefined = function (val, msg) {\n new Assertion(val, msg).to.equal(undefined);\n };\n\n /**\n * ### .isDefined(value, [message])\n *\n * Asserts that `value` is not `undefined`.\n *\n * var tea = 'cup of chai';\n * assert.isDefined(tea, 'tea has been defined');\n *\n * @name isDefined\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isDefined = function (val, msg) {\n new Assertion(val, msg).to.not.equal(undefined);\n };\n\n /**\n * ### .isFunction(value, [message])\n *\n * Asserts that `value` is a function.\n *\n * function serveTea() { return 'cup of tea'; };\n * assert.isFunction(serveTea, 'great, we can have tea now');\n *\n * @name isFunction\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isFunction = function (val, msg) {\n new Assertion(val, msg).to.be.a('function');\n };\n\n /**\n * ### .isNotFunction(value, [message])\n *\n * Asserts that `value` is _not_ a function.\n *\n * var serveTea = [ 'heat', 'pour', 'sip' ];\n * assert.isNotFunction(serveTea, 'great, we have listed the steps');\n *\n * @name isNotFunction\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isNotFunction = function (val, msg) {\n new Assertion(val, msg).to.not.be.a('function');\n };\n\n /**\n * ### .isObject(value, [message])\n *\n * Asserts that `value` is an object (as revealed by\n * `Object.prototype.toString`).\n *\n * var selection = { name: 'Chai', serve: 'with spices' };\n * assert.isObject(selection, 'tea selection is an object');\n *\n * @name isObject\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isObject = function (val, msg) {\n new Assertion(val, msg).to.be.a('object');\n };\n\n /**\n * ### .isNotObject(value, [message])\n *\n * Asserts that `value` is _not_ an object.\n *\n * var selection = 'chai'\n * assert.isObject(selection, 'tea selection is not an object');\n * assert.isObject(null, 'null is not an object');\n *\n * @name isNotObject\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isNotObject = function (val, msg) {\n new Assertion(val, msg).to.not.be.a('object');\n };\n\n /**\n * ### .isArray(value, [message])\n *\n * Asserts that `value` is an array.\n *\n * var menu = [ 'green', 'chai', 'oolong' ];\n * assert.isArray(menu, 'what kind of tea do we want?');\n *\n * @name isArray\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isArray = function (val, msg) {\n new Assertion(val, msg).to.be.an('array');\n };\n\n /**\n * ### .isNotArray(value, [message])\n *\n * Asserts that `value` is _not_ an array.\n *\n * var menu = 'green|chai|oolong';\n * assert.isNotArray(menu, 'what kind of tea do we want?');\n *\n * @name isNotArray\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isNotArray = function (val, msg) {\n new Assertion(val, msg).to.not.be.an('array');\n };\n\n /**\n * ### .isString(value, [message])\n *\n * Asserts that `value` is a string.\n *\n * var teaOrder = 'chai';\n * assert.isString(teaOrder, 'order placed');\n *\n * @name isString\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isString = function (val, msg) {\n new Assertion(val, msg).to.be.a('string');\n };\n\n /**\n * ### .isNotString(value, [message])\n *\n * Asserts that `value` is _not_ a string.\n *\n * var teaOrder = 4;\n * assert.isNotString(teaOrder, 'order placed');\n *\n * @name isNotString\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isNotString = function (val, msg) {\n new Assertion(val, msg).to.not.be.a('string');\n };\n\n /**\n * ### .isNumber(value, [message])\n *\n * Asserts that `value` is a number.\n *\n * var cups = 2;\n * assert.isNumber(cups, 'how many cups');\n *\n * @name isNumber\n * @param {Number} value\n * @param {String} message\n * @api public\n */\n\n assert.isNumber = function (val, msg) {\n new Assertion(val, msg).to.be.a('number');\n };\n\n /**\n * ### .isNotNumber(value, [message])\n *\n * Asserts that `value` is _not_ a number.\n *\n * var cups = '2 cups please';\n * assert.isNotNumber(cups, 'how many cups');\n *\n * @name isNotNumber\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isNotNumber = function (val, msg) {\n new Assertion(val, msg).to.not.be.a('number');\n };\n\n /**\n * ### .isBoolean(value, [message])\n *\n * Asserts that `value` is a boolean.\n *\n * var teaReady = true\n * , teaServed = false;\n *\n * assert.isBoolean(teaReady, 'is the tea ready');\n * assert.isBoolean(teaServed, 'has tea been served');\n *\n * @name isBoolean\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isBoolean = function (val, msg) {\n new Assertion(val, msg).to.be.a('boolean');\n };\n\n /**\n * ### .isNotBoolean(value, [message])\n *\n * Asserts that `value` is _not_ a boolean.\n *\n * var teaReady = 'yep'\n * , teaServed = 'nope';\n *\n * assert.isNotBoolean(teaReady, 'is the tea ready');\n * assert.isNotBoolean(teaServed, 'has tea been served');\n *\n * @name isNotBoolean\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.isNotBoolean = function (val, msg) {\n new Assertion(val, msg).to.not.be.a('boolean');\n };\n\n /**\n * ### .typeOf(value, name, [message])\n *\n * Asserts that `value`'s type is `name`, as determined by\n * `Object.prototype.toString`.\n *\n * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object');\n * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array');\n * assert.typeOf('tea', 'string', 'we have a string');\n * assert.typeOf(/tea/, 'regexp', 'we have a regular expression');\n * assert.typeOf(null, 'null', 'we have a null');\n * assert.typeOf(undefined, 'undefined', 'we have an undefined');\n *\n * @name typeOf\n * @param {Mixed} value\n * @param {String} name\n * @param {String} message\n * @api public\n */\n\n assert.typeOf = function (val, type, msg) {\n new Assertion(val, msg).to.be.a(type);\n };\n\n /**\n * ### .notTypeOf(value, name, [message])\n *\n * Asserts that `value`'s type is _not_ `name`, as determined by\n * `Object.prototype.toString`.\n *\n * assert.notTypeOf('tea', 'number', 'strings are not numbers');\n *\n * @name notTypeOf\n * @param {Mixed} value\n * @param {String} typeof name\n * @param {String} message\n * @api public\n */\n\n assert.notTypeOf = function (val, type, msg) {\n new Assertion(val, msg).to.not.be.a(type);\n };\n\n /**\n * ### .instanceOf(object, constructor, [message])\n *\n * Asserts that `value` is an instance of `constructor`.\n *\n * var Tea = function (name) { this.name = name; }\n * , chai = new Tea('chai');\n *\n * assert.instanceOf(chai, Tea, 'chai is an instance of tea');\n *\n * @name instanceOf\n * @param {Object} object\n * @param {Constructor} constructor\n * @param {String} message\n * @api public\n */\n\n assert.instanceOf = function (val, type, msg) {\n new Assertion(val, msg).to.be.instanceOf(type);\n };\n\n /**\n * ### .notInstanceOf(object, constructor, [message])\n *\n * Asserts `value` is not an instance of `constructor`.\n *\n * var Tea = function (name) { this.name = name; }\n * , chai = new String('chai');\n *\n * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea');\n *\n * @name notInstanceOf\n * @param {Object} object\n * @param {Constructor} constructor\n * @param {String} message\n * @api public\n */\n\n assert.notInstanceOf = function (val, type, msg) {\n new Assertion(val, msg).to.not.be.instanceOf(type);\n };\n\n /**\n * ### .include(haystack, needle, [message])\n *\n * Asserts that `haystack` includes `needle`. Works\n * for strings and arrays.\n *\n * assert.include('foobar', 'bar', 'foobar contains string \"bar\"');\n * assert.include([ 1, 2, 3 ], 3, 'array contains value');\n *\n * @name include\n * @param {Array|String} haystack\n * @param {Mixed} needle\n * @param {String} message\n * @api public\n */\n\n assert.include = function (exp, inc, msg) {\n var obj = new Assertion(exp, msg);\n\n if (Array.isArray(exp)) {\n obj.to.include(inc);\n } else if ('string' === typeof exp) {\n obj.to.contain.string(inc);\n } else {\n throw new chai.AssertionError(\n 'expected an array or string'\n , null\n , assert.include\n );\n }\n };\n\n /**\n * ### .notInclude(haystack, needle, [message])\n *\n * Asserts that `haystack` does not include `needle`. Works\n * for strings and arrays.\n *i\n * assert.notInclude('foobar', 'baz', 'string not include substring');\n * assert.notInclude([ 1, 2, 3 ], 4, 'array not include contain value');\n *\n * @name notInclude\n * @param {Array|String} haystack\n * @param {Mixed} needle\n * @param {String} message\n * @api public\n */\n\n assert.notInclude = function (exp, inc, msg) {\n var obj = new Assertion(exp, msg);\n\n if (Array.isArray(exp)) {\n obj.to.not.include(inc);\n } else if ('string' === typeof exp) {\n obj.to.not.contain.string(inc);\n } else {\n throw new chai.AssertionError(\n 'expected an array or string'\n , null\n , assert.notInclude\n );\n }\n };\n\n /**\n * ### .match(value, regexp, [message])\n *\n * Asserts that `value` matches the regular expression `regexp`.\n *\n * assert.match('foobar', /^foo/, 'regexp matches');\n *\n * @name match\n * @param {Mixed} value\n * @param {RegExp} regexp\n * @param {String} message\n * @api public\n */\n\n assert.match = function (exp, re, msg) {\n new Assertion(exp, msg).to.match(re);\n };\n\n /**\n * ### .notMatch(value, regexp, [message])\n *\n * Asserts that `value` does not match the regular expression `regexp`.\n *\n * assert.notMatch('foobar', /^foo/, 'regexp does not match');\n *\n * @name notMatch\n * @param {Mixed} value\n * @param {RegExp} regexp\n * @param {String} message\n * @api public\n */\n\n assert.notMatch = function (exp, re, msg) {\n new Assertion(exp, msg).to.not.match(re);\n };\n\n /**\n * ### .property(object, property, [message])\n *\n * Asserts that `object` has a property named by `property`.\n *\n * assert.property({ tea: { green: 'matcha' }}, 'tea');\n *\n * @name property\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @api public\n */\n\n assert.property = function (obj, prop, msg) {\n new Assertion(obj, msg).to.have.property(prop);\n };\n\n /**\n * ### .notProperty(object, property, [message])\n *\n * Asserts that `object` does _not_ have a property named by `property`.\n *\n * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee');\n *\n * @name notProperty\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @api public\n */\n\n assert.notProperty = function (obj, prop, msg) {\n new Assertion(obj, msg).to.not.have.property(prop);\n };\n\n /**\n * ### .deepProperty(object, property, [message])\n *\n * Asserts that `object` has a property named by `property`, which can be a\n * string using dot- and bracket-notation for deep reference.\n *\n * assert.deepProperty({ tea: { green: 'matcha' }}, 'tea.green');\n *\n * @name deepProperty\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @api public\n */\n\n assert.deepProperty = function (obj, prop, msg) {\n new Assertion(obj, msg).to.have.deep.property(prop);\n };\n\n /**\n * ### .notDeepProperty(object, property, [message])\n *\n * Asserts that `object` does _not_ have a property named by `property`, which\n * can be a string using dot- and bracket-notation for deep reference.\n *\n * assert.notDeepProperty({ tea: { green: 'matcha' }}, 'tea.oolong');\n *\n * @name notDeepProperty\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @api public\n */\n\n assert.notDeepProperty = function (obj, prop, msg) {\n new Assertion(obj, msg).to.not.have.deep.property(prop);\n };\n\n /**\n * ### .propertyVal(object, property, value, [message])\n *\n * Asserts that `object` has a property named by `property` with value given\n * by `value`.\n *\n * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good');\n *\n * @name propertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.propertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg).to.have.property(prop, val);\n };\n\n /**\n * ### .propertyNotVal(object, property, value, [message])\n *\n * Asserts that `object` has a property named by `property`, but with a value\n * different from that given by `value`.\n *\n * assert.propertyNotVal({ tea: 'is good' }, 'tea', 'is bad');\n *\n * @name propertyNotVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.propertyNotVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg).to.not.have.property(prop, val);\n };\n\n /**\n * ### .deepPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` has a property named by `property` with value given\n * by `value`. `property` can use dot- and bracket-notation for deep\n * reference.\n *\n * assert.deepPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha');\n *\n * @name deepPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.deepPropertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg).to.have.deep.property(prop, val);\n };\n\n /**\n * ### .deepPropertyNotVal(object, property, value, [message])\n *\n * Asserts that `object` has a property named by `property`, but with a value\n * different from that given by `value`. `property` can use dot- and\n * bracket-notation for deep reference.\n *\n * assert.deepPropertyNotVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha');\n *\n * @name deepPropertyNotVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.deepPropertyNotVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg).to.not.have.deep.property(prop, val);\n };\n\n /**\n * ### .lengthOf(object, length, [message])\n *\n * Asserts that `object` has a `length` property with the expected value.\n *\n * assert.lengthOf([1,2,3], 3, 'array has length of 3');\n * assert.lengthOf('foobar', 5, 'string has length of 6');\n *\n * @name lengthOf\n * @param {Mixed} object\n * @param {Number} length\n * @param {String} message\n * @api public\n */\n\n assert.lengthOf = function (exp, len, msg) {\n new Assertion(exp, msg).to.have.length(len);\n };\n\n /**\n * ### .throws(function, [constructor/string/regexp], [string/regexp], [message])\n *\n * Asserts that `function` will throw an error that is an instance of\n * `constructor`, or alternately that it will throw an error with message\n * matching `regexp`.\n *\n * assert.throw(fn, 'function throws a reference error');\n * assert.throw(fn, /function throws a reference error/);\n * assert.throw(fn, ReferenceError);\n * assert.throw(fn, ReferenceError, 'function throws a reference error');\n * assert.throw(fn, ReferenceError, /function throws a reference error/);\n *\n * @name throws\n * @alias throw\n * @alias Throw\n * @param {Function} function\n * @param {ErrorConstructor} constructor\n * @param {RegExp} regexp\n * @param {String} message\n * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types\n * @api public\n */\n\n assert.Throw = function (fn, errt, errs, msg) {\n if ('string' === typeof errt || errt instanceof RegExp) {\n errs = errt;\n errt = null;\n }\n\n new Assertion(fn, msg).to.Throw(errt, errs);\n };\n\n /**\n * ### .doesNotThrow(function, [constructor/regexp], [message])\n *\n * Asserts that `function` will _not_ throw an error that is an instance of\n * `constructor`, or alternately that it will not throw an error with message\n * matching `regexp`.\n *\n * assert.doesNotThrow(fn, Error, 'function does not throw');\n *\n * @name doesNotThrow\n * @param {Function} function\n * @param {ErrorConstructor} constructor\n * @param {RegExp} regexp\n * @param {String} message\n * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types\n * @api public\n */\n\n assert.doesNotThrow = function (fn, type, msg) {\n if ('string' === typeof type) {\n msg = type;\n type = null;\n }\n\n new Assertion(fn, msg).to.not.Throw(type);\n };\n\n /**\n * ### .operator(val1, operator, val2, [message])\n *\n * Compares two values using `operator`.\n *\n * assert.operator(1, '<', 2, 'everything is ok');\n * assert.operator(1, '>', 2, 'this will fail');\n *\n * @name operator\n * @param {Mixed} val1\n * @param {String} operator\n * @param {Mixed} val2\n * @param {String} message\n * @api public\n */\n\n assert.operator = function (val, operator, val2, msg) {\n if (!~['==', '===', '>', '>=', '<', '<=', '!=', '!=='].indexOf(operator)) {\n throw new Error('Invalid operator \"' + operator + '\"');\n }\n var test = new Assertion(eval(val + operator + val2), msg);\n test.assert(\n true === flag(test, 'object')\n , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2)\n , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) );\n };\n\n /**\n * ### .closeTo(actual, expected, delta, [message])\n *\n * Asserts that the target is equal `expected`, to within a +/- `delta` range.\n *\n * assert.closeTo(1.5, 1, 0.5, 'numbers are close');\n *\n * @name closeTo\n * @param {Number} actual\n * @param {Number} expected\n * @param {Number} delta\n * @param {String} message\n * @api public\n */\n\n assert.closeTo = function (act, exp, delta, msg) {\n new Assertion(act, msg).to.be.closeTo(exp, delta);\n };\n\n /**\n * ### .sameMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` have the same members.\n * Order is not taken into account.\n *\n * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');\n *\n * @name sameMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @api public\n */\n\n assert.sameMembers = function (set1, set2, msg) {\n new Assertion(set1, msg).to.have.same.members(set2);\n }\n\n /**\n * ### .includeMembers(superset, subset, [message])\n *\n * Asserts that `subset` is included in `superset`.\n * Order is not taken into account.\n *\n * assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');\n *\n * @name includeMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @api public\n */\n\n assert.includeMembers = function (superset, subset, msg) {\n new Assertion(superset, msg).to.include.members(subset);\n }\n\n /*!\n * Undocumented / untested\n */\n\n assert.ifError = function (val, msg) {\n new Assertion(val, msg).to.not.be.ok;\n };\n\n /*!\n * Aliases.\n */\n\n (function alias(name, as){\n assert[as] = assert[name];\n return alias;\n })\n ('Throw', 'throw')\n ('Throw', 'throws');\n};\n//@ sourceURL=chaijs-chai/lib/chai/interface/assert.js"
258
- ));
259
- require.register("chaijs-chai/lib/chai/interface/expect.js", Function("exports, require, module",
260
- "/*!\n * chai\n * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nmodule.exports = function (chai, util) {\n chai.expect = function (val, message) {\n return new chai.Assertion(val, message);\n };\n};\n\n//@ sourceURL=chaijs-chai/lib/chai/interface/expect.js"
261
- ));
262
- require.register("chaijs-chai/lib/chai/interface/should.js", Function("exports, require, module",
263
- "/*!\n * chai\n * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nmodule.exports = function (chai, util) {\n var Assertion = chai.Assertion;\n\n function loadShould () {\n // modify Object.prototype to have `should`\n Object.defineProperty(Object.prototype, 'should',\n {\n set: function (value) {\n // See https://github.com/chaijs/chai/issues/86: this makes\n // `whatever.should = someValue` actually set `someValue`, which is\n // especially useful for `global.should = require('chai').should()`.\n //\n // Note that we have to use [[DefineProperty]] instead of [[Put]]\n // since otherwise we would trigger this very setter!\n Object.defineProperty(this, 'should', {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n }\n , get: function(){\n if (this instanceof String || this instanceof Number) {\n return new Assertion(this.constructor(this));\n } else if (this instanceof Boolean) {\n return new Assertion(this == true);\n }\n return new Assertion(this);\n }\n , configurable: true\n });\n\n var should = {};\n\n should.equal = function (val1, val2, msg) {\n new Assertion(val1, msg).to.equal(val2);\n };\n\n should.Throw = function (fn, errt, errs, msg) {\n new Assertion(fn, msg).to.Throw(errt, errs);\n };\n\n should.exist = function (val, msg) {\n new Assertion(val, msg).to.exist;\n }\n\n // negation\n should.not = {}\n\n should.not.equal = function (val1, val2, msg) {\n new Assertion(val1, msg).to.not.equal(val2);\n };\n\n should.not.Throw = function (fn, errt, errs, msg) {\n new Assertion(fn, msg).to.not.Throw(errt, errs);\n };\n\n should.not.exist = function (val, msg) {\n new Assertion(val, msg).to.not.exist;\n }\n\n should['throw'] = should['Throw'];\n should.not['throw'] = should.not['Throw'];\n\n return should;\n };\n\n chai.should = loadShould;\n chai.Should = loadShould;\n};\n//@ sourceURL=chaijs-chai/lib/chai/interface/should.js"
264
- ));
265
- require.register("chaijs-chai/lib/chai/utils/addChainableMethod.js", Function("exports, require, module",
266
- "/*!\n * Chai - addChainingMethod utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependencies\n */\n\nvar transferFlags = require('./transferFlags');\n\n/*!\n * Module variables\n */\n\n// Check whether `__proto__` is supported\nvar hasProtoSupport = '__proto__' in Object;\n\n// Without `__proto__` support, this module will need to add properties to a function.\n// However, some Function.prototype methods cannot be overwritten,\n// and there seems no easy cross-platform way to detect them (@see chaijs/chai/issues/69).\nvar excludeNames = /^(?:length|name|arguments|caller)$/;\n\n// Cache `Function` properties\nvar call = Function.prototype.call,\n apply = Function.prototype.apply;\n\n/**\n * ### addChainableMethod (ctx, name, method, chainingBehavior)\n *\n * Adds a method to an object, such that the method can also be chained.\n *\n * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {\n * var obj = utils.flag(this, 'object');\n * new chai.Assertion(obj).to.be.equal(str);\n * });\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);\n *\n * The result can then be used as both a method assertion, executing both `method` and\n * `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.\n *\n * expect(fooStr).to.be.foo('bar');\n * expect(fooStr).to.be.foo.equal('foo');\n *\n * @param {Object} ctx object to which the method is added\n * @param {String} name of method to add\n * @param {Function} method function to be used for `name`, when called\n * @param {Function} chainingBehavior function to be called every time the property is accessed\n * @name addChainableMethod\n * @api public\n */\n\nmodule.exports = function (ctx, name, method, chainingBehavior) {\n if (typeof chainingBehavior !== 'function')\n chainingBehavior = function () { };\n\n Object.defineProperty(ctx, name,\n { get: function () {\n chainingBehavior.call(this);\n\n var assert = function () {\n var result = method.apply(this, arguments);\n return result === undefined ? this : result;\n };\n\n // Use `__proto__` if available\n if (hasProtoSupport) {\n // Inherit all properties from the object by replacing the `Function` prototype\n var prototype = assert.__proto__ = Object.create(this);\n // Restore the `call` and `apply` methods from `Function`\n prototype.call = call;\n prototype.apply = apply;\n }\n // Otherwise, redefine all properties (slow!)\n else {\n var asserterNames = Object.getOwnPropertyNames(ctx);\n asserterNames.forEach(function (asserterName) {\n if (!excludeNames.test(asserterName)) {\n var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);\n Object.defineProperty(assert, asserterName, pd);\n }\n });\n }\n\n transferFlags(this, assert);\n return assert;\n }\n , configurable: true\n });\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/addChainableMethod.js"
267
- ));
268
- require.register("chaijs-chai/lib/chai/utils/addMethod.js", Function("exports, require, module",
269
- "/*!\n * Chai - addMethod utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .addMethod (ctx, name, method)\n *\n * Adds a method to the prototype of an object.\n *\n * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {\n * var obj = utils.flag(this, 'object');\n * new chai.Assertion(obj).to.be.equal(str);\n * });\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.addMethod('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(fooStr).to.be.foo('bar');\n *\n * @param {Object} ctx object to which the method is added\n * @param {String} name of method to add\n * @param {Function} method function to be used for name\n * @name addMethod\n * @api public\n */\n\nmodule.exports = function (ctx, name, method) {\n ctx[name] = function () {\n var result = method.apply(this, arguments);\n return result === undefined ? this : result;\n };\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/addMethod.js"
270
- ));
271
- require.register("chaijs-chai/lib/chai/utils/addProperty.js", Function("exports, require, module",
272
- "/*!\n * Chai - addProperty utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### addProperty (ctx, name, getter)\n *\n * Adds a property to the prototype of an object.\n *\n * utils.addProperty(chai.Assertion.prototype, 'foo', function () {\n * var obj = utils.flag(this, 'object');\n * new chai.Assertion(obj).to.be.instanceof(Foo);\n * });\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.addProperty('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(myFoo).to.be.foo;\n *\n * @param {Object} ctx object to which the property is added\n * @param {String} name of property to add\n * @param {Function} getter function to be used for name\n * @name addProperty\n * @api public\n */\n\nmodule.exports = function (ctx, name, getter) {\n Object.defineProperty(ctx, name,\n { get: function () {\n var result = getter.call(this);\n return result === undefined ? this : result;\n }\n , configurable: true\n });\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/addProperty.js"
273
- ));
274
- require.register("chaijs-chai/lib/chai/utils/eql.js", Function("exports, require, module",
275
- "// This is (almost) directly from Node.js assert\n// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/assert.js\n\nmodule.exports = _deepEqual;\n\nvar getEnumerableProperties = require('./getEnumerableProperties');\n\n// for the browser\nvar Buffer;\ntry {\n Buffer = require('buffer').Buffer;\n} catch (ex) {\n Buffer = {\n isBuffer: function () { return false; }\n };\n}\n\nfunction _deepEqual(actual, expected, memos) {\n\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n\n } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {\n if (actual.length != expected.length) return false;\n\n for (var i = 0; i < actual.length; i++) {\n if (actual[i] !== expected[i]) return false;\n }\n\n return true;\n\n // 7.2. If the expected value is a Date object, the actual value is\n // equivalent if it is also a Date object that refers to the same time.\n } else if (expected instanceof Date) {\n if (!(actual instanceof Date)) return false;\n return actual.getTime() === expected.getTime();\n\n // 7.3. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if (typeof actual != 'object' && typeof expected != 'object') {\n return actual === expected;\n\n } else if (expected instanceof RegExp) {\n if (!(actual instanceof RegExp)) return false;\n return actual.toString() === expected.toString();\n\n // 7.4. For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n } else {\n return objEquiv(actual, expected, memos);\n }\n}\n\nfunction isUndefinedOrNull(value) {\n return value === null || value === undefined;\n}\n\nfunction isArguments(object) {\n return Object.prototype.toString.call(object) == '[object Arguments]';\n}\n\nfunction objEquiv(a, b, memos) {\n if (isUndefinedOrNull(a) || isUndefinedOrNull(b))\n return false;\n\n // an identical 'prototype' property.\n if (a.prototype !== b.prototype) return false;\n\n // check if we have already compared a and b\n var i;\n if (memos) {\n for(i = 0; i < memos.length; i++) {\n if ((memos[i][0] === a && memos[i][1] === b) ||\n (memos[i][0] === b && memos[i][1] === a))\n return true;\n }\n } else {\n memos = [];\n }\n\n //~~~I've managed to break Object.keys through screwy arguments passing.\n // Converting to array solves the problem.\n if (isArguments(a)) {\n if (!isArguments(b)) {\n return false;\n }\n a = pSlice.call(a);\n b = pSlice.call(b);\n return _deepEqual(a, b, memos);\n }\n try {\n var ka = getEnumerableProperties(a),\n kb = getEnumerableProperties(b),\n key;\n } catch (e) {//happens when one is a string literal and the other isn't\n return false;\n }\n\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length != kb.length)\n return false;\n\n //the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n //~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i])\n return false;\n }\n\n // remember objects we have compared to guard against circular references\n memos.push([ a, b ]);\n\n //equivalent values for every corresponding key, and\n //~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!_deepEqual(a[key], b[key], memos)) return false;\n }\n\n return true;\n}\n//@ sourceURL=chaijs-chai/lib/chai/utils/eql.js"
276
- ));
277
- require.register("chaijs-chai/lib/chai/utils/flag.js", Function("exports, require, module",
278
- "/*!\n * Chai - flag utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### flag(object ,key, [value])\n *\n * Get or set a flag value on an object. If a\n * value is provided it will be set, else it will\n * return the currently set value or `undefined` if\n * the value is not set.\n *\n * utils.flag(this, 'foo', 'bar'); // setter\n * utils.flag(this, 'foo'); // getter, returns `bar`\n *\n * @param {Object} object (constructed Assertion\n * @param {String} key\n * @param {Mixed} value (optional)\n * @name flag\n * @api private\n */\n\nmodule.exports = function (obj, key, value) {\n var flags = obj.__flags || (obj.__flags = Object.create(null));\n if (arguments.length === 3) {\n flags[key] = value;\n } else {\n return flags[key];\n }\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/flag.js"
279
- ));
280
- require.register("chaijs-chai/lib/chai/utils/getActual.js", Function("exports, require, module",
281
- "/*!\n * Chai - getActual utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * # getActual(object, [actual])\n *\n * Returns the `actual` value for an Assertion\n *\n * @param {Object} object (constructed Assertion)\n * @param {Arguments} chai.Assertion.prototype.assert arguments\n */\n\nmodule.exports = function (obj, args) {\n var actual = args[4];\n return 'undefined' !== typeof actual ? actual : obj._obj;\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/getActual.js"
282
- ));
283
- require.register("chaijs-chai/lib/chai/utils/getEnumerableProperties.js", Function("exports, require, module",
284
- "/*!\n * Chai - getEnumerableProperties utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .getEnumerableProperties(object)\n *\n * This allows the retrieval of enumerable property names of an object,\n * inherited or not.\n *\n * @param {Object} object\n * @returns {Array}\n * @name getEnumerableProperties\n * @api public\n */\n\nmodule.exports = function getEnumerableProperties(object) {\n var result = [];\n for (var name in object) {\n result.push(name);\n }\n return result;\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/getEnumerableProperties.js"
285
- ));
286
- require.register("chaijs-chai/lib/chai/utils/getMessage.js", Function("exports, require, module",
287
- "/*!\n * Chai - message composition utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependancies\n */\n\nvar flag = require('./flag')\n , getActual = require('./getActual')\n , inspect = require('./inspect')\n , objDisplay = require('./objDisplay');\n\n/**\n * ### .getMessage(object, message, negateMessage)\n *\n * Construct the error message based on flags\n * and template tags. Template tags will return\n * a stringified inspection of the object referenced.\n *\n * Message template tags:\n * - `#{this}` current asserted object\n * - `#{act}` actual value\n * - `#{exp}` expected value\n *\n * @param {Object} object (constructed Assertion)\n * @param {Arguments} chai.Assertion.prototype.assert arguments\n * @name getMessage\n * @api public\n */\n\nmodule.exports = function (obj, args) {\n var negate = flag(obj, 'negate')\n , val = flag(obj, 'object')\n , expected = args[3]\n , actual = getActual(obj, args)\n , msg = negate ? args[2] : args[1]\n , flagMsg = flag(obj, 'message');\n\n msg = msg || '';\n msg = msg\n .replace(/#{this}/g, objDisplay(val))\n .replace(/#{act}/g, objDisplay(actual))\n .replace(/#{exp}/g, objDisplay(expected));\n\n return flagMsg ? flagMsg + ': ' + msg : msg;\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/getMessage.js"
288
- ));
289
- require.register("chaijs-chai/lib/chai/utils/getName.js", Function("exports, require, module",
290
- "/*!\n * Chai - getName utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * # getName(func)\n *\n * Gets the name of a function, in a cross-browser way.\n *\n * @param {Function} a function (usually a constructor)\n */\n\nmodule.exports = function (func) {\n if (func.name) return func.name;\n\n var match = /^\\s?function ([^(]*)\\(/.exec(func);\n return match && match[1] ? match[1] : \"\";\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/getName.js"
291
- ));
292
- require.register("chaijs-chai/lib/chai/utils/getPathValue.js", Function("exports, require, module",
293
- "/*!\n * Chai - getPathValue utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * @see https://github.com/logicalparadox/filtr\n * MIT Licensed\n */\n\n/**\n * ### .getPathValue(path, object)\n *\n * This allows the retrieval of values in an\n * object given a string path.\n *\n * var obj = {\n * prop1: {\n * arr: ['a', 'b', 'c']\n * , str: 'Hello'\n * }\n * , prop2: {\n * arr: [ { nested: 'Universe' } ]\n * , str: 'Hello again!'\n * }\n * }\n *\n * The following would be the results.\n *\n * getPathValue('prop1.str', obj); // Hello\n * getPathValue('prop1.att[2]', obj); // b\n * getPathValue('prop2.arr[0].nested', obj); // Universe\n *\n * @param {String} path\n * @param {Object} object\n * @returns {Object} value or `undefined`\n * @name getPathValue\n * @api public\n */\n\nvar getPathValue = module.exports = function (path, obj) {\n var parsed = parsePath(path);\n return _getPathValue(parsed, obj);\n};\n\n/*!\n * ## parsePath(path)\n *\n * Helper function used to parse string object\n * paths. Use in conjunction with `_getPathValue`.\n *\n * var parsed = parsePath('myobject.property.subprop');\n *\n * ### Paths:\n *\n * * Can be as near infinitely deep and nested\n * * Arrays are also valid using the formal `myobject.document[3].property`.\n *\n * @param {String} path\n * @returns {Object} parsed\n * @api private\n */\n\nfunction parsePath (path) {\n var str = path.replace(/\\[/g, '.[')\n , parts = str.match(/(\\\\\\.|[^.]+?)+/g);\n return parts.map(function (value) {\n var re = /\\[(\\d+)\\]$/\n , mArr = re.exec(value)\n if (mArr) return { i: parseFloat(mArr[1]) };\n else return { p: value };\n });\n};\n\n/*!\n * ## _getPathValue(parsed, obj)\n *\n * Helper companion function for `.parsePath` that returns\n * the value located at the parsed address.\n *\n * var value = getPathValue(parsed, obj);\n *\n * @param {Object} parsed definition from `parsePath`.\n * @param {Object} object to search against\n * @returns {Object|Undefined} value\n * @api private\n */\n\nfunction _getPathValue (parsed, obj) {\n var tmp = obj\n , res;\n for (var i = 0, l = parsed.length; i < l; i++) {\n var part = parsed[i];\n if (tmp) {\n if ('undefined' !== typeof part.p)\n tmp = tmp[part.p];\n else if ('undefined' !== typeof part.i)\n tmp = tmp[part.i];\n if (i == (l - 1)) res = tmp;\n } else {\n res = undefined;\n }\n }\n return res;\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/getPathValue.js"
294
- ));
295
- require.register("chaijs-chai/lib/chai/utils/getProperties.js", Function("exports, require, module",
296
- "/*!\n * Chai - getProperties utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .getProperties(object)\n *\n * This allows the retrieval of property names of an object, enumerable or not,\n * inherited or not.\n *\n * @param {Object} object\n * @returns {Array}\n * @name getProperties\n * @api public\n */\n\nmodule.exports = function getProperties(object) {\n var result = Object.getOwnPropertyNames(subject);\n\n function addProperty(property) {\n if (result.indexOf(property) === -1) {\n result.push(property);\n }\n }\n\n var proto = Object.getPrototypeOf(subject);\n while (proto !== null) {\n Object.getOwnPropertyNames(proto).forEach(addProperty);\n proto = Object.getPrototypeOf(proto);\n }\n\n return result;\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/getProperties.js"
297
- ));
298
- require.register("chaijs-chai/lib/chai/utils/index.js", Function("exports, require, module",
299
- "/*!\n * chai\n * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Main exports\n */\n\nvar exports = module.exports = {};\n\n/*!\n * test utility\n */\n\nexports.test = require('./test');\n\n/*!\n * type utility\n */\n\nexports.type = require('./type');\n\n/*!\n * message utility\n */\n\nexports.getMessage = require('./getMessage');\n\n/*!\n * actual utility\n */\n\nexports.getActual = require('./getActual');\n\n/*!\n * Inspect util\n */\n\nexports.inspect = require('./inspect');\n\n/*!\n * Object Display util\n */\n\nexports.objDisplay = require('./objDisplay');\n\n/*!\n * Flag utility\n */\n\nexports.flag = require('./flag');\n\n/*!\n * Flag transferring utility\n */\n\nexports.transferFlags = require('./transferFlags');\n\n/*!\n * Deep equal utility\n */\n\nexports.eql = require('./eql');\n\n/*!\n * Deep path value\n */\n\nexports.getPathValue = require('./getPathValue');\n\n/*!\n * Function name\n */\n\nexports.getName = require('./getName');\n\n/*!\n * add Property\n */\n\nexports.addProperty = require('./addProperty');\n\n/*!\n * add Method\n */\n\nexports.addMethod = require('./addMethod');\n\n/*!\n * overwrite Property\n */\n\nexports.overwriteProperty = require('./overwriteProperty');\n\n/*!\n * overwrite Method\n */\n\nexports.overwriteMethod = require('./overwriteMethod');\n\n/*!\n * Add a chainable method\n */\n\nexports.addChainableMethod = require('./addChainableMethod');\n\n//@ sourceURL=chaijs-chai/lib/chai/utils/index.js"
300
- ));
301
- require.register("chaijs-chai/lib/chai/utils/inspect.js", Function("exports, require, module",
302
- "// This is (almost) directly from Node.js utils\n// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js\n\nvar getName = require('./getName');\nvar getProperties = require('./getProperties');\nvar getEnumerableProperties = require('./getEnumerableProperties');\n\nmodule.exports = inspect;\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Boolean} showHidden Flag that shows hidden (not enumerable)\n * properties of objects.\n * @param {Number} depth Depth in which to descend in object. Default is 2.\n * @param {Boolean} colors Flag to turn on ANSI escape codes to color the\n * output. Default is false (no coloring).\n */\nfunction inspect(obj, showHidden, depth, colors) {\n var ctx = {\n showHidden: showHidden,\n seen: [],\n stylize: function (str) { return str; }\n };\n return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth));\n}\n\n// https://gist.github.com/1044128/\nvar getOuterHTML = function(element) {\n if ('outerHTML' in element) return element.outerHTML;\n var ns = \"http://www.w3.org/1999/xhtml\";\n var container = document.createElementNS(ns, '_');\n var elemProto = (window.HTMLElement || window.Element).prototype;\n var xmlSerializer = new XMLSerializer();\n var html;\n if (document.xmlVersion) {\n return xmlSerializer.serializeToString(element);\n } else {\n container.appendChild(element.cloneNode(false));\n html = container.innerHTML.replace('><', '>' + element.innerHTML + '<');\n container.innerHTML = '';\n return html;\n }\n};\n\n// Returns true if object is a DOM element.\nvar isDOMElement = function (object) {\n if (typeof HTMLElement === 'object') {\n return object instanceof HTMLElement;\n } else {\n return object &&\n typeof object === 'object' &&\n object.nodeType === 1 &&\n typeof object.nodeName === 'string';\n }\n};\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (value && typeof value.inspect === 'function' &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes);\n if (typeof ret !== 'string') {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // If it's DOM elem, get outer HTML.\n if (isDOMElement(value)) {\n return getOuterHTML(value);\n }\n\n // Look up the keys of the object.\n var visibleKeys = getEnumerableProperties(value);\n var keys = ctx.showHidden ? getProperties(value) : visibleKeys;\n\n // Some type of object without properties can be shortcutted.\n // In IE, errors have a single `stack` property, or if they are vanilla `Error`,\n // a `stack` plus `description` property; ignore those for consistency.\n if (keys.length === 0 || (isError(value) && (\n (keys.length === 1 && keys[0] === 'stack') ||\n (keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack')\n ))) {\n if (typeof value === 'function') {\n var name = getName(value);\n var nameSuffix = name ? ': ' + name : '';\n return ctx.stylize('[Function' + nameSuffix + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toUTCString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (typeof value === 'function') {\n var name = getName(value);\n var nameSuffix = name ? ': ' + name : '';\n base = ' [Function' + nameSuffix + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n return formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n switch (typeof value) {\n case 'undefined':\n return ctx.stylize('undefined', 'undefined');\n\n case 'string':\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n\n case 'number':\n return ctx.stylize('' + value, 'number');\n\n case 'boolean':\n return ctx.stylize('' + value, 'boolean');\n }\n // For some reason typeof null is \"object\", so special case here.\n if (value === null) {\n return ctx.stylize('null', 'null');\n }\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (Object.prototype.hasOwnProperty.call(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str;\n if (value.__lookupGetter__) {\n if (value.__lookupGetter__(key)) {\n if (value.__lookupSetter__(key)) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (value.__lookupSetter__(key)) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n }\n if (visibleKeys.indexOf(key) < 0) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(value[key]) < 0) {\n if (recurseTimes === null) {\n str = formatValue(ctx, value[key], null);\n } else {\n str = formatValue(ctx, value[key], recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (typeof name === 'undefined') {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\nfunction isArray(ar) {\n return Array.isArray(ar) ||\n (typeof ar === 'object' && objectToString(ar) === '[object Array]');\n}\n\nfunction isRegExp(re) {\n return typeof re === 'object' && objectToString(re) === '[object RegExp]';\n}\n\nfunction isDate(d) {\n return typeof d === 'object' && objectToString(d) === '[object Date]';\n}\n\nfunction isError(e) {\n return typeof e === 'object' && objectToString(e) === '[object Error]';\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n//@ sourceURL=chaijs-chai/lib/chai/utils/inspect.js"
303
- ));
304
- require.register("chaijs-chai/lib/chai/utils/objDisplay.js", Function("exports, require, module",
305
- "/*!\n * Chai - flag utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependancies\n */\n\nvar inspect = require('./inspect');\n\n/**\n * ### .objDisplay (object)\n *\n * Determines if an object or an array matches\n * criteria to be inspected in-line for error\n * messages or should be truncated.\n *\n * @param {Mixed} javascript object to inspect\n * @name objDisplay\n * @api public\n */\n\nmodule.exports = function (obj) {\n var str = inspect(obj)\n , type = Object.prototype.toString.call(obj);\n\n if (str.length >= 40) {\n if (type === '[object Function]') {\n return !obj.name || obj.name === ''\n ? '[Function]'\n : '[Function: ' + obj.name + ']';\n } else if (type === '[object Array]') {\n return '[ Array(' + obj.length + ') ]';\n } else if (type === '[object Object]') {\n var keys = Object.keys(obj)\n , kstr = keys.length > 2\n ? keys.splice(0, 2).join(', ') + ', ...'\n : keys.join(', ');\n return '{ Object (' + kstr + ') }';\n } else {\n return str;\n }\n } else {\n return str;\n }\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/objDisplay.js"
306
- ));
307
- require.register("chaijs-chai/lib/chai/utils/overwriteMethod.js", Function("exports, require, module",
308
- "/*!\n * Chai - overwriteMethod utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### overwriteMethod (ctx, name, fn)\n *\n * Overwites an already existing method and provides\n * access to previous function. Must return function\n * to be used for name.\n *\n * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {\n * return function (str) {\n * var obj = utils.flag(this, 'object');\n * if (obj instanceof Foo) {\n * new chai.Assertion(obj.value).to.equal(str);\n * } else {\n * _super.apply(this, arguments);\n * }\n * }\n * });\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.overwriteMethod('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(myFoo).to.equal('bar');\n *\n * @param {Object} ctx object whose method is to be overwritten\n * @param {String} name of method to overwrite\n * @param {Function} method function that returns a function to be used for name\n * @name overwriteMethod\n * @api public\n */\n\nmodule.exports = function (ctx, name, method) {\n var _method = ctx[name]\n , _super = function () { return this; };\n\n if (_method && 'function' === typeof _method)\n _super = _method;\n\n ctx[name] = function () {\n var result = method(_super).apply(this, arguments);\n return result === undefined ? this : result;\n }\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/overwriteMethod.js"
309
- ));
310
- require.register("chaijs-chai/lib/chai/utils/overwriteProperty.js", Function("exports, require, module",
311
- "/*!\n * Chai - overwriteProperty utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### overwriteProperty (ctx, name, fn)\n *\n * Overwites an already existing property getter and provides\n * access to previous value. Must return function to use as getter.\n *\n * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {\n * return function () {\n * var obj = utils.flag(this, 'object');\n * if (obj instanceof Foo) {\n * new chai.Assertion(obj.name).to.equal('bar');\n * } else {\n * _super.call(this);\n * }\n * }\n * });\n *\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.overwriteProperty('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(myFoo).to.be.ok;\n *\n * @param {Object} ctx object whose property is to be overwritten\n * @param {String} name of property to overwrite\n * @param {Function} getter function that returns a getter function to be used for name\n * @name overwriteProperty\n * @api public\n */\n\nmodule.exports = function (ctx, name, getter) {\n var _get = Object.getOwnPropertyDescriptor(ctx, name)\n , _super = function () {};\n\n if (_get && 'function' === typeof _get.get)\n _super = _get.get\n\n Object.defineProperty(ctx, name,\n { get: function () {\n var result = getter(_super).call(this);\n return result === undefined ? this : result;\n }\n , configurable: true\n });\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/overwriteProperty.js"
312
- ));
313
- require.register("chaijs-chai/lib/chai/utils/test.js", Function("exports, require, module",
314
- "/*!\n * Chai - test utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependancies\n */\n\nvar flag = require('./flag');\n\n/**\n * # test(object, expression)\n *\n * Test and object for expression.\n *\n * @param {Object} object (constructed Assertion)\n * @param {Arguments} chai.Assertion.prototype.assert arguments\n */\n\nmodule.exports = function (obj, args) {\n var negate = flag(obj, 'negate')\n , expr = args[0];\n return negate ? !expr : expr;\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/test.js"
315
- ));
316
- require.register("chaijs-chai/lib/chai/utils/transferFlags.js", Function("exports, require, module",
317
- "/*!\n * Chai - transferFlags utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### transferFlags(assertion, object, includeAll = true)\n *\n * Transfer all the flags for `assertion` to `object`. If\n * `includeAll` is set to `false`, then the base Chai\n * assertion flags (namely `object`, `ssfi`, and `message`)\n * will not be transferred.\n *\n *\n * var newAssertion = new Assertion();\n * utils.transferFlags(assertion, newAssertion);\n *\n * var anotherAsseriton = new Assertion(myObj);\n * utils.transferFlags(assertion, anotherAssertion, false);\n *\n * @param {Assertion} assertion the assertion to transfer the flags from\n * @param {Object} object the object to transfer the flags too; usually a new assertion\n * @param {Boolean} includeAll\n * @name getAllFlags\n * @api private\n */\n\nmodule.exports = function (assertion, object, includeAll) {\n var flags = assertion.__flags || (assertion.__flags = Object.create(null));\n\n if (!object.__flags) {\n object.__flags = Object.create(null);\n }\n\n includeAll = arguments.length === 3 ? includeAll : true;\n\n for (var flag in flags) {\n if (includeAll ||\n (flag !== 'object' && flag !== 'ssfi' && flag != 'message')) {\n object.__flags[flag] = flags[flag];\n }\n }\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/transferFlags.js"
318
- ));
319
- require.register("chaijs-chai/lib/chai/utils/type.js", Function("exports, require, module",
320
- "/*!\n * Chai - type utility\n * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Detectable javascript natives\n */\n\nvar natives = {\n '[object Arguments]': 'arguments'\n , '[object Array]': 'array'\n , '[object Date]': 'date'\n , '[object Function]': 'function'\n , '[object Number]': 'number'\n , '[object RegExp]': 'regexp'\n , '[object String]': 'string'\n};\n\n/**\n * ### type(object)\n *\n * Better implementation of `typeof` detection that can\n * be used cross-browser. Handles the inconsistencies of\n * Array, `null`, and `undefined` detection.\n *\n * utils.type({}) // 'object'\n * utils.type(null) // `null'\n * utils.type(undefined) // `undefined`\n * utils.type([]) // `array`\n *\n * @param {Mixed} object to detect type of\n * @name type\n * @api private\n */\n\nmodule.exports = function (obj) {\n var str = Object.prototype.toString.call(obj);\n if (natives[str]) return natives[str];\n if (obj === null) return 'null';\n if (obj === undefined) return 'undefined';\n if (obj === Object(obj)) return 'object';\n return typeof obj;\n};\n//@ sourceURL=chaijs-chai/lib/chai/utils/type.js"
321
- ));
322
241
  require.register("indemma/index.js", Function("exports, require, module",
323
242
  "module.exports = require('./lib/record');\n//@ sourceURL=indemma/index.js"
324
243
  ));
@@ -332,10 +251,10 @@ require.register("indemma/vendor/owl/pluralize.js", Function("exports, require,
332
251
  "/* This file is part of OWL Pluralization.\r\n\r\nOWL Pluralization is free software: you can redistribute it and/or \r\nmodify it under the terms of the GNU Lesser General Public License\r\nas published by the Free Software Foundation, either version 3 of\r\nthe License, or (at your option) any later version.\r\n\r\nOWL Pluralization is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\nGNU Lesser General Public License for more details.\r\n\r\nYou should have received a copy of the GNU Lesser General Public \r\nLicense along with OWL Pluralization. If not, see \r\n<http://www.gnu.org/licenses/>.\r\n*/\r\n\r\n// prepare the owl namespace.\r\nif ( typeof owl === 'undefined' ) owl = {};\r\n\r\nowl.pluralize = (function() {\r\n\tvar userDefined = {};\r\n\r\n\tfunction capitalizeSame(word, sampleWord) {\r\n\t\tif ( sampleWord.match(/^[A-Z]/) ) {\r\n\t\t\treturn word.charAt(0).toUpperCase() + word.slice(1);\r\n\t\t} else {\r\n\t\t\treturn word;\r\n\t\t}\r\n\t}\r\n\r\n\t// returns a plain Object having the given keys,\r\n\t// all with value 1, which can be used for fast lookups.\r\n\tfunction toKeys(keys) {\r\n\t\tkeys = keys.split(',');\r\n\t\tvar keysLength = keys.length;\r\n\t\tvar table = {};\r\n\t\tfor ( var i=0; i < keysLength; i++ ) {\r\n\t\t\ttable[ keys[i] ] = 1;\r\n\t\t}\r\n\t\treturn table;\r\n\t}\r\n\r\n\t// words that are always singular, always plural, or the same in both forms.\r\n\tvar uninflected = toKeys(\"aircraft,advice,blues,corn,molasses,equipment,gold,information,cotton,jewelry,kin,legislation,luck,luggage,moose,music,offspring,rice,silver,trousers,wheat,bison,bream,breeches,britches,carp,chassis,clippers,cod,contretemps,corps,debris,diabetes,djinn,eland,elk,flounder,gallows,graffiti,headquarters,herpes,high,homework,innings,jackanapes,mackerel,measles,mews,mumps,news,pincers,pliers,proceedings,rabies,salmon,scissors,sea,series,shears,species,swine,trout,tuna,whiting,wildebeest,pike,oats,tongs,dregs,snuffers,victuals,tweezers,vespers,pinchers,bellows,cattle\");\r\n\r\n\tvar irregular = {\r\n\t\t// pronouns\r\n\t\tI: 'we',\r\n\t\tyou: 'you',\r\n\t\the: 'they',\r\n\t\tit: 'they', // or them\r\n\t\tme: 'us',\r\n\t\tyou: 'you',\r\n\t\thim: 'them',\r\n\t\tthem: 'them',\r\n\t\tmyself: 'ourselves',\r\n\t\tyourself: 'yourselves',\r\n\t\thimself: 'themselves',\r\n\t\therself: 'themselves',\r\n\t\titself: 'themselves',\r\n\t\tthemself: 'themselves',\r\n\t\toneself: 'oneselves',\r\n\r\n\t\tchild: 'children',\r\n\t\tdwarf: 'dwarfs', // dwarfs are real; dwarves are fantasy.\r\n\t\tmongoose: 'mongooses',\r\n\t\tmythos: 'mythoi',\r\n\t\tox: 'oxen',\r\n\t\tsoliloquy: 'soliloquies',\r\n\t\ttrilby: 'trilbys',\r\n\t\tperson: 'people',\r\n\t\tforum: 'forums', // fora is ok but uncommon.\r\n\r\n\t\t// latin plural in popular usage.\r\n\t\tsyllabus: 'syllabi',\r\n\t\talumnus: 'alumni', \r\n\t\tgenus: 'genera',\r\n\t\tviscus: 'viscera',\r\n\t\tstigma: 'stigmata'\r\n\t};\r\n\r\n\tvar suffixRules = [\r\n\t\t// common suffixes\r\n\t\t[ /man$/i, 'men' ],\r\n\t\t[ /([lm])ouse$/i, '$1ice' ],\r\n\t\t[ /tooth$/i, 'teeth' ],\r\n\t\t[ /goose$/i, 'geese' ],\r\n\t\t[ /foot$/i, 'feet' ],\r\n\t\t[ /zoon$/i, 'zoa' ],\r\n\t\t[ /([tcsx])is$/i, '$1es' ],\r\n\r\n\t\t// fully assimilated suffixes\r\n\t\t[ /ix$/i, 'ices' ],\r\n\t\t[ /^(cod|mur|sil|vert)ex$/i, '$1ices' ],\r\n\t\t[ /^(agend|addend|memorand|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi)um$/i, '$1a' ],\r\n\t\t[ /^(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|\\w+hedr)on$/i, '$1a' ],\r\n\t\t[ /^(alumn|alg|vertebr)a$/i, '$1ae' ],\r\n\t\t\r\n\t\t// churches, classes, boxes, etc.\r\n\t\t[ /([cs]h|ss|x)$/i, '$1es' ],\r\n\r\n\t\t// words with -ves plural form\r\n\t\t[ /([aeo]l|[^d]ea|ar)f$/i, '$1ves' ],\r\n\t\t[ /([nlw]i)fe$/i, '$1ves' ],\r\n\r\n\t\t// -y\r\n\t\t[ /([aeiou])y$/i, '$1ys' ],\r\n\t\t[ /(^[A-Z][a-z]*)y$/, '$1ys' ], // case sensitive!\r\n\t\t[ /y$/i, 'ies' ],\r\n\r\n\t\t// -o\r\n\t\t[ /([aeiou])o$/i, '$1os' ],\r\n\t\t[ /^(pian|portic|albin|generalissim|manifest|archipelag|ghett|medic|armadill|guan|octav|command|infern|phot|ditt|jumb|pr|dynam|ling|quart|embry|lumbag|rhin|fiasc|magnet|styl|alt|contralt|sopran|bass|crescend|temp|cant|sol|kimon)o$/i, '$1os' ],\r\n\t\t[ /o$/i, 'oes' ],\r\n\r\n\t\t// words ending in s...\r\n\t\t[ /s$/i, 'ses' ]\r\n\t];\r\n\r\n\t// pluralizes the given singular noun. There are three ways to call it:\r\n\t// pluralize(noun) -> pluralNoun\r\n\t// Returns the plural of the given noun.\r\n\t// Example: \r\n\t// pluralize(\"person\") -> \"people\"\r\n\t// pluralize(\"me\") -> \"us\"\r\n\t//\r\n\t// pluralize(noun, count) -> plural or singular noun\r\n\t// Inflect the noun according to the count, returning the singular noun\r\n\t// if the count is 1.\r\n\t// Examples:\r\n\t// pluralize(\"person\", 3) -> \"people\"\r\n\t// pluralize(\"person\", 1) -> \"person\"\r\n\t// pluralize(\"person\", 0) -> \"people\"\r\n\t//\r\n\t// pluralize(noun, count, plural) -> plural or singular noun\r\n\t// you can provide an irregular plural yourself as the 3rd argument.\r\n\t// Example:\r\n\t// pluralize(\"château\", 2 \"châteaux\") -> \"châteaux\"\r\n\tfunction pluralize(word, count, plural) {\r\n\t\t// handle the empty string reasonably.\r\n\t\tif ( word === '' ) return '';\r\n\r\n\t\t// singular case.\r\n\t\tif ( count === 1 ) return word;\r\n\r\n\t\t// life is very easy if an explicit plural was provided.\r\n\t\tif ( typeof plural === 'string' ) return plural;\r\n\r\n\t\tvar lowerWord = word.toLowerCase();\r\n\r\n\t\t// user defined rules have the highest priority.\r\n\t\tif ( lowerWord in userDefined ) {\r\n\t\t\treturn capitalizeSame(userDefined[lowerWord], word);\r\n\t\t}\r\n\r\n\t\t// single letters are pluralized with 's, \"I got five A's on\r\n\t\t// my report card.\"\r\n\t\tif ( word.match(/^[A-Z]$/) ) return word + \"'s\";\r\n\r\n\t\t// some word don't change form when plural.\r\n\t\tif ( word.match(/fish$|ois$|sheep$|deer$|pox$|itis$/i) ) return word;\r\n\t\tif ( word.match(/^[A-Z][a-z]*ese$/) ) return word; // Nationalities.\r\n\t\tif ( lowerWord in uninflected ) return word;\r\n\r\n\t\t// there's a known set of words with irregular plural forms.\r\n\t\tif ( lowerWord in irregular ) {\r\n\t\t\treturn capitalizeSame(irregular[lowerWord], word);\r\n\t\t}\r\n\t\t\r\n\t\t// try to pluralize the word depending on its suffix.\r\n\t\tvar suffixRulesLength = suffixRules.length;\r\n\t\tfor ( var i=0; i < suffixRulesLength; i++ ) {\r\n\t\t\tvar rule = suffixRules[i];\r\n\t\t\tif ( word.match(rule[0]) ) {\r\n\t\t\t\treturn word.replace(rule[0], rule[1]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// if all else fails, just add s.\r\n\t\treturn word + 's';\r\n\t}\r\n\r\n\tpluralize.define = function(word, plural) {\r\n\t\tuserDefined[word.toLowerCase()] = plural;\r\n\t}\r\n\r\n\treturn pluralize;\r\n\r\n})();\r\n//@ sourceURL=indemma/vendor/owl/pluralize.js"
333
252
  ));
334
253
  require.register("indemma/lib/record.js", Function("exports, require, module",
335
- "var $, advisable, bind, extend, merge, observable, type,\n __slice = [].slice;\n\n$ = require('jquery');\n\ntype = require('type');\n\nbind = require('bind');\n\nobservable = require('observable').mixin;\n\nadvisable = require('advisable').mixin;\n\nextend = require('assimilate');\n\nmerge = require('assimilate').withStrategy('deep');\n\nthis.model = (function() {\n var initialize_record, mixer, modelable;\n\n modelable = {\n after_mix: [],\n record: {\n after_initialize: [],\n before_initialize: []\n },\n all: function() {\n return this.cache;\n },\n create: function() {\n var params;\n\n params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n throw 'model.create not implemented yet, try using the restful.model.create method';\n },\n where: function(conditions, first) {\n var record, results, _i, _len, _ref;\n\n if (first == null) {\n first = false;\n }\n results = [];\n if (type(conditions.id) !== 'array') {\n conditions.id = [conditions.id];\n }\n _ref = this.cache;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n record = _ref[_i];\n if (conditions.id.indexOf(record._id) !== -1) {\n if (first) {\n return record;\n } else {\n results.push(record);\n }\n }\n }\n if (first) {\n return null;\n } else {\n return results;\n }\n }\n };\n initialize_record = function(data) {\n var after_initialize, callback, creation, index, instance, _i, _j, _len, _len1, _ref, _ref1;\n\n if (data == null) {\n data = {\n resource: this.resource,\n parent_resource: this.parent_resource\n };\n }\n data.resource || (data.resource = this.resource);\n data.parent_resource || (data.parent_resource = this.resource.parent || this.parent_resource);\n data.route || (data.route = this.route);\n data.nested_attributes = this.nested_attributes || [];\n after_initialize = (data.after_initialize || []).concat(this.record.after_initialize);\n creation = extend(Object.create(data), this.record, creation, {\n after_initialize: after_initialize\n });\n _ref = this.record.before_initialize;\n for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {\n callback = _ref[index];\n callback.call(this, creation);\n }\n instance = record.call(creation);\n _ref1 = instance.after_initialize;\n for (index = _j = 0, _len1 = _ref1.length; _j < _len1; index = ++_j) {\n callback = _ref1[index];\n callback.call(instance, instance);\n }\n delete instance.after_initialize;\n return instance;\n };\n mixer = function(options) {\n var after_initialize, callback, instance, _i, _len, _ref;\n\n if (this === window) {\n throw 'Model mixin called incorrectly call with model.call {} instead of model({})';\n }\n if (!mixer.stale) {\n mixer.stale = true;\n }\n if (this.record && this.record.after_initialize) {\n after_initialize = this.record.after_initialize.splice(0);\n } else {\n after_initialize = [];\n }\n instance = bind(this, initialize_record);\n extend(instance, merge(this, modelable));\n this.record = instance.record = merge({}, instance.record, modelable.record);\n this.record.after_initialize = instance.record.after_initialize = instance.record.after_initialize.concat(after_initialize);\n this.record.before_initialize = instance.record.before_initialize.concat([]);\n _ref = modelable.after_mix;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n callback = _ref[_i];\n callback.call(instance, instance);\n }\n return mixer[this.resource.name || this.resource.toString()] = instance;\n };\n mixer.mix = function(blender) {\n if (this.stale) {\n throw \"Trying to change model mixin with \" + object + \" but model already used.\\nCheck your configuration order\";\n }\n return blender(modelable);\n };\n return mixer;\n})();\n\nthis.record = (function() {\n var callbacks, recordable, that;\n\n callbacks = {\n dirtify: function() {}\n };\n recordable = {\n dirty: false,\n after_initialize: [callbacks.dirtify]\n };\n that = function(data) {\n var after_initialize;\n\n if (this === window) {\n throw \"Mixin called incorrectly, call mixin with call method: record.call(object, data)\";\n }\n data || (data = {});\n after_initialize = (this.after_initialize || []).concat(data.after_initialize || []).concat(recordable.after_initialize);\n return advisable(observable(extend(this, recordable, data, {\n after_initialize: after_initialize\n })));\n };\n that.mix = function(blender) {\n return blender(recordable);\n };\n return that;\n})();\n\nexports.record = this.record;\n\nexports.model = this.model;\n//@ sourceURL=indemma/lib/record.js"
254
+ "var $, advisable, bind, extend, merge, observable, type,\n __slice = [].slice;\n\n$ = require('jquery');\n\ntype = require('type');\n\nbind = require('bind');\n\nobservable = require('observable').mixin;\n\nadvisable = require('advisable').mixin;\n\nextend = require('assimilate');\n\nmerge = require('assimilate').withStrategy('deep');\n\nthis.model = (function() {\n var initialize_record, mixer, modelable;\n\n modelable = {\n after_mix: [],\n record: {\n after_initialize: [],\n before_initialize: []\n },\n all: function() {\n return this.cache;\n },\n create: function() {\n var params;\n\n params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n throw 'model.create not implemented yet, try using the restful.model.create method';\n },\n where: function(conditions, first) {\n var record, results, _i, _len, _ref;\n\n if (first == null) {\n first = false;\n }\n results = [];\n if (type(conditions.id) !== 'array') {\n conditions.id = [conditions.id];\n }\n _ref = this.cache;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n record = _ref[_i];\n if (conditions.id.indexOf(record._id) !== -1) {\n if (first) {\n return record;\n } else {\n results.push(record);\n }\n }\n }\n if (first) {\n return null;\n } else {\n return results;\n }\n }\n };\n initialize_record = function(data) {\n var after_initialize, callback, creation, index, instance, _i, _j, _len, _len1, _ref, _ref1;\n\n if (data == null) {\n data = {\n resource: this.resource,\n parent_resource: this.parent_resource\n };\n }\n data.resource || (data.resource = this.resource);\n data.parent_resource || (data.parent_resource = this.resource.parent || this.parent_resource);\n data.route || (data.route = this.route);\n data.nested_attributes = this.nested_attributes || [];\n after_initialize = (data.after_initialize || []).concat(this.record.after_initialize);\n creation = extend(Object.create(data, {\n _shim: {}\n }), this.record, creation, {\n after_initialize: after_initialize\n });\n _ref = this.record.before_initialize;\n for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {\n callback = _ref[index];\n callback.call(this, creation);\n }\n instance = record.call(creation);\n _ref1 = instance.after_initialize;\n for (index = _j = 0, _len1 = _ref1.length; _j < _len1; index = ++_j) {\n callback = _ref1[index];\n callback.call(instance, instance);\n }\n delete instance.after_initialize;\n return instance;\n };\n mixer = function(options) {\n var after_initialize, callback, instance, _i, _len, _ref;\n\n if (this === window) {\n throw 'Model mixin called incorrectly call with model.call {} instead of model({})';\n }\n if (!mixer.stale) {\n mixer.stale = true;\n }\n if (this.record && this.record.after_initialize) {\n after_initialize = this.record.after_initialize.splice(0);\n } else {\n after_initialize = [];\n }\n instance = bind(this, initialize_record);\n extend(instance, merge(this, modelable));\n this.record = instance.record = merge({}, instance.record, modelable.record);\n this.record.after_initialize = instance.record.after_initialize = instance.record.after_initialize.concat(after_initialize);\n this.record.before_initialize = instance.record.before_initialize.concat([]);\n _ref = modelable.after_mix;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n callback = _ref[_i];\n callback.call(instance, instance);\n }\n return mixer[this.resource.name || this.resource.toString()] = instance;\n };\n mixer.mix = function(blender) {\n if (this.stale) {\n throw \"Trying to change model mixin with \" + object + \" but model already used.\\nCheck your configuration order\";\n }\n return blender(modelable);\n };\n return mixer;\n})();\n\nthis.record = (function() {\n var callbacks, recordable, that;\n\n callbacks = {\n dirtify: function() {}\n };\n recordable = {\n dirty: false,\n after_initialize: [callbacks.dirtify]\n };\n that = function(data) {\n var after_initialize;\n\n if (this === window) {\n throw \"Mixin called incorrectly, call mixin with call method: record.call(object, data)\";\n }\n data || (data = {});\n after_initialize = (this.after_initialize || []).concat(data.after_initialize || []).concat(recordable.after_initialize);\n return advisable(observable(extend(this, recordable, data, {\n after_initialize: after_initialize\n })));\n };\n that.mix = function(blender) {\n return blender(recordable);\n };\n return that;\n})();\n\nexports.record = this.record;\n\nexports.model = this.model;\n//@ sourceURL=indemma/lib/record.js"
336
255
  ));
337
256
  require.register("indemma/lib/record/associable.js", Function("exports, require, module",
338
- "var $, associable, callbacks, extend, model, modifiers, plural, root, singular, subscribers,\n __slice = [].slice;\n\nroot = window;\n\n$ = require('jquery');\n\nextend = require('assimilate');\n\nrequire('./resource');\n\nplural = {\n add: function() {\n var attributes, params, _i, _len, _results;\n\n params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n _results = [];\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n attributes = params[_i];\n _results.push(this.push(this.build(attributes)));\n }\n return _results;\n },\n create: function() {\n var attributes, params, record, _i, _len, _results;\n\n params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n _results = [];\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n attributes = params[_i];\n record = this.build(attributes);\n this.push(record);\n _results.push(record.save());\n }\n return _results;\n },\n build: function(data) {\n var _name;\n\n if (data == null) {\n data = {};\n }\n data.parent_resource = this.parent_resource;\n if (this.parent != null) {\n data.route || (data.route = \"\" + this.parent.route + \"/\" + this.parent._id + \"/\" + (model.pluralize(this.resource.toString())));\n }\n if (this.route !== data.route && this.route) {\n throw \"associable.has_many: cannot redefine route of association \" + this.parent_resource + \".\" + this.resource + \" from \" + this.route + \" to \" + data.route;\n }\n data[_name = this.parent_resource] || (data[_name] = this.parent);\n return model[model.singularize(this.resource)](data);\n },\n push: function() {\n console.warn(\"\" + this.resource + \".push is deprecated and will be removed, please use add instead\");\n return Array.prototype.push.apply(this, arguments);\n },\n length: 0,\n json: function(methods, omissions) {\n var record, _i, _len, _results;\n\n _results = [];\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n record = this[_i];\n _results.push(record.json(methods, omissions));\n }\n return _results;\n }\n};\n\nsingular = {\n create: function(data) {\n return model[this.resource].create(extend({}, this, data));\n },\n build: function(data) {\n return this.owner[this.resource.toString()] = model[this.resource.toString()](extend({}, this, data));\n }\n};\n\nsubscribers = {\n belongs_to: {\n foreign_key: function(resource_id) {\n var association_name, current_resource_id, resource, _ref;\n\n association_name = this.resource.toString();\n if (!resource_id) {\n this.dirty = true;\n this.owner[association_name] = resource_id;\n return resource_id;\n }\n current_resource_id = (_ref = this.owner.observed[association_name]) != null ? _ref._id : void 0;\n if (resource_id !== current_resource_id) {\n resource = model[association_name];\n if (!resource) {\n console.warn(\"subscribers.belongs_to.foreign_key: associated factory not found for model: \" + association_name);\n return resource_id;\n }\n this.owner.observed[association_name] = null;\n }\n return resource_id;\n },\n associated_changed: function(associated) {\n return this.owner.observed[\"\" + (this.resource.toString()) + \"_id\"] = associated ? associated._id : null;\n }\n }\n};\n\nmodifiers = {\n belongs_to: {\n associated_loader: function() {\n var association_name,\n _this = this;\n\n association_name = this.resource.toString();\n return Object.defineProperty(this.owner, association_name, {\n set: function(associated) {\n return this.observed[association_name] = associated;\n },\n get: function() {\n var associated, associated_id, resource;\n\n associated = _this.owner.observed[association_name];\n associated_id = _this.owner.observed[association_name + '_id'];\n if (!(((associated != null ? associated._id : void 0) != null) || associated_id)) {\n return associated;\n }\n if (associated != null ? associated.sustained : void 0) {\n return associated;\n }\n resource = model[association_name];\n if (!resource) {\n console.warn(\"subscribers.belongs_to.foreign_key: associated factory not found for model: \" + association_name);\n return associated;\n }\n associated = resource.find(associated_id || associated._id);\n if (associated) {\n return _this.owner.observed[association_name] = associated;\n }\n associated || (associated = resource({\n _id: associated_id\n }));\n associated.reload();\n return _this.owner.observed[association_name] = associated;\n },\n configurable: true,\n enumerable: true\n });\n }\n }\n};\n\ncallbacks = {\n has_many: {\n nest_attributes: function() {\n var association, association_name, association_names, associations_attributes, message, _i, _len, _results;\n\n association_names = model[this.resource].has_many;\n if (association_names) {\n _results = [];\n for (_i = 0, _len = association_names.length; _i < _len; _i++) {\n association_name = association_names[_i];\n associations_attributes = this[\"\" + association_name + \"_attributes\"];\n association = this[model.pluralize(association_name)];\n if (associations_attributes && associations_attributes.length) {\n if (!association) {\n message = \"has_many.nest_attributes: Association not found for \" + association_name + \". \\n\";\n message += \"did you set it on model declaration? \\n has_many: \" + association_name + \" \";\n throw message;\n }\n association.resource = model.singularize(association.resource);\n association.add.apply(association, associations_attributes);\n _results.push(association.resource = model.pluralize(association.resource));\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n }\n },\n update_association: function(data) {\n var associated, association, association_name, id, pluralized_association, _i, _j, _len, _len1, _ref;\n\n id = this._id || data && (data._id || data.id);\n if (!id) {\n return;\n }\n _ref = model[this.resource.toString()].has_many;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n association_name = _ref[_i];\n pluralized_association = model.pluralize(association_name);\n association = this[pluralized_association];\n if (!association.route) {\n association.route = \"/\" + (model.pluralize(this.resource.toString())) + \"/\" + id + \"/\" + (model.pluralize(association.resource));\n for (_j = 0, _len1 = association.length; _j < _len1; _j++) {\n associated = association[_j];\n if (!associated.route && (associated.parent != null)) {\n associated.route = \"/\" + (model.pluralize(this.resource.toString())) + \"/\" + id + \"/\" + (model.pluralize(association.resource));\n }\n }\n }\n }\n return true;\n },\n autosave: function() {\n throw 'Not implemented yet';\n }\n },\n has_one: {\n nest_attributes: function() {\n var association_name, association_names, associations_attributes, _i, _len, _results;\n\n association_names = model[this.resource].has_one;\n if (association_names) {\n _results = [];\n for (_i = 0, _len = association_names.length; _i < _len; _i++) {\n association_name = association_names[_i];\n associations_attributes = this[\"\" + association_name + \"_attributes\"];\n if (associations_attributes) {\n this[association_name] = this[\"build_\" + association_name](associations_attributes);\n _results.push(delete this[\"\" + association_name + \"_attributes\"]);\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n }\n }\n }\n};\n\nassociable = {\n model: {\n blender: function(definition) {\n var model;\n\n model = associable.model;\n this.create_after_hooks = model.create_after_hooks;\n this.create_before_hooks = model.create_before_hooks;\n if (this.has_many && $.type(this.has_many) !== 'array') {\n this.has_many = [this.has_many];\n }\n if (this.has_one && $.type(this.has_one) !== 'array') {\n this.has_one = [this.has_one];\n }\n if (this.belongs_to && $.type(this.belongs_to) !== 'array') {\n this.belongs_to = [this.belongs_to];\n }\n this.has_many || (this.has_many = []);\n this.has_one || (this.has_one = []);\n this.belongs_to || (this.belongs_to = []);\n return true;\n },\n create_after_hooks: function(definition) {\n var association_attributes, association_name, association_proxy, old_dirty, old_resource_id, options, resource, _i, _j, _k, _len, _len1, _len2, _name, _ref, _ref1, _ref2, _results;\n\n options = model[this.resource.name || this.resource.toString()];\n if (options.has_many) {\n _ref = options.has_many;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n resource = _ref[_i];\n association_proxy = {\n resource: resource,\n parent_resource: this.resource,\n parent: this\n };\n association_name = model.pluralize(resource);\n association_attributes = this[association_name] || [];\n this[_name = \"\" + association_name + \"_attributes\"] || (this[_name] = []);\n if (association_attributes.length) {\n this[\"\" + association_name + \"_attributes\"] = this[\"\" + association_name + \"_attributes\"].concat(association_attributes);\n }\n this[association_name] = $.extend(association_proxy, plural);\n }\n this.after('saved', callbacks.has_many.update_association);\n callbacks.has_many.nest_attributes.call(this);\n }\n if (options.has_one) {\n _ref1 = options.has_one;\n for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n resource = _ref1[_j];\n association_proxy = {\n resource: resource,\n parent_resource: this.resource,\n owner: this\n };\n association_proxy[this.resource.toString()] = this;\n this[\"build_\" + resource] = $.proxy(singular.build, association_proxy);\n this[\"create_\" + resource] = $.proxy(singular.create, association_proxy);\n }\n callbacks.has_one.nest_attributes.call(this);\n }\n if (options.belongs_to) {\n _ref2 = options.belongs_to;\n _results = [];\n for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {\n resource = _ref2[_k];\n association_proxy = {\n resource: resource,\n parent_resource: this.resource,\n parent: this,\n owner: this\n };\n association_proxy[this.resource.toString()] = this;\n this[\"build_\" + resource] = $.proxy(singular.build, association_proxy);\n this[\"create_\" + resource] = $.proxy(singular.create, association_proxy);\n old_resource_id = this[\"\" + resource + \"_id\"];\n old_dirty = this.dirty;\n this[\"\" + resource + \"_id\"] = null;\n this.subscribe(\"\" + resource + \"_id\", $.proxy(subscribers.belongs_to.foreign_key, association_proxy));\n this.subscribe(resource.toString(), $.proxy(subscribers.belongs_to.associated_changed, association_proxy));\n this[\"\" + resource + \"_id\"] = old_resource_id;\n _results.push(this.dirty = old_dirty);\n }\n return _results;\n }\n },\n create_before_hooks: function(record) {\n var association_proxy, definition, resource, _i, _len, _ref, _results;\n\n definition = this;\n if (definition.belongs_to) {\n _ref = definition.belongs_to;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n resource = _ref[_i];\n association_proxy = {\n resource: resource,\n parent_resource: this.resource,\n owner: record\n };\n _results.push(modifiers.belongs_to.associated_loader.call(association_proxy));\n }\n return _results;\n }\n }\n },\n record: {\n after_initialize: function(attributes) {\n if (this.resource == null) {\n throw new Error('resource must be defined in order to associate');\n }\n return model[this.resource.name || this.resource.toString()].create_after_hooks.call(this);\n },\n before_initialize: function(creation) {\n if (!this.resource) {\n throw new Error('resource must be defined in order to associate');\n }\n return model[this.resource.name || this.resource.toString()].create_before_hooks(creation);\n }\n }\n};\n\nmodel = root.model;\n\nmodel.mix(function(modelable) {\n modelable.after_mix.push(associable.model.blender);\n modelable.record.before_initialize.push(associable.record.before_initialize);\n return modelable.record.after_initialize.push(associable.record.after_initialize);\n});\n\nmodel.associable = {\n mix: function(blender) {\n return blender(singular, plural);\n }\n};\n//@ sourceURL=indemma/lib/record/associable.js"
257
+ "var $, associable, callbacks, extend, model, modifiers, plural, root, singular, subscribers,\n __slice = [].slice;\n\nroot = window;\n\n$ = require('jquery');\n\nextend = require('assimilate');\n\nrequire('./resource');\n\nplural = {\n add: function() {\n var attributes, params, _i, _len, _results;\n\n params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n _results = [];\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n attributes = params[_i];\n _results.push(this.push(this.build(attributes)));\n }\n return _results;\n },\n create: function() {\n var attributes, params, record, _i, _len, _results;\n\n params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n _results = [];\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n attributes = params[_i];\n record = this.build(attributes);\n this.push(record);\n _results.push(record.save());\n }\n return _results;\n },\n build: function(data) {\n var _name;\n\n if (data == null) {\n data = {};\n }\n data.parent_resource = this.parent_resource;\n if (this.parent != null) {\n data.route || (data.route = \"\" + this.parent.route + \"/\" + this.parent._id + \"/\" + (model.pluralize(this.resource.toString())));\n }\n if (this.route !== data.route && this.route) {\n throw \"associable.has_many: cannot redefine route of association \" + this.parent_resource + \".\" + this.resource + \" from \" + this.route + \" to \" + data.route;\n }\n data[_name = this.parent_resource] || (data[_name] = this.parent);\n return model[model.singularize(this.resource)](data);\n },\n push: function() {\n console.warn(\"\" + this.resource + \".push is deprecated and will be removed, please use add instead\");\n return Array.prototype.push.apply(this, arguments);\n },\n length: 0,\n json: function(methods, omissions) {\n var record, _i, _len, _results;\n\n _results = [];\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n record = this[_i];\n _results.push(record.json(methods, omissions));\n }\n return _results;\n }\n};\n\nsingular = {\n create: function(data) {\n return model[this.resource].create(extend({}, this, data));\n },\n build: function(data) {\n return this.owner[this.resource.toString()] = model[this.resource.toString()](extend({}, this, data));\n }\n};\n\nsubscribers = {\n belongs_to: {\n foreign_key: function(resource_id) {\n var association_name, current_resource_id, resource, _ref;\n\n association_name = this.resource.toString();\n if (!resource_id) {\n this.dirty = true;\n this.owner[association_name] = resource_id;\n return resource_id;\n }\n current_resource_id = (_ref = this.owner.observed[association_name]) != null ? _ref._id : void 0;\n if (resource_id !== current_resource_id) {\n resource = model[association_name];\n if (!resource) {\n console.warn(\"subscribers.belongs_to.foreign_key: associated factory not found for model: \" + association_name);\n return resource_id;\n }\n this.owner.observed[association_name] = null;\n }\n return resource_id;\n },\n associated_changed: function(associated) {\n return this.owner.observed[\"\" + (this.resource.toString()) + \"_id\"] = associated ? associated._id : null;\n }\n }\n};\n\nmodifiers = {\n belongs_to: {\n associated_loader: function() {\n var association_name, definition, temporary_observed,\n _this = this;\n\n association_name = this.resource.toString();\n if (this.owner.observed == null) {\n this.owner.observed = {};\n temporary_observed = true;\n }\n definition = Object.defineProperty(this.owner, association_name, {\n set: function(associated) {\n return this.observed[association_name] = associated;\n },\n get: function() {\n var associated, associated_id, resource;\n\n associated = _this.owner.observed[association_name];\n associated_id = _this.owner.observed[association_name + '_id'];\n if (!(((associated != null ? associated._id : void 0) != null) || associated_id)) {\n return associated;\n }\n if (associated != null ? associated.sustained : void 0) {\n return associated;\n }\n resource = model[association_name];\n if (!resource) {\n console.warn(\"subscribers.belongs_to.foreign_key: associated factory not found for model: \" + association_name);\n return associated;\n }\n associated = resource.find(associated_id || associated._id);\n if (associated) {\n return _this.owner.observed[association_name] = associated;\n }\n associated || (associated = resource({\n _id: associated_id\n }));\n associated.reload();\n return _this.owner.observed[association_name] = associated;\n },\n configurable: true,\n enumerable: true\n });\n if (temporary_observed) {\n delete this.owner.observed;\n }\n return definition;\n }\n }\n};\n\ncallbacks = {\n has_many: {\n nest_attributes: function() {\n var association, association_name, association_names, associations_attributes, message, _i, _len, _results;\n\n association_names = model[this.resource].has_many;\n if (association_names) {\n _results = [];\n for (_i = 0, _len = association_names.length; _i < _len; _i++) {\n association_name = association_names[_i];\n associations_attributes = this[\"\" + association_name + \"_attributes\"];\n association = this[model.pluralize(association_name)];\n if (associations_attributes && associations_attributes.length) {\n if (!association) {\n message = \"has_many.nest_attributes: Association not found for \" + association_name + \". \\n\";\n message += \"did you set it on model declaration? \\n has_many: \" + association_name + \" \";\n throw message;\n }\n association.resource = model.singularize(association.resource);\n association.add.apply(association, associations_attributes);\n _results.push(association.resource = model.pluralize(association.resource));\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n }\n },\n update_association: function(data) {\n var associated, association, association_name, id, pluralized_association, _i, _j, _len, _len1, _ref;\n\n id = this._id || data && (data._id || data.id);\n if (!id) {\n return;\n }\n _ref = model[this.resource.toString()].has_many;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n association_name = _ref[_i];\n pluralized_association = model.pluralize(association_name);\n association = this[pluralized_association];\n if (!association.route) {\n association.route = \"/\" + (model.pluralize(this.resource.toString())) + \"/\" + id + \"/\" + (model.pluralize(association.resource));\n for (_j = 0, _len1 = association.length; _j < _len1; _j++) {\n associated = association[_j];\n if (!associated.route && (associated.parent != null)) {\n associated.route = \"/\" + (model.pluralize(this.resource.toString())) + \"/\" + id + \"/\" + (model.pluralize(association.resource));\n }\n }\n }\n }\n return true;\n },\n autosave: function() {\n throw 'Not implemented yet';\n }\n },\n has_one: {\n nest_attributes: function() {\n var association_name, association_names, associations_attributes, _i, _len, _results;\n\n association_names = model[this.resource].has_one;\n if (association_names) {\n _results = [];\n for (_i = 0, _len = association_names.length; _i < _len; _i++) {\n association_name = association_names[_i];\n associations_attributes = this[\"\" + association_name + \"_attributes\"];\n if (associations_attributes) {\n this[association_name] = this[\"build_\" + association_name](associations_attributes);\n _results.push(delete this[\"\" + association_name + \"_attributes\"]);\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n }\n }\n }\n};\n\nassociable = {\n model: {\n blender: function(definition) {\n var model;\n\n model = associable.model;\n this.create_after_hooks = model.create_after_hooks;\n this.create_before_hooks = model.create_before_hooks;\n if (this.has_many && $.type(this.has_many) !== 'array') {\n this.has_many = [this.has_many];\n }\n if (this.has_one && $.type(this.has_one) !== 'array') {\n this.has_one = [this.has_one];\n }\n if (this.belongs_to && $.type(this.belongs_to) !== 'array') {\n this.belongs_to = [this.belongs_to];\n }\n this.has_many || (this.has_many = []);\n this.has_one || (this.has_one = []);\n this.belongs_to || (this.belongs_to = []);\n return true;\n },\n create_after_hooks: function(definition) {\n var association_attributes, association_name, association_proxy, old_dirty, old_resource_id, options, resource, _i, _j, _k, _len, _len1, _len2, _name, _ref, _ref1, _ref2, _results;\n\n options = model[this.resource.name || this.resource.toString()];\n if (options.has_many) {\n _ref = options.has_many;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n resource = _ref[_i];\n association_proxy = {\n resource: resource,\n parent_resource: this.resource,\n parent: this\n };\n association_name = model.pluralize(resource);\n association_attributes = this[association_name] || [];\n this[_name = \"\" + association_name + \"_attributes\"] || (this[_name] = []);\n if (association_attributes.length) {\n this[\"\" + association_name + \"_attributes\"] = this[\"\" + association_name + \"_attributes\"].concat(association_attributes);\n }\n this[association_name] = $.extend(association_proxy, plural);\n }\n this.after('saved', callbacks.has_many.update_association);\n callbacks.has_many.nest_attributes.call(this);\n }\n if (options.has_one) {\n _ref1 = options.has_one;\n for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n resource = _ref1[_j];\n association_proxy = {\n resource: resource,\n parent_resource: this.resource,\n owner: this\n };\n association_proxy[this.resource.toString()] = this;\n this[\"build_\" + resource] = $.proxy(singular.build, association_proxy);\n this[\"create_\" + resource] = $.proxy(singular.create, association_proxy);\n }\n callbacks.has_one.nest_attributes.call(this);\n }\n if (options.belongs_to) {\n _ref2 = options.belongs_to;\n _results = [];\n for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {\n resource = _ref2[_k];\n association_proxy = {\n resource: resource,\n parent_resource: this.resource,\n parent: this,\n owner: this\n };\n association_proxy[this.resource.toString()] = this;\n this[\"build_\" + resource] = $.proxy(singular.build, association_proxy);\n this[\"create_\" + resource] = $.proxy(singular.create, association_proxy);\n old_resource_id = this[\"\" + resource + \"_id\"];\n old_dirty = this.dirty;\n this[\"\" + resource + \"_id\"] = null;\n this.subscribe(\"\" + resource + \"_id\", $.proxy(subscribers.belongs_to.foreign_key, association_proxy));\n this.subscribe(resource.toString(), $.proxy(subscribers.belongs_to.associated_changed, association_proxy));\n this[\"\" + resource + \"_id\"] = old_resource_id;\n _results.push(this.dirty = old_dirty);\n }\n return _results;\n }\n },\n create_before_hooks: function(record) {\n var association_proxy, definition, resource, _i, _len, _ref, _results;\n\n definition = this;\n if (definition.belongs_to) {\n _ref = definition.belongs_to;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n resource = _ref[_i];\n association_proxy = {\n resource: resource,\n parent_resource: this.resource,\n owner: record\n };\n _results.push(modifiers.belongs_to.associated_loader.call(association_proxy));\n }\n return _results;\n }\n }\n },\n record: {\n after_initialize: function(attributes) {\n if (this.resource == null) {\n throw new Error('resource must be defined in order to associate');\n }\n return model[this.resource.name || this.resource.toString()].create_after_hooks.call(this);\n },\n before_initialize: function(creation) {\n if (!this.resource) {\n throw new Error('resource must be defined in order to associate');\n }\n return model[this.resource.name || this.resource.toString()].create_before_hooks(creation);\n }\n }\n};\n\nmodel = root.model;\n\nmodel.mix(function(modelable) {\n modelable.after_mix.push(associable.model.blender);\n modelable.record.before_initialize.push(associable.record.before_initialize);\n return modelable.record.after_initialize.push(associable.record.after_initialize);\n});\n\nmodel.associable = {\n mix: function(blender) {\n return blender(singular, plural);\n }\n};\n//@ sourceURL=indemma/lib/record/associable.js"
339
258
  ));
340
259
  require.register("indemma/lib/record/persistable.js", Function("exports, require, module",
341
260
  "var handlers, model, persistable, record;\n\nrequire('./queryable');\n\nhandlers = {\n store_after_saved: function() {\n var storage;\n\n storage = model[this.resource.toString()].storage;\n if (this._id) {\n return storage.store(this._id, this);\n }\n }\n};\n\npersistable = {\n record: {\n after_initialize: function() {\n var storage;\n\n if (this._id) {\n storage = model[this.resource.toString()].storage;\n return storage.store(this._id, this);\n } else {\n return this.after('saved', handlers.store_after_saved);\n }\n }\n }\n};\n\nmodel = window.model;\n\nrecord = window.record;\n\nmodel.persistable = true;\n\nmodel.mix(function(modelable) {\n return modelable.record.after_initialize.push(persistable.record.after_initialize);\n});\n//@ sourceURL=indemma/lib/record/persistable.js"
@@ -353,7 +272,7 @@ require.register("indemma/lib/record/rest.js", Function("exports, require, modul
353
272
  "var $, request;\n\n$ = require('jquery');\n\nmodule.exports = {\n get: function(data) {\n return request.call(this, 'get', (this._id ? \"\" + this.route + \"/\" + this._id : this.route), data);\n },\n put: function(data) {\n return request.call(this, 'put', (this._id ? \"\" + this.route + \"/\" + this._id : this.route), data);\n },\n post: function(data) {\n return request.call(this, 'post', this.route, data);\n },\n \"delete\": function(data) {\n return request.call(this, 'delete', (this._id ? \"\" + this.route + \"/\" + this._id : this.route), data);\n }\n};\n\nrequest = function(method, url, data) {\n var param_name;\n\n param_name = this.resource.param_name || this.resource.toString();\n if (!data && this.json) {\n data = {};\n data[param_name] = this.json();\n }\n if (data && data[param_name]) {\n delete data[param_name]['id'];\n delete data[param_name]['_id'];\n }\n return $.ajax({\n url: url,\n data: data,\n type: method,\n dataType: 'json',\n context: this\n });\n};\n//@ sourceURL=indemma/lib/record/rest.js"
354
273
  ));
355
274
  require.register("indemma/lib/record/restfulable.js", Function("exports, require, module",
356
- "var $, merge, model, observable, record, rest, restful, root, type, util,\n __slice = [].slice;\n\nmerge = require('assimilate').withStrategy('deep');\n\ntype = require('type');\n\nobservable = require('observable').mixin;\n\n$ = require('jquery');\n\nrest = require('./rest.js');\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nutil = {\n model: {\n map: function(records) {\n var record, _i, _len, _results;\n\n _results = [];\n for (_i = 0, _len = records.length; _i < _len; _i++) {\n record = records[_i];\n _results.push(this(record));\n }\n return _results;\n }\n }\n};\n\nrestful = {\n model: {\n create: function() {\n var attributes, callback, params, record, savings, _i, _j, _len;\n\n params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), callback = arguments[_i++];\n if (!arguments.length) {\n throw new TypeError(\"No arguments provided for \" + this.resource + \".create\");\n }\n if (typeof callback !== 'function') {\n params.push(callback);\n callback = void 0;\n }\n if (!params.length) {\n params.unshift({});\n }\n savings = [];\n for (_j = 0, _len = params.length; _j < _len; _j++) {\n attributes = params[_j];\n record = this(attributes);\n record.dirty = true;\n savings.push(record.save(callback));\n }\n return $.when.apply($, savings);\n },\n all: function(conditions, doned, failed) {\n if (conditions == null) {\n conditions = {};\n }\n if (typeof conditions === 'function') {\n doned = conditions;\n conditions = {};\n }\n return $.when(rest.get.call(this, conditions)).then(util.model.map).done(doned).fail(failed);\n },\n first: function(conditions, callback) {\n var namespaced;\n\n if (conditions == null) {\n conditions = {};\n }\n if (typeof conditions === 'function') {\n callback = conditions;\n conditions = {};\n }\n namespaced = conditions[this.resource] || {};\n namespaced.limit = 1;\n namespaced.order = 'desc';\n return this.all(conditions, callback);\n },\n get: function(action, data) {\n var default_route, old_route, payload, promise, resource;\n\n if (data == null) {\n data = {};\n }\n old_route = this.route;\n default_route = \"/\" + (model.pluralize(this.resource.name));\n if (default_route !== this.route) {\n this.route = default_route;\n }\n if (action) {\n Object.defineProperty(this, 'route', {\n value: \"\" + default_route + \"/\" + action,\n configurable: true\n });\n }\n resource = data.resource;\n if (data && data.json) {\n data = data.json();\n }\n if (resource != null) {\n payload = data;\n data = {};\n data[resource] = payload;\n }\n promise = rest.get.call(this, data);\n Object.defineProperty(this, 'route', {\n value: old_route,\n configurable: true\n });\n return promise;\n },\n put: rest.put,\n \"delete\": rest[\"delete\"]\n },\n record: {\n ready: function(callback) {\n return callback.call(this);\n },\n reload: function() {\n var data, param, params, promise, _i, _len;\n\n params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n data = params.pop();\n if (type(data) !== 'object') {\n params.push(data);\n }\n promise = rest.get.call(this, data || {});\n promise.done(this.assign_attributes);\n promise.fail(this.failed);\n this.reloading = promise;\n this.ready = function() {\n console.warn(\"resource.ready was deprecated, please use resource.reloading.done\");\n return promise.done.apply(promise, arguments);\n };\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n param = params[_i];\n promise.done(param);\n }\n return promise;\n },\n assign_attributes: function(attributes) {\n var association, association_attributes, association_name, associations_attributes, attribute, message, name, singular_resource, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _results;\n\n _ref = model[this.resource.toString()].has_many;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n association_name = _ref[_i];\n associations_attributes = attributes[association_name];\n delete attributes[association_name];\n association = this[association_name];\n if (association == null) {\n message = \"Association '\" + association_name + \"' not found. \\n\";\n message += \"For record with resource \" + this.resource + \". \\n\";\n message += \"Probably defined on server side but not on client side.\\n\";\n message += \"Skipping association assignment!\";\n console.warn(message);\n continue;\n }\n if (association.length) {\n Array.prototype.splice.call(association, 0);\n }\n if (!((associations_attributes != null) && associations_attributes.length)) {\n continue;\n }\n singular_resource = model.singularize(association_name);\n for (_j = 0, _len1 = associations_attributes.length; _j < _len1; _j++) {\n association_attributes = associations_attributes[_j];\n _ref1 = model[singular_resource].has_many;\n for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {\n association_name = _ref1[_k];\n association_attributes[\"\" + association_name + \"_attributes\"] = association_attributes[association_name];\n delete association_attributes[association_name];\n }\n }\n association.add.apply(association, associations_attributes);\n }\n _ref2 = model[this.resource.toString()].has_one;\n for (_l = 0, _len3 = _ref2.length; _l < _len3; _l++) {\n association_name = _ref2[_l];\n association_attributes = attributes[association_name];\n delete attributes[association_name];\n delete attributes[association_name + \"_attributes\"];\n if (association_attributes) {\n this[association_name] = this[\"build_\" + association_name](association_attributes);\n }\n }\n _results = [];\n for (name in attributes) {\n attribute = attributes[name];\n if (attribute !== this[name]) {\n if (type(attribute) === 'object') {\n if (JSON.stringify(attribute) !== JSON.stringify(this[name])) {\n _results.push(this[name] = attributes[name]);\n } else {\n _results.push(void 0);\n }\n } else {\n _results.push(this[name] = attributes[name]);\n }\n }\n }\n return _results;\n },\n destroy: function(doned, failed, data) {\n var promise;\n\n if (!((this.id != null) || (this._id != null))) {\n throw new Error('Can\\'t delete record without id!');\n }\n promise = rest[\"delete\"].call(this, data);\n promise.done(this.destroyed);\n promise.fail(this.failed);\n promise.done(doned);\n promise.fail(failed);\n return promise;\n },\n saving: false,\n salvation: null,\n save: function(doned, failed, data) {\n var lock, salvation;\n\n lock = JSON.stringify(this.json());\n if (this.saving) {\n if (this.lock === lock) {\n return this.salvation;\n } else {\n this.salvation.abort();\n }\n }\n this.lock = lock;\n if (!this.dirty) {\n salvation = $.Deferred().resolveWith(this, null);\n }\n this.saving = true;\n salvation || (salvation = rest[this._id ? 'put' : 'post'].call(this, data));\n this.salvation = salvation;\n salvation.done(this.saved);\n salvation.fail(this.failed);\n salvation.always(function() {\n return this.saving = false;\n });\n salvation.done(doned);\n salvation.fail(failed);\n return salvation;\n },\n saved: function(data) {\n var callback, _i, _len, _ref, _results;\n\n if (this.lock === JSON.stringify(this.json())) {\n this.dirty = false;\n delete this.lock;\n }\n if (data != null) {\n this.assign_attributes(data);\n }\n if (this.after_save) {\n _ref = this.after_save;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n callback = _ref[_i];\n throw \"Not supported after_save callback: \" + callback;\n }\n return _results;\n }\n },\n failed: function(xhr, error, status) {\n var attribute_name, definition, e, message, messages, payload, _i, _len, _ref;\n\n payload = xhr.responseJSON;\n try {\n payload || (payload = JSON.parse(xhr.responseText));\n } catch (_error) {\n e = _error;\n }\n payload || (payload = xhr.responseText);\n switch (xhr.status) {\n case 0:\n message = status || xhr.statusText;\n switch (message) {\n case 'abort':\n console.info(\"salvation probably aborted\");\n break;\n case 'error':\n console.info(\"server probably unreachable\");\n break;\n default:\n throw new Error('Unhandled status code for xhr');\n }\n break;\n case 422:\n definition = model[this.resource.toString()];\n _ref = payload.errors;\n for (attribute_name in _ref) {\n messages = _ref[attribute_name];\n if (!definition.associations) {\n definition.associations = definition.has_one.concat(definition.has_many.concat(definition.belongs_to));\n }\n if (!(this.hasOwnProperty(attribute_name) || definition.hasOwnProperty(attribute_name) || definition.associations.indexOf(attribute_name) !== -1 || attribute_name === 'base')) {\n message = \"Server returned an validation error message for a attribute that is not defined in your model.\\n\";\n message += \"The attribute was '\" + attribute_name + \"', the model resource was '\" + this.resource + \"'.\\n\";\n message += \"The model definition keys were '\" + (JSON.stringify(Object.keys(definition))) + \"'.\\n\";\n message += \"Please remove server validation, or update your model definition.\";\n throw new TypeError(message);\n }\n for (_i = 0, _len = messages.length; _i < _len; _i++) {\n message = messages[_i];\n this.errors.add(attribute_name, 'server', {\n server_message: message\n });\n }\n }\n break;\n default:\n message = \"Fail in \" + this.resource + \".save:\\n\";\n message += \"Record: \" + this + \"\\n\";\n message += \"Status: \" + status + \" (\" + (payload || xhr).status + \")\\n\";\n message += \"Error : \" + (payload.error || payload.message || payload);\n console.log(message);\n }\n return this.saving = false;\n },\n toString: function() {\n var serialized;\n\n serialized = {};\n serialized[this.resource] = this.json();\n return JSON.stringify(serialized);\n },\n json: function(methods) {\n var attribute, definition, json, name, value, _i, _len, _ref;\n\n if (methods == null) {\n methods = {};\n }\n json = {};\n definition = model[this.resource.toString()];\n for (name in this) {\n if (!(type(value))) {\n continue;\n }\n if (definition.belongs_to.indexOf(name) !== -1 && this.nested_attributes.indexOf(name) === -1) {\n continue;\n }\n value = this[name];\n if (value == null) {\n continue;\n }\n if (type(value) === 'function') {\n continue;\n }\n if (type(value) === 'object') {\n if (value.toJSON != null) {\n json[name] = value.toJSON(methods[name]);\n } else {\n _ref = this.nested_attributes;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n attribute = _ref[_i];\n if (attribute === name) {\n json[\"\" + name + \"_attributes\"] = value.json(methods[name]);\n }\n }\n }\n } else {\n json[name] = value;\n }\n }\n observable.unobserve(json);\n delete json.dirty;\n delete json.resource;\n delete json.route;\n delete json.initial_route;\n delete json.after_initialize;\n delete json.before_initialize;\n delete json.parent_resource;\n delete json.nested_attributes;\n delete json.reloading;\n delete json.ready;\n delete json.saving;\n delete json.salvation;\n delete json.sustained;\n delete json.element;\n delete json[\"default\"];\n delete json.lock;\n delete json.validated;\n delete json.validation;\n return json;\n }\n }\n};\n\nrestful.toJSON = restful.json;\n\nmodel = window.model;\n\nrecord = window.record;\n\nmodel.restfulable = true;\n\nrecord.mix(function(recordable) {\n return merge(recordable, restful.record);\n});\n\nmodel.mix(function(modelable) {\n return merge(modelable, restful.model);\n});\n\nmodel.associable && model.associable.mix(function(singular_association, plural_association) {\n plural_association.get = function() {\n if (this.parent != null) {\n this.route || (this.route = \"\" + this.parent.route + \"/\" + this.parent._id + \"/\" + (model.pluralize(this.resource.name)));\n }\n return rest.get.apply(this, arguments);\n };\n return plural_association.post = function() {\n if (this.parent != null) {\n this.route || (this.route = \"\" + this.parent.route + \"/\" + this.parent._id + \"/\" + (model.pluralize(this.resource.name)));\n }\n return rest.post.apply(this, arguments);\n };\n});\n//@ sourceURL=indemma/lib/record/restfulable.js"
275
+ "var $, merge, model, observable, record, rest, restful, root, type, util,\n __slice = [].slice;\n\nmerge = require('assimilate').withStrategy('deep');\n\ntype = require('type');\n\nobservable = require('observable').mixin;\n\n$ = require('jquery');\n\nrest = require('./rest.js');\n\nroot = typeof exports !== \"undefined\" && exports !== null ? exports : this;\n\nutil = {\n model: {\n map: function(records) {\n var record, _i, _len, _results;\n\n _results = [];\n for (_i = 0, _len = records.length; _i < _len; _i++) {\n record = records[_i];\n _results.push(this(record));\n }\n return _results;\n }\n }\n};\n\nrestful = {\n model: {\n create: function() {\n var attributes, callback, params, record, savings, _i, _j, _len;\n\n params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), callback = arguments[_i++];\n if (!arguments.length) {\n throw new TypeError(\"No arguments provided for \" + this.resource + \".create\");\n }\n if (typeof callback !== 'function') {\n params.push(callback);\n callback = void 0;\n }\n if (!params.length) {\n params.unshift({});\n }\n savings = [];\n for (_j = 0, _len = params.length; _j < _len; _j++) {\n attributes = params[_j];\n record = this(attributes);\n record.dirty = true;\n savings.push(record.save(callback));\n }\n return $.when.apply($, savings);\n },\n all: function(conditions, doned, failed) {\n if (conditions == null) {\n conditions = {};\n }\n if (typeof conditions === 'function') {\n doned = conditions;\n conditions = {};\n }\n return $.when(rest.get.call(this, conditions)).then(util.model.map).done(doned).fail(failed);\n },\n first: function(conditions, callback) {\n var namespaced;\n\n if (conditions == null) {\n conditions = {};\n }\n if (typeof conditions === 'function') {\n callback = conditions;\n conditions = {};\n }\n namespaced = conditions[this.resource] || {};\n namespaced.limit = 1;\n namespaced.order = 'desc';\n return this.all(conditions, callback);\n },\n get: function(action, data) {\n var default_route, old_route, payload, promise, resource;\n\n if (data == null) {\n data = {};\n }\n old_route = this.route;\n default_route = \"/\" + (model.pluralize(this.resource.name));\n if (default_route !== this.route) {\n this.route = default_route;\n }\n if (action) {\n Object.defineProperty(this, 'route', {\n value: \"\" + default_route + \"/\" + action,\n configurable: true\n });\n }\n resource = data.resource;\n if (data && data.json) {\n data = data.json();\n }\n if (resource != null) {\n payload = data;\n data = {};\n data[resource] = payload;\n }\n promise = rest.get.call(this, data);\n Object.defineProperty(this, 'route', {\n value: old_route,\n configurable: true\n });\n return promise;\n },\n put: rest.put,\n \"delete\": rest[\"delete\"]\n },\n record: {\n ready: function(callback) {\n return callback.call(this);\n },\n reload: function() {\n var data, param, params, promise, _i, _len;\n\n params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n data = params.pop();\n if (type(data) !== 'object') {\n params.push(data);\n }\n promise = rest.get.call(this, data || {});\n promise.done(this.assign_attributes);\n promise.fail(this.failed);\n this.reloading = promise;\n this.ready = function() {\n console.warn(\"resource.ready was deprecated, please use resource.reloading.done\");\n return promise.done.apply(promise, arguments);\n };\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n param = params[_i];\n promise.done(param);\n }\n return promise;\n },\n assign_attributes: function(attributes) {\n var association, association_attributes, association_name, associations_attributes, attribute, message, name, singular_resource, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _results;\n\n _ref = model[this.resource.toString()].has_many;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n association_name = _ref[_i];\n associations_attributes = attributes[association_name];\n delete attributes[association_name];\n association = this[association_name];\n if (association == null) {\n message = \"Association '\" + association_name + \"' not found. \\n\";\n message += \"For record with resource \" + this.resource + \". \\n\";\n message += \"Probably defined on server side but not on client side.\\n\";\n message += \"Skipping association assignment!\";\n console.warn(message);\n continue;\n }\n if (association.length) {\n Array.prototype.splice.call(association, 0);\n }\n if (!((associations_attributes != null) && associations_attributes.length)) {\n continue;\n }\n singular_resource = model.singularize(association_name);\n for (_j = 0, _len1 = associations_attributes.length; _j < _len1; _j++) {\n association_attributes = associations_attributes[_j];\n _ref1 = model[singular_resource].has_many;\n for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {\n association_name = _ref1[_k];\n association_attributes[\"\" + association_name + \"_attributes\"] = association_attributes[association_name];\n delete association_attributes[association_name];\n }\n }\n association.add.apply(association, associations_attributes);\n }\n _ref2 = model[this.resource.toString()].has_one;\n for (_l = 0, _len3 = _ref2.length; _l < _len3; _l++) {\n association_name = _ref2[_l];\n association_attributes = attributes[association_name];\n delete attributes[association_name];\n delete attributes[association_name + \"_attributes\"];\n if (association_attributes) {\n this[association_name] = this[\"build_\" + association_name](association_attributes);\n }\n }\n _results = [];\n for (name in attributes) {\n attribute = attributes[name];\n if (attribute !== this[name]) {\n if (type(attribute) === 'object') {\n if (JSON.stringify(attribute) !== JSON.stringify(this[name])) {\n _results.push(this[name] = attributes[name]);\n } else {\n _results.push(void 0);\n }\n } else {\n _results.push(this[name] = attributes[name]);\n }\n }\n }\n return _results;\n },\n destroy: function(doned, failed, data) {\n var promise;\n\n if (!((this.id != null) || (this._id != null))) {\n throw new Error('Can\\'t delete record without id!');\n }\n promise = rest[\"delete\"].call(this, data);\n promise.done(this.destroyed);\n promise.fail(this.failed);\n promise.done(doned);\n promise.fail(failed);\n return promise;\n },\n saving: false,\n salvation: null,\n save: function(doned, failed, data) {\n var lock, salvation;\n\n lock = JSON.stringify(this.json());\n if (this.saving) {\n if (this.lock === lock) {\n return this.salvation;\n } else {\n this.salvation.abort();\n }\n }\n this.lock = lock;\n if (!this.dirty) {\n salvation = $.Deferred().resolveWith(this, null);\n }\n this.saving = true;\n salvation || (salvation = rest[this._id ? 'put' : 'post'].call(this, data));\n this.salvation = salvation;\n salvation.done(this.saved);\n salvation.fail(this.failed);\n salvation.always(function() {\n return this.saving = false;\n });\n salvation.done(doned);\n salvation.fail(failed);\n return salvation;\n },\n saved: function(data) {\n var callback, _i, _len, _ref, _results;\n\n if (this.lock === JSON.stringify(this.json())) {\n this.dirty = false;\n delete this.lock;\n }\n if (data != null) {\n this.assign_attributes(data);\n }\n if (this.after_save) {\n _ref = this.after_save;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n callback = _ref[_i];\n throw \"Not supported after_save callback: \" + callback;\n }\n return _results;\n }\n },\n failed: function(xhr, error, status) {\n var attribute_name, definition, e, message, messages, payload, _i, _len, _ref;\n\n payload = xhr.responseJSON;\n try {\n payload || (payload = JSON.parse(xhr.responseText));\n } catch (_error) {\n e = _error;\n }\n payload || (payload = xhr.responseText);\n switch (xhr.status) {\n case 0:\n message = status || xhr.statusText;\n switch (message) {\n case 'abort':\n console.info(\"salvation probably aborted\");\n break;\n case 'error':\n console.info(\"server probably unreachable\");\n break;\n default:\n throw new Error('Unhandled status code for xhr');\n }\n break;\n case 422:\n definition = model[this.resource.toString()];\n _ref = payload.errors;\n for (attribute_name in _ref) {\n messages = _ref[attribute_name];\n if (!definition.associations) {\n definition.associations = definition.has_one.concat(definition.has_many.concat(definition.belongs_to));\n }\n if (!(this.hasOwnProperty(attribute_name) || definition.hasOwnProperty(attribute_name) || definition.associations.indexOf(attribute_name) !== -1 || attribute_name === 'base')) {\n message = \"Server returned an validation error message for a attribute that is not defined in your model.\\n\";\n message += \"The attribute was '\" + attribute_name + \"', the model resource was '\" + this.resource + \"'.\\n\";\n message += \"The model definition keys were '\" + (JSON.stringify(Object.keys(definition))) + \"'.\\n\";\n message += \"Please remove server validation, or update your model definition.\";\n throw new TypeError(message);\n }\n for (_i = 0, _len = messages.length; _i < _len; _i++) {\n message = messages[_i];\n this.errors.add(attribute_name, 'server', {\n server_message: message\n });\n }\n }\n break;\n default:\n message = \"Fail in \" + this.resource + \".save:\\n\";\n message += \"Record: \" + this + \"\\n\";\n message += \"Status: \" + status + \" (\" + (payload || xhr).status + \")\\n\";\n message += \"Error : \" + (payload.error || payload.message || payload);\n console.log(message);\n }\n return this.saving = false;\n },\n toString: function() {\n var e, name, property, serialized;\n\n serialized = {};\n serialized[this.resource] = this.json();\n try {\n return JSON.stringify(serialized);\n } catch (_error) {\n e = _error;\n console.warn(\"restfulable.toString: Failed to stringify record: \" + e.message + \". retrying...\");\n for (name in serialized) {\n property = serialized[name];\n if (typeof property === 'object') {\n delete serialized[name];\n }\n }\n return JSON.stringify(serialized);\n }\n },\n json: function(methods) {\n var definition, json, name, nested, value;\n\n if (methods == null) {\n methods = {};\n }\n json = {};\n definition = model[this.resource.toString()];\n for (name in this) {\n if (observable.ignores.indexOf(name) !== -1) {\n continue;\n }\n nested = this.nested_attributes.indexOf(name) !== -1;\n if (!nested && (definition.belongs_to.indexOf(name) !== -1 || definition.has_one.indexOf(name) !== -1)) {\n continue;\n }\n value = this[name];\n if (value == null) {\n continue;\n }\n if (type(value) === 'function') {\n continue;\n }\n if (type(value) === 'object') {\n if (nested) {\n json[\"\" + name + \"_attributes\"] = value.json(methods[name]);\n } else if ((value.toJSON != null) || (value.json != null)) {\n if (value.json != null) {\n json[name] = value.json(methods[name]);\n } else {\n json[name] = value.toJSON(methods[name]);\n }\n }\n } else {\n json[name] = value;\n }\n }\n json = observable.unobserve(json);\n delete json.dirty;\n delete json.resource;\n delete json.route;\n delete json.initial_route;\n delete json.after_initialize;\n delete json.before_initialize;\n delete json.parent_resource;\n delete json.nested_attributes;\n delete json.reloading;\n delete json.ready;\n delete json.saving;\n delete json.salvation;\n delete json.sustained;\n delete json.element;\n delete json[\"default\"];\n delete json.lock;\n delete json.validated;\n delete json.validation;\n return json;\n }\n }\n};\n\nrestful.toJSON = restful.json;\n\nmodel = window.model;\n\nrecord = window.record;\n\nmodel.restfulable = true;\n\nrecord.mix(function(recordable) {\n return merge(recordable, restful.record);\n});\n\nmodel.mix(function(modelable) {\n return merge(modelable, restful.model);\n});\n\nmodel.associable && model.associable.mix(function(singular_association, plural_association) {\n plural_association.get = function() {\n if (this.parent != null) {\n this.route || (this.route = \"\" + this.parent.route + \"/\" + this.parent._id + \"/\" + (model.pluralize(this.resource.name)));\n }\n return rest.get.apply(this, arguments);\n };\n return plural_association.post = function() {\n if (this.parent != null) {\n this.route || (this.route = \"\" + this.parent.route + \"/\" + this.parent._id + \"/\" + (model.pluralize(this.resource.name)));\n }\n return rest.post.apply(this, arguments);\n };\n});\n//@ sourceURL=indemma/lib/record/restfulable.js"
357
276
  ));
358
277
  require.register("indemma/lib/record/scopable.js", Function("exports, require, module",
359
278
  "var $, builders, defaults, extend, merge, model, observable, record, rest, scopable, stampit, util,\n __slice = [].slice;\n\nrequire('./restfulable');\n\nrequire('./resource');\n\nstampit = require('../../vendor/stampit');\n\nextend = require('assimilate');\n\nobservable = require('observable').mixin;\n\nmerge = extend.withStrategy('deep');\n\n$ = require('jquery');\n\nrest = require('./rest');\n\nutil = {\n model: {\n map: function(records) {\n var index, record, _i, _len, _results;\n\n _results = [];\n for (index = _i = 0, _len = records.length; _i < _len; index = ++_i) {\n record = records[index];\n _results.push((this.build || this).call(this, record));\n }\n return _results;\n }\n }\n};\n\nscopable = {\n builder: stampit().enclose(function() {\n return stampit.mixIn(function(name, type) {\n var builder;\n\n if ($.type(type) === 'function') {\n this[\"$\" + name] = type() || new type;\n type = $.type(this[\"$\" + name]);\n } else {\n this[\"$\" + name] = defaults[type] || type;\n }\n if ($.type(type) !== 'string') {\n type = $.type(type);\n }\n builder = builders[type];\n if (builder == null) {\n throw \"Unknown scope type: '\" + type + \"', For model with resource: '\" + this.resource + \"'\";\n }\n this.scope.declared.push(name);\n return this[name] = builder({\n name: name\n });\n }, {\n data: {},\n then: [],\n fail: [],\n declared: [],\n fetch: function(data, done, fail) {\n var deferred, scope;\n\n if (typeof data === 'function') {\n done = data;\n data = {};\n }\n scope = extend({}, this.scope.data);\n observable.unobserve(scope);\n if (scope.noned != null) {\n deferred = $.Deferred();\n deferred.resolveWith(this, [[]]);\n } else {\n deferred = rest.get.call(this, extend(scope, data));\n }\n deferred.then(util.model.map).done(this.scope.then.concat([done])).fail(this.scope.fail.concat([fail]));\n this.scope.clear();\n return deferred;\n },\n clear: function() {\n this.data = {};\n return this.callbacks = [];\n }\n });\n }),\n base: stampit().state({\n name: 'unamed_scope'\n }),\n record: {\n failed: function(xhr, error, status) {\n var e, message, payload;\n\n payload = xhr.responseJSON;\n try {\n payload || (payload = JSON.parse(xhr.responseText));\n } catch (_error) {\n e = _error;\n }\n payload || (payload = xhr.responseText);\n switch (xhr.status) {\n case 422:\n this.valid = false;\n return this.errors = payload.errors;\n default:\n message = \"Fail in \" + this.resource + \".save:\\n\";\n message += \"Record: \" + this + \"\\n\";\n message += \"Status: \" + status + \" (\" + (payload.status || xhr.status) + \")\\n\";\n message += \"Error : \" + (payload.error || payload.message || payload);\n }\n return console.error(message);\n }\n },\n model: {\n none: function() {\n this.scope.data.noned = true;\n return this;\n },\n fetch: function(data, done, fail) {\n if (typeof data === 'function') {\n done = data;\n data = null;\n }\n return this.scope.fetch.call(this, data, done, fail);\n },\n forward_scopes_to_associations: function() {\n var associated_factory, associated_resource, association, association_name, factory, forwarder, generate_forwarder, scope, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;\n\n factory = model[this.resource.name];\n _ref = factory.has_many;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n association_name = _ref[_i];\n associated_resource = model.singularize(association_name);\n associated_factory = model[associated_resource];\n if (!model[associated_resource]) {\n console.warn(\"Associated factory not found for associated resource: \" + associated_resource);\n continue;\n }\n association = this[association_name];\n association.scope = scopable.builder(association);\n _ref1 = associated_factory.scope.declared;\n for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n scope = _ref1[_j];\n association.scope(scope, associated_factory[\"$\" + scope]);\n }\n }\n _ref2 = factory.has_one;\n for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {\n associated_resource = _ref2[_k];\n if (!model[associated_resource]) {\n console.warn(\"Associated factory not found for associated resource: \" + associated_resource);\n continue;\n }\n _ref3 = model[associated_resource].scope.declared;\n for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {\n scope = _ref3[_l];\n this[associated_resource][scope] = factory[scope];\n }\n }\n if (factory.belongs_to.length) {\n generate_forwarder = function(associated_resource) {\n var declared_scopes;\n\n associated_factory = model[associated_resource];\n if (!associated_factory) {\n return console.warn(\"Associated factory not found for associated resource: \" + associated_resource);\n }\n declared_scopes = associated_factory.scope.declared;\n return function() {\n var _len4, _m, _results;\n\n _results = [];\n for (_m = 0, _len4 = declared_scopes.length; _m < _len4; _m++) {\n scope = declared_scopes[_m];\n _results.push(this[associated_resource][scope] = associated_factory[scope]);\n }\n return _results;\n };\n };\n _ref4 = factory.belongs_to;\n for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {\n associated_resource = _ref4[_m];\n forwarder = generate_forwarder(associated_resource);\n this.after(\"build_\" + associated_resource, forwarder);\n }\n }\n return true;\n }\n },\n after_mix: function() {\n var name, property, type, _results;\n\n this.scope = scopable.builder(this);\n _results = [];\n for (property in this) {\n type = this[property];\n if (property.charAt(0) === '$') {\n name = property.substring(1);\n _results.push(this.scope(name, type));\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n }\n};\n\nbuilders = {\n string: stampit().enclose(function() {\n var base;\n\n base = scopable.base(this);\n return stampit.mixIn(function() {\n var callbacks, value, _base, _name;\n\n value = arguments[0], callbacks = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n callbacks.length && (this.scope.then = this.scope.then.concat(callbacks));\n (_base = this.scope.data)[_name = base.name] || (_base[_name] = value != null ? value : this[\"$\" + base.name]);\n return this;\n });\n }),\n boolean: stampit().enclose(function() {\n var base;\n\n base = scopable.base(this);\n return stampit.mixIn(function() {\n var callbacks, value, _base, _name;\n\n value = arguments[0], callbacks = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n callbacks.length && (this.scope.then = this.scope.then.concat(callbacks));\n (_base = this.scope.data)[_name = base.name] || (_base[_name] = value != null ? value : this[\"$\" + base.name]);\n return this;\n });\n }),\n array: stampit().enclose(function() {\n var base;\n\n base = scopable.base(this);\n return stampit.mixIn(function() {\n var values, _base, _name;\n\n values = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n (_base = this.scope.data)[_name = base.name] || (_base[_name] = values != null ? values : this[\"$\" + base.name]);\n return this;\n });\n })\n};\n\ndefaults = {\n boolean: true,\n array: []\n};\n\nmodel = window.model;\n\nrecord = window.record;\n\nmodel.scopable = true;\n\nmodel.mix(function(modelable) {\n merge(modelable, scopable.model);\n return modelable.after_mix.push(scopable.after_mix);\n});\n\nif (model.associable) {\n model.mix(function(modelable) {\n return modelable.record.after_initialize.push(function() {\n return scopable.model.forward_scopes_to_associations.call(this);\n });\n });\n model.associable.mix(function(singular_association, plural_association) {\n plural_association.all = plural_association.reload = function(data, done, fail) {\n var promises, reload;\n\n if (this.parent != null) {\n this.route || (this.route = \"\" + this.parent.route + \"/\" + this.parent._id + \"/\" + (model.pluralize(this.resource)));\n }\n promises = [];\n if (typeof data === 'function') {\n done = data;\n data = void 0;\n }\n promises.push(this.scope.fetch.call(this, data, null, scopable.record.failed));\n reload = $.when.apply(jQuery, promises);\n reload.done(function(records, status) {\n var association_name, singular_resource, _i, _j, _len, _len1, _ref;\n\n Array.prototype.splice.call(this, 0);\n if (!records.length) {\n return;\n }\n singular_resource = model.singularize(this.resource);\n for (_i = 0, _len = records.length; _i < _len; _i++) {\n record = records[_i];\n _ref = model[singular_resource].has_many;\n for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {\n association_name = _ref[_j];\n record[\"\" + association_name + \"_attributes\"] = record[association_name];\n delete record[association_name];\n }\n }\n this.add.apply(this, records);\n records.splice(0);\n return records.push.apply(records, this);\n });\n reload.done(done);\n reload.fail(fail);\n return reload;\n };\n return plural_association.each = function(callback) {\n var _this = this;\n\n if (this.parent != null) {\n this.route || (this.route = \"\" + this.parent.route + \"/\" + this.parent._id + \"/\" + (model.pluralize(this.resource)));\n }\n return this.get().done(function(records) {\n var _i, _len, _results;\n\n _results = [];\n for (_i = 0, _len = _this.length; _i < _len; _i++) {\n record = _this[_i];\n _results.push(callback(record));\n }\n return _results;\n });\n };\n });\n}\n//@ sourceURL=indemma/lib/record/scopable.js"
@@ -422,37 +341,3 @@ require.alias("indefinido-advisable/lib/advisable.js", "indemma/deps/advisable/l
422
341
  require.alias("indefinido-advisable/index.js", "advisable/index.js");
423
342
  require.alias("component-jquery/index.js", "indefinido-advisable/deps/jquery/index.js");
424
343
 
425
- require.alias("chaijs-chai/index.js", "indemma/deps/chai/index.js");
426
- require.alias("chaijs-chai/lib/chai.js", "indemma/deps/chai/lib/chai.js");
427
- require.alias("chaijs-chai/lib/chai/assertion.js", "indemma/deps/chai/lib/chai/assertion.js");
428
- require.alias("chaijs-chai/lib/chai/core/assertions.js", "indemma/deps/chai/lib/chai/core/assertions.js");
429
- require.alias("chaijs-chai/lib/chai/interface/assert.js", "indemma/deps/chai/lib/chai/interface/assert.js");
430
- require.alias("chaijs-chai/lib/chai/interface/expect.js", "indemma/deps/chai/lib/chai/interface/expect.js");
431
- require.alias("chaijs-chai/lib/chai/interface/should.js", "indemma/deps/chai/lib/chai/interface/should.js");
432
- require.alias("chaijs-chai/lib/chai/utils/addChainableMethod.js", "indemma/deps/chai/lib/chai/utils/addChainableMethod.js");
433
- require.alias("chaijs-chai/lib/chai/utils/addMethod.js", "indemma/deps/chai/lib/chai/utils/addMethod.js");
434
- require.alias("chaijs-chai/lib/chai/utils/addProperty.js", "indemma/deps/chai/lib/chai/utils/addProperty.js");
435
- require.alias("chaijs-chai/lib/chai/utils/eql.js", "indemma/deps/chai/lib/chai/utils/eql.js");
436
- require.alias("chaijs-chai/lib/chai/utils/flag.js", "indemma/deps/chai/lib/chai/utils/flag.js");
437
- require.alias("chaijs-chai/lib/chai/utils/getActual.js", "indemma/deps/chai/lib/chai/utils/getActual.js");
438
- require.alias("chaijs-chai/lib/chai/utils/getEnumerableProperties.js", "indemma/deps/chai/lib/chai/utils/getEnumerableProperties.js");
439
- require.alias("chaijs-chai/lib/chai/utils/getMessage.js", "indemma/deps/chai/lib/chai/utils/getMessage.js");
440
- require.alias("chaijs-chai/lib/chai/utils/getName.js", "indemma/deps/chai/lib/chai/utils/getName.js");
441
- require.alias("chaijs-chai/lib/chai/utils/getPathValue.js", "indemma/deps/chai/lib/chai/utils/getPathValue.js");
442
- require.alias("chaijs-chai/lib/chai/utils/getProperties.js", "indemma/deps/chai/lib/chai/utils/getProperties.js");
443
- require.alias("chaijs-chai/lib/chai/utils/index.js", "indemma/deps/chai/lib/chai/utils/index.js");
444
- require.alias("chaijs-chai/lib/chai/utils/inspect.js", "indemma/deps/chai/lib/chai/utils/inspect.js");
445
- require.alias("chaijs-chai/lib/chai/utils/objDisplay.js", "indemma/deps/chai/lib/chai/utils/objDisplay.js");
446
- require.alias("chaijs-chai/lib/chai/utils/overwriteMethod.js", "indemma/deps/chai/lib/chai/utils/overwriteMethod.js");
447
- require.alias("chaijs-chai/lib/chai/utils/overwriteProperty.js", "indemma/deps/chai/lib/chai/utils/overwriteProperty.js");
448
- require.alias("chaijs-chai/lib/chai/utils/test.js", "indemma/deps/chai/lib/chai/utils/test.js");
449
- require.alias("chaijs-chai/lib/chai/utils/transferFlags.js", "indemma/deps/chai/lib/chai/utils/transferFlags.js");
450
- require.alias("chaijs-chai/lib/chai/utils/type.js", "indemma/deps/chai/lib/chai/utils/type.js");
451
- require.alias("chaijs-chai/index.js", "indemma/deps/chai/index.js");
452
- require.alias("chaijs-chai/index.js", "chai/index.js");
453
- require.alias("chaijs-assertion-error/index.js", "chaijs-chai/deps/assertion-error/index.js");
454
- require.alias("chaijs-assertion-error/index.js", "chaijs-chai/deps/assertion-error/index.js");
455
- require.alias("chaijs-assertion-error/index.js", "chaijs-assertion-error/index.js");
456
-
457
- require.alias("chaijs-chai/index.js", "chaijs-chai/index.js");
458
-