-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
register.js
38 lines (35 loc) · 1.04 KB
/
register.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var Must = module.exports = require("./must")
/* eslint no-extend-native: 0 */
/**
* Creates an instance of [`Must`](#Must) with the current object for asserting
* and calling matchers on.
*
* This property is non-enumerable just like built-in properties, so
* it'll never interfere with any regular usage of objects.
*
* Please note that JavaScript does not allow method calls on `null` or
* `undefined`, so you'll sometimes have to call [`Must`](#Must) on them by
* hand. Assigning `require("must")` to `expect` or `demand` works well with
* those cases.
*
* @example
* true.must.be.true()
* [].must.be.empty()
*
* @property must
* @for Object
* @on prototype
*/
Object.defineProperty(Object.prototype, "must", {
get: function() { "use strict"; return new Must(this) },
set: function(value) {
Object.defineProperty(this, "must", {
value: value,
configurable: true,
enumrable: true,
writable: true
})
},
// Without configurable, can't redefine it when reloading this file, e.g.
configurable: true
})