CARVIEW |
Select Language
HTTP/2 301
location: https://raw.githubusercontent.com/nbubna/store/master/src/store.dot.js
accept-ranges: bytes
age: 0
date: Wed, 23 Jul 2025 03:11:12 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210042-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753240271.269985,VS0,VE944
vary: Accept-Encoding
x-fastly-request-id: 9778e6fa46c707bee5517e03459462a804ea3c17
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: 1080:1A9663:46558:10D4AA:688052CE
content-encoding: gzip
accept-ranges: bytes
date: Wed, 23 Jul 2025 03:11:12 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210088-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753240272.268952,VS0,VE263
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: f980ee8e292b9aeda0fc0d565505a5d0753be273
expires: Wed, 23 Jul 2025 03:16:12 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);