CARVIEW |
Select Language
HTTP/2 301
location: https://raw.githubusercontent.com/nbubna/store/master/src/store.dot.js
accept-ranges: bytes
age: 0
date: Thu, 24 Jul 2025 14:14:41 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210080-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753366480.038385,VS0,VE1211
vary: Accept-Encoding
x-fastly-request-id: ea85fdd6cb504adeb1368fcf68ca888ad31288fa
content-length: 0
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: W/"bd9a113e854567d2900d1fa671b01b85e2348afdabd5c843ff65dc8b3282ccb1"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: BA88:197ED6:147CD:28EB2:68823FD0
content-encoding: gzip
accept-ranges: bytes
date: Thu, 24 Jul 2025 14:14:41 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210043-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753366481.297399,VS0,VE268
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: 0ac47df8a17ef9a12cf056e7ee7ef935bcae93d0
expires: Thu, 24 Jul 2025 14:19:41 GMT
source-age: 0
content-length: 740
/**
* Copyright (c) 2017 ESHA Research
* Dual licensed under the MIT and GPL licenses:
* https://www.opensource.org/licenses/mit-license.php
* https://www.gnu.org/licenses/gpl.html
*
* Adds getters and setters for existing keys (and newly set() ones) to enable dot access to stored properties.
*
* store.dot('foo','bar');// makes store aware of keys (could also do store.set('foo',''))
* store.foo = { is: true };// == store.set('foo', { is: true });
* console.log(store.foo.is);// logs 'true'
*
* This will not create accessors that conflict with existing properties of the store object.
*
* Status: ALPHA - good, but ```store.foo.is=false``` won't persist while looking like it would
*/
;(function(_, Object, Array) {
// expose internals on the underscore to allow extensibility
_.dot = function(key) {
var keys = !key ? this.keys() :
Array.isArray(key) ? key :
Array.prototype.slice.call(arguments),
target = this;
keys.forEach(function(key) {
_.dot.define(target, key);
});
return this;
};
_.dot.define = function(target, key) {
if (!(key in target)) {
Object.defineProperty(target, key, {
enumerable: true,
get: function(){ return this.get(key); },
set: function(value){ this.set(key, value); }
});
}
};
// add function(s) to the store interface
_.fn('dot', _.dot);
})(window.store._, window.Object, window.Array);