mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
15
web/node_modules/d/.editorconfig
generated
vendored
Executable file
15
web/node_modules/d/.editorconfig
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[{*.md,*.yml}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
1
web/node_modules/d/.github/FUNDING.yml
generated
vendored
Normal file
1
web/node_modules/d/.github/FUNDING.yml
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
tidelift: "npm/d"
|
9
web/node_modules/d/CHANGELOG.md
generated
vendored
Normal file
9
web/node_modules/d/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [1.0.1](https://github.com/medikoo/d/compare/v0.1.1...v1.0.1) (2019-06-14)
|
||||
|
||||
## Changelog for previous versions
|
||||
|
||||
See `CHANGES` file
|
17
web/node_modules/d/CHANGES
generated
vendored
Normal file
17
web/node_modules/d/CHANGES
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
For recent changelog see CHANGELOG.md
|
||||
|
||||
-----
|
||||
|
||||
v1.0.0 -- 2015.12.04
|
||||
- autoBind changes:
|
||||
- replace `bindTo` argument with options and `resolveContext` option
|
||||
- Add support `overwriteDefinition`
|
||||
- Introduce IE11 bug workaround in `lazy` handler
|
||||
|
||||
v0.1.1 -- 2014.04.24
|
||||
- Add `autoBind` and `lazy` utilities
|
||||
- Allow to pass other options to be merged onto created descriptor.
|
||||
Useful when used with other custom utilties
|
||||
|
||||
v0.1.0 -- 2013.06.20
|
||||
Initial (derived from es5-ext project)
|
15
web/node_modules/d/LICENSE
generated
vendored
Normal file
15
web/node_modules/d/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
ISC License
|
||||
|
||||
Copyright (c) 2013-2019, Mariusz Nowak, @medikoo, medikoo.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
134
web/node_modules/d/README.md
generated
vendored
Normal file
134
web/node_modules/d/README.md
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
# D
|
||||
|
||||
## Property descriptor factory
|
||||
|
||||
_Originally derived from [es5-ext](https://github.com/medikoo/es5-ext) package._
|
||||
|
||||
Defining properties with descriptors is very verbose:
|
||||
|
||||
```javascript
|
||||
var Account = function () {};
|
||||
Object.defineProperties(Account.prototype, {
|
||||
deposit: {
|
||||
value: function () {
|
||||
/* ... */
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
withdraw: {
|
||||
value: function () {
|
||||
/* ... */
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
balance: {
|
||||
get: function () {
|
||||
/* ... */
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: false
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
D cuts that to:
|
||||
|
||||
```javascript
|
||||
var d = require("d");
|
||||
|
||||
var Account = function () {};
|
||||
Object.defineProperties(Account.prototype, {
|
||||
deposit: d(function () {
|
||||
/* ... */
|
||||
}),
|
||||
withdraw: d(function () {
|
||||
/* ... */
|
||||
}),
|
||||
balance: d.gs(function () {
|
||||
/* ... */
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
By default, created descriptor follow characteristics of native ES5 properties, and defines values as:
|
||||
|
||||
```javascript
|
||||
{ configurable: true, enumerable: false, writable: true }
|
||||
```
|
||||
|
||||
You can overwrite it by preceding _value_ argument with instruction:
|
||||
|
||||
```javascript
|
||||
d("c", value); // { configurable: true, enumerable: false, writable: false }
|
||||
d("ce", value); // { configurable: true, enumerable: true, writable: false }
|
||||
d("e", value); // { configurable: false, enumerable: true, writable: false }
|
||||
|
||||
// Same way for get/set:
|
||||
d.gs("e", value); // { configurable: false, enumerable: true }
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
||||
$ npm install d
|
||||
|
||||
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
|
||||
|
||||
### Other utilities
|
||||
|
||||
#### autoBind(obj, props) _(d/auto-bind)_
|
||||
|
||||
Define methods which will be automatically bound to its instances
|
||||
|
||||
```javascript
|
||||
var d = require('d');
|
||||
var autoBind = require('d/auto-bind');
|
||||
|
||||
var Foo = function () { this._count = 0; };
|
||||
Object.defineProperties(Foo.prototype, autoBind({
|
||||
increment: d(function () { ++this._count; });
|
||||
}));
|
||||
|
||||
var foo = new Foo();
|
||||
|
||||
// Increment foo counter on each domEl click
|
||||
domEl.addEventListener('click', foo.increment, false);
|
||||
```
|
||||
|
||||
#### lazy(obj, props) _(d/lazy)_
|
||||
|
||||
Define lazy properties, which will be resolved on first access
|
||||
|
||||
```javascript
|
||||
var d = require("d");
|
||||
var lazy = require("d/lazy");
|
||||
|
||||
var Foo = function () {};
|
||||
Object.defineProperties(Foo.prototype, lazy({ items: d(function () { return []; }) }));
|
||||
|
||||
var foo = new Foo();
|
||||
foo.items.push(1, 2); // foo.items array created and defined directly on foo
|
||||
```
|
||||
|
||||
## Tests [](https://travis-ci.org/medikoo/d)
|
||||
|
||||
$ npm test
|
||||
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-d?utm_source=npm-d&utm_medium=referral&utm_campaign=readme">Get professional support for d with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
33
web/node_modules/d/auto-bind.js
generated
vendored
Normal file
33
web/node_modules/d/auto-bind.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
|
||||
var isValue = require("type/value/is")
|
||||
, ensureValue = require("type/value/ensure")
|
||||
, ensurePlainFunction = require("type/plain-function/ensure")
|
||||
, copy = require("es5-ext/object/copy")
|
||||
, normalizeOptions = require("es5-ext/object/normalize-options")
|
||||
, map = require("es5-ext/object/map");
|
||||
|
||||
var bind = Function.prototype.bind
|
||||
, defineProperty = Object.defineProperty
|
||||
, hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
, define;
|
||||
|
||||
define = function (name, desc, options) {
|
||||
var value = ensureValue(desc) && ensurePlainFunction(desc.value), dgs;
|
||||
dgs = copy(desc);
|
||||
delete dgs.writable;
|
||||
delete dgs.value;
|
||||
dgs.get = function () {
|
||||
if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value;
|
||||
desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);
|
||||
defineProperty(this, name, desc);
|
||||
return this[name];
|
||||
};
|
||||
return dgs;
|
||||
};
|
||||
|
||||
module.exports = function (props/*, options*/) {
|
||||
var options = normalizeOptions(arguments[1]);
|
||||
if (isValue(options.resolveContext)) ensurePlainFunction(options.resolveContext);
|
||||
return map(props, function (desc, name) { return define(name, desc, options); });
|
||||
};
|
62
web/node_modules/d/index.js
generated
vendored
Normal file
62
web/node_modules/d/index.js
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
"use strict";
|
||||
|
||||
var isValue = require("type/value/is")
|
||||
, isPlainFunction = require("type/plain-function/is")
|
||||
, assign = require("es5-ext/object/assign")
|
||||
, normalizeOpts = require("es5-ext/object/normalize-options")
|
||||
, contains = require("es5-ext/string/#/contains");
|
||||
|
||||
var d = (module.exports = function (dscr, value/*, options*/) {
|
||||
var c, e, w, options, desc;
|
||||
if (arguments.length < 2 || typeof dscr !== "string") {
|
||||
options = value;
|
||||
value = dscr;
|
||||
dscr = null;
|
||||
} else {
|
||||
options = arguments[2];
|
||||
}
|
||||
if (isValue(dscr)) {
|
||||
c = contains.call(dscr, "c");
|
||||
e = contains.call(dscr, "e");
|
||||
w = contains.call(dscr, "w");
|
||||
} else {
|
||||
c = w = true;
|
||||
e = false;
|
||||
}
|
||||
|
||||
desc = { value: value, configurable: c, enumerable: e, writable: w };
|
||||
return !options ? desc : assign(normalizeOpts(options), desc);
|
||||
});
|
||||
|
||||
d.gs = function (dscr, get, set/*, options*/) {
|
||||
var c, e, options, desc;
|
||||
if (typeof dscr !== "string") {
|
||||
options = set;
|
||||
set = get;
|
||||
get = dscr;
|
||||
dscr = null;
|
||||
} else {
|
||||
options = arguments[3];
|
||||
}
|
||||
if (!isValue(get)) {
|
||||
get = undefined;
|
||||
} else if (!isPlainFunction(get)) {
|
||||
options = get;
|
||||
get = set = undefined;
|
||||
} else if (!isValue(set)) {
|
||||
set = undefined;
|
||||
} else if (!isPlainFunction(set)) {
|
||||
options = set;
|
||||
set = undefined;
|
||||
}
|
||||
if (isValue(dscr)) {
|
||||
c = contains.call(dscr, "c");
|
||||
e = contains.call(dscr, "e");
|
||||
} else {
|
||||
c = true;
|
||||
e = false;
|
||||
}
|
||||
|
||||
desc = { get: get, set: set, configurable: c, enumerable: e };
|
||||
return !options ? desc : assign(normalizeOpts(options), desc);
|
||||
};
|
115
web/node_modules/d/lazy.js
generated
vendored
Normal file
115
web/node_modules/d/lazy.js
generated
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
"use strict";
|
||||
|
||||
var isPlainFunction = require("type/plain-function/is")
|
||||
, ensureValue = require("type/value/ensure")
|
||||
, isValue = require("type/value/is")
|
||||
, map = require("es5-ext/object/map")
|
||||
, contains = require("es5-ext/string/#/contains");
|
||||
|
||||
var call = Function.prototype.call
|
||||
, defineProperty = Object.defineProperty
|
||||
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
|
||||
, getPrototypeOf = Object.getPrototypeOf
|
||||
, hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
, cacheDesc = { configurable: false, enumerable: false, writable: false, value: null }
|
||||
, define;
|
||||
|
||||
define = function (name, options) {
|
||||
var value, dgs, cacheName, desc, writable = false, resolvable, flat;
|
||||
options = Object(ensureValue(options));
|
||||
cacheName = options.cacheName;
|
||||
flat = options.flat;
|
||||
if (!isValue(cacheName)) cacheName = name;
|
||||
delete options.cacheName;
|
||||
value = options.value;
|
||||
resolvable = isPlainFunction(value);
|
||||
delete options.value;
|
||||
dgs = { configurable: Boolean(options.configurable), enumerable: Boolean(options.enumerable) };
|
||||
if (name !== cacheName) {
|
||||
dgs.get = function () {
|
||||
if (hasOwnProperty.call(this, cacheName)) return this[cacheName];
|
||||
cacheDesc.value = resolvable ? call.call(value, this, options) : value;
|
||||
cacheDesc.writable = writable;
|
||||
defineProperty(this, cacheName, cacheDesc);
|
||||
cacheDesc.value = null;
|
||||
if (desc) defineProperty(this, name, desc);
|
||||
return this[cacheName];
|
||||
};
|
||||
} else if (!flat) {
|
||||
dgs.get = function self() {
|
||||
var ownDesc;
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
ownDesc = getOwnPropertyDescriptor(this, name);
|
||||
// It happens in Safari, that getter is still called after property
|
||||
// was defined with a value, following workarounds that
|
||||
// While in IE11 it may happen that here ownDesc is undefined (go figure)
|
||||
if (ownDesc) {
|
||||
if (ownDesc.hasOwnProperty("value")) return ownDesc.value;
|
||||
if (typeof ownDesc.get === "function" && ownDesc.get !== self) {
|
||||
return ownDesc.get.call(this);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
desc.value = resolvable ? call.call(value, this, options) : value;
|
||||
defineProperty(this, name, desc);
|
||||
desc.value = null;
|
||||
return this[name];
|
||||
};
|
||||
} else {
|
||||
dgs.get = function self() {
|
||||
var base = this, ownDesc;
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
// It happens in Safari, that getter is still called after property
|
||||
// was defined with a value, following workarounds that
|
||||
ownDesc = getOwnPropertyDescriptor(this, name);
|
||||
if (ownDesc.hasOwnProperty("value")) return ownDesc.value;
|
||||
if (typeof ownDesc.get === "function" && ownDesc.get !== self) {
|
||||
return ownDesc.get.call(this);
|
||||
}
|
||||
}
|
||||
while (!hasOwnProperty.call(base, name)) base = getPrototypeOf(base);
|
||||
desc.value = resolvable ? call.call(value, base, options) : value;
|
||||
defineProperty(base, name, desc);
|
||||
desc.value = null;
|
||||
return base[name];
|
||||
};
|
||||
}
|
||||
dgs.set = function (value) {
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
throw new TypeError("Cannot assign to lazy defined '" + name + "' property of " + this);
|
||||
}
|
||||
dgs.get.call(this);
|
||||
this[cacheName] = value;
|
||||
};
|
||||
if (options.desc) {
|
||||
desc = {
|
||||
configurable: contains.call(options.desc, "c"),
|
||||
enumerable: contains.call(options.desc, "e")
|
||||
};
|
||||
if (cacheName === name) {
|
||||
desc.writable = contains.call(options.desc, "w");
|
||||
desc.value = null;
|
||||
} else {
|
||||
writable = contains.call(options.desc, "w");
|
||||
desc.get = dgs.get;
|
||||
desc.set = dgs.set;
|
||||
}
|
||||
delete options.desc;
|
||||
} else if (cacheName === name) {
|
||||
desc = {
|
||||
configurable: Boolean(options.configurable),
|
||||
enumerable: Boolean(options.enumerable),
|
||||
writable: Boolean(options.writable),
|
||||
value: null
|
||||
};
|
||||
}
|
||||
delete options.configurable;
|
||||
delete options.enumerable;
|
||||
delete options.writable;
|
||||
return dgs;
|
||||
};
|
||||
|
||||
module.exports = function (props) {
|
||||
return map(props, function (desc, name) { return define(name, desc); });
|
||||
};
|
72
web/node_modules/d/package.json
generated
vendored
Normal file
72
web/node_modules/d/package.json
generated
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"name": "d",
|
||||
"version": "1.0.1",
|
||||
"description": "Property descriptor factory",
|
||||
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
|
||||
"keywords": [
|
||||
"descriptor",
|
||||
"es",
|
||||
"ecmascript",
|
||||
"ecma",
|
||||
"property",
|
||||
"descriptors",
|
||||
"meta",
|
||||
"properties"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/medikoo/d.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"es5-ext": "^0.10.50",
|
||||
"type": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-medikoo": "^2.3.0",
|
||||
"git-list-updated": "^1.1.2",
|
||||
"husky": "^2.4.1",
|
||||
"lint-staged": "^8.2.1",
|
||||
"prettier-elastic": "^1.18.2",
|
||||
"tad": "^2.0.1"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint"
|
||||
],
|
||||
"*.{css,html,js,json,md,yaml,yml}": [
|
||||
"prettier -c"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "medikoo/es5",
|
||||
"root": true
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 100,
|
||||
"tabWidth": 4,
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.md"
|
||||
],
|
||||
"options": {
|
||||
"tabWidth": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --ignore-path=.gitignore .",
|
||||
"lint-updated": "pipe-git-updated --ext=js -- eslint --ignore-pattern '!*'",
|
||||
"prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
|
||||
"prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'",
|
||||
"test": "node node_modules/tad/bin/tad"
|
||||
},
|
||||
"license": "ISC"
|
||||
}
|
11
web/node_modules/d/test/auto-bind.js
generated
vendored
Normal file
11
web/node_modules/d/test/auto-bind.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
var d = require("../");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var o = Object.defineProperties(
|
||||
{}, t({ bar: d(function () { return this === o; }), bar2: d(function () { return this; }) })
|
||||
);
|
||||
|
||||
a.deep([o.bar(), o.bar2()], [true, o]);
|
||||
};
|
209
web/node_modules/d/test/index.js
generated
vendored
Normal file
209
web/node_modules/d/test/index.js
generated
vendored
Normal file
|
@ -0,0 +1,209 @@
|
|||
"use strict";
|
||||
|
||||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var o, c, cg, cs, ce, ceg, ces, cew, cw, e, eg, es, ew, v, vg, vs, w, df, dfg, dfs;
|
||||
|
||||
o = Object.create(Object.prototype, {
|
||||
c: t("c", (c = {})),
|
||||
cgs: t.gs("c", (cg = function () {}), (cs = function () {})),
|
||||
ce: t("ce", (ce = {})),
|
||||
cegs: t.gs("ce", (ceg = function () {}), (ces = function () {})),
|
||||
cew: t("cew", (cew = {})),
|
||||
cw: t("cw", (cw = {})),
|
||||
e: t("e", (e = {})),
|
||||
egs: t.gs("e", (eg = function () {}), (es = function () {})),
|
||||
ew: t("ew", (ew = {})),
|
||||
v: t("", (v = {})),
|
||||
vgs: t.gs("", (vg = function () {}), (vs = function () {})),
|
||||
w: t("w", (w = {})),
|
||||
|
||||
df: t((df = {})),
|
||||
dfgs: t.gs((dfg = function () {}), (dfs = function () {}))
|
||||
});
|
||||
|
||||
return {
|
||||
c: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "c");
|
||||
a(d.value, c, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, true, "Configurable");
|
||||
a(d.enumerable, false, "Enumerable");
|
||||
a(d.writable, false, "Writable");
|
||||
|
||||
d = getOwnPropertyDescriptor(o, "cgs");
|
||||
a(d.value, undefined, "GS Value");
|
||||
a(d.get, cg, "GS Get");
|
||||
a(d.set, cs, "GS Set");
|
||||
a(d.configurable, true, "GS Configurable");
|
||||
a(d.enumerable, false, "GS Enumerable");
|
||||
a(d.writable, undefined, "GS Writable");
|
||||
},
|
||||
ce: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "ce");
|
||||
a(d.value, ce, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, true, "Configurable");
|
||||
a(d.enumerable, true, "Enumerable");
|
||||
a(d.writable, false, "Writable");
|
||||
|
||||
d = getOwnPropertyDescriptor(o, "cegs");
|
||||
a(d.value, undefined, "GS Value");
|
||||
a(d.get, ceg, "GS Get");
|
||||
a(d.set, ces, "GS Set");
|
||||
a(d.configurable, true, "GS Configurable");
|
||||
a(d.enumerable, true, "GS Enumerable");
|
||||
a(d.writable, undefined, "GS Writable");
|
||||
},
|
||||
cew: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "cew");
|
||||
a(d.value, cew, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, true, "Configurable");
|
||||
a(d.enumerable, true, "Enumerable");
|
||||
a(d.writable, true, "Writable");
|
||||
},
|
||||
cw: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "cw");
|
||||
a(d.value, cw, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, true, "Configurable");
|
||||
a(d.enumerable, false, "Enumerable");
|
||||
a(d.writable, true, "Writable");
|
||||
},
|
||||
e: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "e");
|
||||
a(d.value, e, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, false, "Configurable");
|
||||
a(d.enumerable, true, "Enumerable");
|
||||
a(d.writable, false, "Writable");
|
||||
|
||||
d = getOwnPropertyDescriptor(o, "egs");
|
||||
a(d.value, undefined, "GS Value");
|
||||
a(d.get, eg, "GS Get");
|
||||
a(d.set, es, "GS Set");
|
||||
a(d.configurable, false, "GS Configurable");
|
||||
a(d.enumerable, true, "GS Enumerable");
|
||||
a(d.writable, undefined, "GS Writable");
|
||||
},
|
||||
ew: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "ew");
|
||||
a(d.value, ew, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, false, "Configurable");
|
||||
a(d.enumerable, true, "Enumerable");
|
||||
a(d.writable, true, "Writable");
|
||||
},
|
||||
v: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "v");
|
||||
a(d.value, v, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, false, "Configurable");
|
||||
a(d.enumerable, false, "Enumerable");
|
||||
a(d.writable, false, "Writable");
|
||||
|
||||
d = getOwnPropertyDescriptor(o, "vgs");
|
||||
a(d.value, undefined, "GS Value");
|
||||
a(d.get, vg, "GS Get");
|
||||
a(d.set, vs, "GS Set");
|
||||
a(d.configurable, false, "GS Configurable");
|
||||
a(d.enumerable, false, "GS Enumerable");
|
||||
a(d.writable, undefined, "GS Writable");
|
||||
},
|
||||
w: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "w");
|
||||
a(d.value, w, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, false, "Configurable");
|
||||
a(d.enumerable, false, "Enumerable");
|
||||
a(d.writable, true, "Writable");
|
||||
},
|
||||
d: function (a) {
|
||||
var d = getOwnPropertyDescriptor(o, "df");
|
||||
a(d.value, df, "Value");
|
||||
a(d.get, undefined, "Get");
|
||||
a(d.set, undefined, "Set");
|
||||
a(d.configurable, true, "Configurable");
|
||||
a(d.enumerable, false, "Enumerable");
|
||||
a(d.writable, true, "Writable");
|
||||
|
||||
d = getOwnPropertyDescriptor(o, "dfgs");
|
||||
a(d.value, undefined, "GS Value");
|
||||
a(d.get, dfg, "GS Get");
|
||||
a(d.set, dfs, "GS Set");
|
||||
a(d.configurable, true, "GS Configurable");
|
||||
a(d.enumerable, false, "GS Enumerable");
|
||||
a(d.writable, undefined, "GS Writable");
|
||||
},
|
||||
Options: {
|
||||
v: function (a) {
|
||||
var x = {}, d = t(x, { foo: true });
|
||||
a.deep(
|
||||
d,
|
||||
{ configurable: true, enumerable: false, writable: true, value: x, foo: true },
|
||||
"No descriptor"
|
||||
);
|
||||
d = t("c", "foo", { marko: "elo" });
|
||||
a.deep(
|
||||
d,
|
||||
{
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: "foo",
|
||||
marko: "elo"
|
||||
},
|
||||
"Descriptor"
|
||||
);
|
||||
},
|
||||
gs: function (a) {
|
||||
var gFn = function () {}, sFn = function () {}, d;
|
||||
d = t.gs(gFn, sFn, { foo: true });
|
||||
a.deep(
|
||||
d, { configurable: true, enumerable: false, get: gFn, set: sFn, foo: true },
|
||||
"No descriptor"
|
||||
);
|
||||
d = t.gs(null, sFn, { foo: true });
|
||||
a.deep(
|
||||
d,
|
||||
{ configurable: true, enumerable: false, get: undefined, set: sFn, foo: true },
|
||||
"No descriptor: Just set"
|
||||
);
|
||||
d = t.gs(gFn, { foo: true });
|
||||
a.deep(
|
||||
d,
|
||||
{ configurable: true, enumerable: false, get: gFn, set: undefined, foo: true },
|
||||
"No descriptor: Just get"
|
||||
);
|
||||
|
||||
d = t.gs("e", gFn, sFn, { bar: true });
|
||||
a.deep(
|
||||
d, { configurable: false, enumerable: true, get: gFn, set: sFn, bar: true },
|
||||
"Descriptor"
|
||||
);
|
||||
d = t.gs("e", null, sFn, { bar: true });
|
||||
a.deep(
|
||||
d,
|
||||
{ configurable: false, enumerable: true, get: undefined, set: sFn, bar: true },
|
||||
"Descriptor: Just set"
|
||||
);
|
||||
d = t.gs("e", gFn, { bar: true });
|
||||
a.deep(
|
||||
d,
|
||||
{ configurable: false, enumerable: true, get: gFn, set: undefined, bar: true },
|
||||
"Descriptor: Just get"
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
97
web/node_modules/d/test/lazy.js
generated
vendored
Normal file
97
web/node_modules/d/test/lazy.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
"use strict";
|
||||
|
||||
var d = require("../")
|
||||
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var Foo = function () {}, i = 1, o, o2, desc;
|
||||
Object.defineProperties(
|
||||
Foo.prototype,
|
||||
t({
|
||||
bar: d(function () { return ++i; }),
|
||||
bar2: d(function () { return this.bar + 23; }),
|
||||
bar3: d(function () { return this.bar2 + 34; }, { desc: "ew" }),
|
||||
bar4: d(function () { return this.bar3 + 12; }, { cacheName: "_bar4_" }),
|
||||
bar5: d(function () { return this.bar4 + 3; }, { cacheName: "_bar5_", desc: "e" })
|
||||
})
|
||||
);
|
||||
|
||||
desc = getOwnPropertyDescriptor(Foo.prototype, "bar");
|
||||
a(desc.configurable, true, "Configurable: default");
|
||||
a(desc.enumerable, false, "Enumerable: default");
|
||||
|
||||
o = new Foo();
|
||||
a.deep([o.bar, o.bar2, o.bar3, o.bar4, o.bar5], [2, 25, 59, 71, 74], "Values");
|
||||
|
||||
a.deep(
|
||||
getOwnPropertyDescriptor(o, "bar3"),
|
||||
{ configurable: false, enumerable: true, writable: true, value: 59 }, "Desc"
|
||||
);
|
||||
a(o.hasOwnProperty("bar4"), false, "Cache not exposed");
|
||||
desc = getOwnPropertyDescriptor(o, "bar5");
|
||||
a.deep(
|
||||
desc, { configurable: false, enumerable: true, get: desc.get, set: desc.set },
|
||||
"Cache & Desc: desc"
|
||||
);
|
||||
|
||||
o2 = Object.create(o);
|
||||
o2.bar = 30;
|
||||
o2.bar3 = 100;
|
||||
|
||||
a.deep(
|
||||
[o2.bar, o2.bar2, o2.bar3, o2.bar4, o2.bar5], [30, 25, 100, 112, 115], "Extension Values"
|
||||
);
|
||||
|
||||
Foo = function () {};
|
||||
Object.defineProperties(
|
||||
Foo.prototype,
|
||||
t({
|
||||
test: d("w", function () { return "raz"; }),
|
||||
test2: d("", function () { return "raz"; }, { desc: "w" }),
|
||||
test3: d("", function () { return "raz"; }, { cacheName: "__test3__", desc: "w" }),
|
||||
test4: d("w", "bar")
|
||||
})
|
||||
);
|
||||
|
||||
o = new Foo();
|
||||
o.test = "marko";
|
||||
a.deep(
|
||||
getOwnPropertyDescriptor(o, "test"),
|
||||
{ configurable: false, enumerable: false, writable: true, value: "marko" }, "Set before get"
|
||||
);
|
||||
o.test2 = "marko2";
|
||||
a.deep(
|
||||
getOwnPropertyDescriptor(o, "test2"),
|
||||
{ configurable: false, enumerable: false, writable: true, value: "marko2" },
|
||||
"Set before get: Custom desc"
|
||||
);
|
||||
o.test3 = "marko3";
|
||||
a.deep(
|
||||
getOwnPropertyDescriptor(o, "__test3__"),
|
||||
{ configurable: false, enumerable: false, writable: true, value: "marko3" },
|
||||
"Set before get: Custom cache name"
|
||||
);
|
||||
a(o.test4, "bar", "Resolve by value");
|
||||
|
||||
a.h1("Flat");
|
||||
Object.defineProperties(
|
||||
Foo.prototype,
|
||||
t({
|
||||
flat: d(function () { return "foo"; }, { flat: true }),
|
||||
flat2: d(function () { return "bar"; }, { flat: true })
|
||||
})
|
||||
);
|
||||
|
||||
a.h2("Instance");
|
||||
a(o.flat, "foo", "Value");
|
||||
a(o.hasOwnProperty("flat"), false, "Instance");
|
||||
a(Foo.prototype.flat, "foo", "Prototype");
|
||||
|
||||
a.h2("Direct");
|
||||
a(Foo.prototype.flat2, "bar");
|
||||
|
||||
a.h2("Reset direct");
|
||||
Object.defineProperties(Foo.prototype, t({ testResetDirect: d(false) }));
|
||||
|
||||
a.throws(function () { Foo.prototype.testResetDirect = false; }, TypeError);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue