PageSourceSearch

https://nodeassets.nbcnews.com/_next/static/chunks/4742-7da8c212202d84a1.js

js nbcnews.com collected 2026-09-24 09:03:54 UTC 9,834 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4742],{4742:(e,t,i)=>{var n=i(65364),r=i(88220).Buffer,a=i(3305),s=i(83516);i(70625);var c={ms:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2592e6},o=[],h=function(e){return function(t){return!function(t){return e===t}(t)}},u=function(e,t){return"\x1b[33m- "+(t?t+" ":"")+(e>1e3?(e/1e3).toFixed(2)+"sec":e+"ms")+"\x1b[0m"};function l(e){return e.getHeaders?e.getHeaders():e._headers}e.exports=new function e(){var t=new s,i={debug:!1,defaultDuration:36e5,enabled:!0,appendKey:[],jsonp:!1,redisClient:!1,headerBlacklist:[],statusCodes:{include:[],exclude:[]},events:{expire:void 0},headers:{},trackPerformance:!1,respectCacheControl:!1},d=[],p=this,f=null,g={},m=[];function y(e,t,r,a){var s=["\x1b[36m[apicache]\x1b[0m",e,t,r,a].filter(function(e){return void 0!==e}),c=n.env.DEBUG&&-1!==n.env.DEBUG.split(",").indexOf("apicache");return(i.debug||c)&&console.log.apply(null,s)}function v(e,t,n){var r=i.statusCodes;return!!t&&(!n||!!n(e,t))&&(!r.exclude||!r.exclude.length||-1===r.exclude.indexOf(t.statusCode))&&(!r.include||!r.include.length||-1!==r.include.indexOf(t.statusCode))}function w(e){return Object.keys(e).filter(function(e){return -1===i.headerBlacklist.indexOf(e)}).reduce(function(t,i){return t[i]=e[i],t},{})}function C(e,t){if(t)if("string"==typeof t)e._apicache.content=(e._apicache.content||"")+t;else if(r.isBuffer(t)){var i=e._apicache.content;"string"==typeof i&&(i=r.from?r.from(i):new r(i)),i||(i=r.alloc?r.alloc(0):new r(0)),e._apicache.content=r.concat([i,t],i.length+t.length)}else e._apicache.content=t}function x(e,n,r,a,s,c,o){n._apicache={write:n.write,writeHead:n.writeHead,end:n.end,cacheable:!0,content:void 0},Object.keys(i.headers).forEach(function(e){n.setHeader(e,i.headers[e])}),n.writeHead=function(){return i.headers["cache-control"]||(v(e,n,o)?n.setHeader("cache-control","max-age="+(s/1e3).toFixed(0)):n.setHeader("cache-control","no-cache, no-store, must-revalidate")),n._apicache.headers=Object.assign({},l(n)),n._apicache.writeHead.apply(this,arguments)},n.write=function(e){return C(n,e),n._apicache.write.apply(this,arguments)},n.end=function(r,h){if(v(e,n,o)&&(C(n,r),n._apicache.cacheable&&n._apicache.content)){(d=e.apicacheGroup)&&(y('group detected "'+d+'"'),(f.groups[d]=f.groups[d]||[]).unshift(a)),f.all.unshift(a);var d,m,x,b=n._apicache.headers||l(n),k=(m=n.statusCode,x=n._apicache.content,{status:m,headers:w(b),data:x,encoding:h,timestamp:new Date().getTime()/1e3}),H=i.redisClient,O=i.events.expire;if(H&&H.connected)try{H.hset(a,"response",JSON.stringify(k)),H.hset(a,"duration",s),H.expire(a,s/1e3,O||function(){})}catch(e){y("[apicache] error in redis.hset()")}else t.add(a,k,s,O);g[a]=setTimeout(function(){p.clear(a,!0)},Math.min(s,0x7fffffff)),y('adding cache entry for "'+a+'" @ '+c,u(new Date-e.apicacheTimer)),y("_apicache.headers: ",n._apicache.headers),y("res.getHeaders(): ",l(n)),y("cacheObject: ",k)}return n._apicache.end.apply(this,arguments)},r()}function b(e,t,i,n,a,s){if(n&&!n(e,t))return a();var c=l(t);Object.assign(c,w(i.headers||{}),{"cache-control":"max-age="+Math.max(0,(s/1e3-(new Date().getTime()/1e3-i.timestamp)).toFixed(0))});var o=i.data;o&&"Buffer"===o.type&&(o="number"==typeof o.data?new r.alloc(o.data):new r.from(o.data));var h=i.headers.etag,u=e.headers["if-none-match"];return u&&h===u?(t.writeHead(304,c),t.end()):(t.writeHead(i.status||200,c),t.end(o,i.encoding))}function k(){for(var e in d)Object.assign(d[e].options,i,d[e].localOptions)}function H(e,t){if("number"==typeof e)return e;if("string"==typeof e){var i=e.match(/^([\d\.,]+)\s?(\w+)$/);if(3===i.length){var n=parseFloat(i[1]),r=i[2].replace(/s$/i,"").toLowerCase();return"m"===r&&(r="ms"),(n||1)*(c[r]||0)}}return t}o.push(this),this.id=o.length,this.clear=function(e,n){var r=f.groups[e],a=i.redisClient;if(r)y('clearing group "'+e+'"'),r.forEach(function(e){if(y('clearing cached entry for "'+e+'"'),clearTimeout(g[e]),delete g[e],i.redisClient)try{a.del(e)}catch(t){console.log('[apicache] error in redis.del("'+e+'")')}else t.delete(e);f.all=f.all.filter(h(e))}),delete f.groups[e];else if(e){if(y("clearing "+(n?"expired":"cached")+' entry for "'+e+'"'),clearTimeout(g[e]),delete g[e],a)try{a.del(e)}catch(t){console.log('[apicache] error in redis.del("'+e+'")')}else t.delete(e);
1f.all=f.all.filter(h(e)),Object.keys(f.groups).forEach(function(t){f.groups[t]=f.groups[t].filter(h(e)),f.groups[t].length||delete f.groups[t]})}else y("clearing entire index"),a?f.all.forEach(function(e){clearTimeout(g[e]),delete g[e];try{a.del(e)}catch(t){console.log('[apicache] error in redis.del("'+e+'")')}}):t.clear(),this.resetIndex();return this.getIndex()},this.getDuration=function(e){return H(e,i.defaultDuration)},this.getPerformance=function(){return m.map(function(e){return e.report()})},this.getIndex=function(e){return e?f.groups[e]:f},this.middleware=function(e,n,r){var s=p.getDuration(e),c={};d.push({options:c});var o=function(e){return e&&(d.find(function(e){return e.options===c}).localOptions=e),k(),c};o(r);var h=i.trackPerformance?new function(){this.hitsLast100=new Uint8Array(25),this.hitsLast1000=new Uint8Array(250),this.hitsLast10000=new Uint8Array(2500),this.hitsLast100000=new Uint8Array(25e3),this.callCount=0,this.hitCount=0,this.lastCacheHit=null,this.lastCacheMiss=null,this.report=function(){return{lastCacheHit:this.lastCacheHit,lastCacheMiss:this.lastCacheMiss,callCount:this.callCount,hitCount:this.hitCount,missCount:this.callCount-this.hitCount,hitRate:0==this.callCount?null:this.hitCount/this.callCount,hitRateLast100:this.hitRate(this.hitsLast100),hitRateLast1000:this.hitRate(this.hitsLast1000),hitRateLast10000:this.hitRate(this.hitsLast10000),hitRateLast100000:this.hitRate(this.hitsLast100000)}},this.hitRate=function(e){for(var t=0,i=0,n=0;n<e.length;n++){var r=e[n];for(j=0;j<4;j++){switch(3&r){case 1:t++;break;case 2:i++}r>>=2}}var a=t+i;return 0==a?null:t/a},this.recordHitInArray=function(e,t){var i=~~(this.callCount/4)%e.length,n=this.callCount%4*2;e[i]=e[i]&~(3<<n)|(t?1:2)<<n},this.recordHit=function(e){this.recordHitInArray(this.hitsLast100,e),this.recordHitInArray(this.hitsLast1000,e),this.recordHitInArray(this.hitsLast10000,e),this.recordHitInArray(this.hitsLast100000,e),e&&this.hitCount++,this.callCount++},this.hit=function(e){this.recordHit(!0),this.lastCacheHit=e},this.miss=function(e){this.recordHit(!1),this.lastCacheMiss=e}}:new function(){this.report=this.hit=this.miss=function(){}};m.push(h);var l=function(i,r,o){if(!c.enabled||i.headers["x-apicache-bypass"]||i.headers["x-apicache-force-fetch"]||c.respectCacheControl&&"no-cache"==i.headers["cache-control"])return y("bypass detected, skipping cache."),o();i.apicacheTimer=new Date;var l=i.originalUrl||i.url;if(c.jsonp&&(l=a.parse(l).pathname),"function"==typeof c.appendKey)l+="$$appendKey="+c.appendKey(i,r);else if(c.appendKey.length>0){for(var d=i,p=0;p<c.appendKey.length;p++)d=d[c.appendKey[p]];l+="$$appendKey="+d}var f=c.redisClient,g=f?null:t.getValue(l);if(g){var m=new Date-i.apicacheTimer;return y("sending cached (memory-cache) version of",l,u(m)),h.hit(l),b(i,r,g,n,o,s)}if(!f||!f.connected)return h.miss(l),x(i,r,o,l,s,e,n);try{f.hgetall(l,function(t,a){if(t||!a||!a.response)return h.miss(l),x(i,r,o,l,s,e,n);var c=new Date-i.apicacheTimer;return y("sending cached (redis) version of",l,u(c)),h.hit(l),b(i,r,JSON.parse(a.response),n,o,s)})}catch(t){return h.miss(l),x(i,r,o,l,s,e,n)}};return l.options=o,l},this.options=function(e){return e?(Object.assign(i,e),k(),"defaultDuration"in e&&(i.defaultDuration=H(i.defaultDuration,36e5)),i.trackPerformance&&y("WARNING: using trackPerformance flag can cause high memory usage!"),this):i},this.resetIndex=function(){f={all:[],groups:{}}},this.newInstance=function(t){var i=new e;return t&&i.options(t),i},this.clone=function(){return this.newInstance(this.options())},this.resetIndex()}},70625:e=>{"use strict";e.exports=JSON.parse('{"name":"apicache","version":"1.6.3","scripts":{"lint":"eslint .","pretest":"npm run lint","test":"nyc mocha $(find test -name \'*.test.js\') --recursive","test:watch":"npm run test -- --watch","coverage":"nyc report --reporter=text-lcov | coveralls","prepublish":"npm run test"},"engines":{"node":">=8"},"description":"An ultra-simplified API response caching middleware for Express/Node using plain-english durations.","main":"./src/apicache.js","repository":{"type":"git","url":"https://github.com/kwhitley/apicache.git"}
1,"keywords":["cache","API","redis","memcache","response","express","JSON","duration","middleware","memory"],"author":"Kevin R. Whitley <[email protected]> (http://krwhitley.com)","license":"MIT","bugs":{"url":"https://github.com/kwhitley/apicache/issues","email":"[email protected]"},"devDependencies":{"chai":"^4.2.0","compression":"^1.7.4","coveralls":"^3.0.6","eslint":"^4.18.0","express":"^4.17.1","fakeredis":"^2.0.0","husky":"^3.0.4","mocha":"^7.0.0","nyc":"^13.3.0","prettier":"^1.18.2","pretty-quick":"^1.11.1","restify":"^7.7.0","restify-etag-cache":"^1.0.12","supertest":"^4.0.2"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged && npm run test"}}}')},83516:e=>{function t(){this.cache={},this.size=0}t.prototype.add=function(e,t,i,n){this.cache[e];var r=this,a={value:t,expire:i+Date.now(),timeout:setTimeout(function(){return r.delete(e),n&&"function"==typeof n&&n(t,e)},i)};return this.cache[e]=a,this.size=Object.keys(this.cache).length,a},t.prototype.delete=function(e){var t=this.cache[e];return t&&clearTimeout(t.timeout),delete this.cache[e],this.size=Object.keys(this.cache).length,null},t.prototype.get=function(e){return this.cache[e]},t.prototype.getValue=function(e){var t=this.get(e);return t&&t.value},t.prototype.clear=function(){return Object.keys(this.cache).forEach(function(e){this.delete(e)},this),!0},e.exports=t}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.