+16
-0
@@ -5,2 +5,18 @@ # Changelog | ||
| ## [0.3.0](https://github.com/numb86/ken-all/compare/v0.2.3...v0.3.0) (2021-05-07) | ||
| ### ⚠ BREAKING CHANGES | ||
| * ライブラリ側が fetch や Promise のポリフィルを用意するのを止める (#67) | ||
| ### Features | ||
| * ライブラリ側が fetch や Promise のポリフィルを用意するのを止める ([#67](https://github.com/numb86/ken-all/issues/67)) ([e8e7c21](https://github.com/numb86/ken-all/commit/e8e7c2122a2774b04de8b5afa74fc1cc5c03b2a9)) | ||
| ### Bug Fixes | ||
| * cors を有効にする ([#69](https://github.com/numb86/ken-all/issues/69)) ([4dd930d](https://github.com/numb86/ken-all/commit/4dd930dbbdad224771e7376600ffc932d4c38f45)) | ||
| ### [0.2.3](https://github.com/numb86/ken-all/compare/v0.2.2...v0.2.3) (2021-03-21) | ||
@@ -7,0 +23,0 @@ |
@@ -1,3 +0,2 @@ | ||
| declare const Promise: any; | ||
| declare const fetchCsv: (postCodeFront: string) => Promise<Response>; | ||
| export default fetchCsv; |
+1
-6
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var Promise = require('es6-promise'); | ||
| var fetch = require('fetch-ponyfill')(Promise).fetch; | ||
| if (typeof global.Promise === 'undefined') { | ||
| global.Promise = Promise; | ||
| } | ||
| var fetchCsv = function (postCodeFront) { | ||
| return fetch("https://ken-all.numb86.net/csv/" + postCodeFront + ".csv"); | ||
| return fetch("https://ken-all.numb86.net/csv/" + postCodeFront + ".csv", { mode: 'cors' }); | ||
| }; | ||
| exports.default = fetchCsv; | ||
| //# sourceMappingURL=fetchCsv.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"fetchCsv.js","sourceRoot":"","sources":["../src/fetchCsv.ts"],"names":[],"mappings":";;AAAA,IAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAChC,IAAA,KAAK,GAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAtC,CAAuC;AAEnD,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,WAAW,EAAE;IACzC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;CAC1B;AAED,IAAM,QAAQ,GAAG,UAAC,aAAqB;IACrC,OAAA,KAAK,CAAC,oCAAkC,aAAa,SAAM,CAAC;AAA5D,CAA4D,CAAC;AAE/D,kBAAe,QAAQ,CAAC"} | ||
| {"version":3,"file":"fetchCsv.js","sourceRoot":"","sources":["../src/fetchCsv.ts"],"names":[],"mappings":";;AAAA,IAAM,QAAQ,GAAG,UAAC,aAAqB;IACrC,OAAA,KAAK,CAAC,oCAAkC,aAAa,SAAM,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;AAA5E,CAA4E,CAAC;AAE/E,kBAAe,QAAQ,CAAC"} |
@@ -1,3 +0,2 @@ | ||
| declare const Promise: any; | ||
| declare const fetchCsv: (postCodeFront: string) => Promise<Response>; | ||
| export default fetchCsv; |
+1
-6
@@ -1,10 +0,5 @@ | ||
| var Promise = require('es6-promise'); | ||
| var fetch = require('fetch-ponyfill')(Promise).fetch; | ||
| if (typeof global.Promise === 'undefined') { | ||
| global.Promise = Promise; | ||
| } | ||
| var fetchCsv = function (postCodeFront) { | ||
| return fetch("https://ken-all.numb86.net/csv/" + postCodeFront + ".csv"); | ||
| return fetch("https://ken-all.numb86.net/csv/" + postCodeFront + ".csv", { mode: 'cors' }); | ||
| }; | ||
| export default fetchCsv; | ||
| //# sourceMappingURL=fetchCsv.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"fetchCsv.js","sourceRoot":"","sources":["../src/fetchCsv.ts"],"names":[],"mappings":"AAAA,IAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAChC,IAAA,KAAK,GAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAtC,CAAuC;AAEnD,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,WAAW,EAAE;IACzC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;CAC1B;AAED,IAAM,QAAQ,GAAG,UAAC,aAAqB;IACrC,OAAA,KAAK,CAAC,oCAAkC,aAAa,SAAM,CAAC;AAA5D,CAA4D,CAAC;AAE/D,eAAe,QAAQ,CAAC"} | ||
| {"version":3,"file":"fetchCsv.js","sourceRoot":"","sources":["../src/fetchCsv.ts"],"names":[],"mappings":"AAAA,IAAM,QAAQ,GAAG,UAAC,aAAqB;IACrC,OAAA,KAAK,CAAC,oCAAkC,aAAa,SAAM,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;AAA5E,CAA4E,CAAC;AAE/E,eAAe,QAAQ,CAAC"} |
+1
-3
| { | ||
| "name": "ken-all", | ||
| "version": "0.2.3", | ||
| "version": "0.3.0", | ||
| "description": "Ken All は、郵便番号で住所を検索できる npm パッケージです。", | ||
@@ -78,4 +78,2 @@ "keywords": [ | ||
| "@types/node": "^14.14.35", | ||
| "es6-promise": "^4.2.8", | ||
| "fetch-ponyfill": "^7.1.0", | ||
| "typescript": "^4.2.3" | ||
@@ -82,0 +80,0 @@ }, |
+27
-4
@@ -66,2 +66,6 @@ <div align="center"> | ||
| ## 注意点 | ||
| 内部で`fetch`を行っているので、`fetch`を使えない環境ではポリフィルが必要になります。 | ||
| # サンプル | ||
@@ -171,10 +175,29 @@ | ||
| Node.js には`fetch`が存在しないので、その対応が必要になります。 | ||
| また、ES Modules で利用するか CommonJS で利用するかで、コードが変わります。 | ||
| いずれも Node.js のバージョン`12.22.1`で確認しています。 | ||
| ```js | ||
| // Node.js のバージョン 12.10.0 で確認 | ||
| const KenAll = require('ken-all').default; | ||
| // ESM | ||
| import fetch from "node-fetch"; | ||
| import KenAll from "ken-all"; | ||
| // [ [ '東京都', '千代田区', '永田町' ] ] | ||
| KenAll('1000014').then(res => console.log(res)); | ||
| global.fetch = fetch; | ||
| // [['東京都', '千代田区', '大手町']]; | ||
| KenAll("1000004").then((res) => console.log(res)); | ||
| ``` | ||
| ```javascript | ||
| // CJS | ||
| const fetch = require("node-fetch"); | ||
| global.fetch = fetch; | ||
| import("ken-all").then((KenAll) => { | ||
| // [['東京都', '千代田区', '大手町']]; | ||
| KenAll.default("1000004").then((res) => console.log(res)); | ||
| }); | ||
| ``` | ||
| ## script タグを使った読み込み | ||
@@ -181,0 +204,0 @@ |
+1
-8
@@ -1,8 +0,1 @@ | ||
| !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.KenAll=e():t.KenAll=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){var n=r(2),o=r(4)(n).fetch;void 0===t.Promise&&(t.Promise=n);e.a=function(t){return o("https://ken-all.numb86.net/csv/"+t+".csv")}}).call(this,r(0))},function(t,e,r){(function(e,r){ | ||
| /*! | ||
| * @overview es6-promise - a tiny implementation of Promises/A+. | ||
| * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) | ||
| * @license Licensed under MIT license | ||
| * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE | ||
| * @version v4.2.8+1e68dce6 | ||
| */var n;n=function(){"use strict";function t(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=0,i=void 0,s=void 0,u=function(t,e){p[o]=t,p[o+1]=e,2===(o+=2)&&(s?s(y):_())},a="undefined"!=typeof window?window:void 0,c=a||{},f=c.MutationObserver||c.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(y,1)}}var p=new Array(1e3);function y(){for(var t=0;t<o;t+=2)(0,p[t])(p[t+1]),p[t]=void 0,p[t+1]=void 0;o=0}var b,v,m,w,_=void 0;function g(t,e){var r=this,n=new this.constructor(E);void 0===n[A]&&R(n);var o=r._state;if(o){var i=arguments[o-1];u((function(){return M(o,n,i,r._result)}))}else P(r,n,t,e);return n}function T(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(E);return O(e,t),e}l?_=function(){return e.nextTick(y)}:f?(v=0,m=new f(y),w=document.createTextNode(""),m.observe(w,{characterData:!0}),_=function(){w.data=v=++v%2}):h?((b=new MessageChannel).port1.onmessage=y,_=function(){return b.port2.postMessage(0)}):_=void 0===a?function(){try{var t=Function("return this")().require("vertx");return void 0!==(i=t.runOnLoop||t.runOnContext)?function(){i(y)}:d()}catch(t){return d()}}():d();var A=Math.random().toString(36).substring(2);function E(){}function x(e,r,n){r.constructor===e.constructor&&n===g&&r.constructor.resolve===T?function(t,e){1===e._state?B(t,e._result):2===e._state?S(t,e._result):P(e,void 0,(function(e){return O(t,e)}),(function(e){return S(t,e)}))}(e,r):void 0===n?B(e,r):t(n)?function(t,e,r){u((function(t){var n=!1,o=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(r,e,(function(r){n||(n=!0,e!==r?O(t,r):B(t,r))}),(function(e){n||(n=!0,S(t,e))}),t._label);!n&&o&&(n=!0,S(t,o))}),t)}(e,r,n):B(e,r)}function O(t,e){if(t===e)S(t,new TypeError("You cannot resolve a promise with itself"));else if(o=typeof(n=e),null===n||"object"!==o&&"function"!==o)B(t,e);else{var r=void 0;try{r=e.then}catch(e){return void S(t,e)}x(t,e,r)}var n,o}function j(t){t._onerror&&t._onerror(t._result),D(t)}function B(t,e){void 0===t._state&&(t._result=e,t._state=1,0!==t._subscribers.length&&u(D,t))}function S(t,e){void 0===t._state&&(t._state=2,t._result=e,u(j,t))}function P(t,e,r,n){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+1]=r,o[i+2]=n,0===i&&t._state&&u(D,t)}function D(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)n=e[s],o=e[s+r],n?M(r,n,o,i):o(i);t._subscribers.length=0}}function M(e,r,n,o){var i=t(n),s=void 0,u=void 0,a=!0;if(i){try{s=n(o)}catch(t){a=!1,u=t}if(r===s)return void S(r,new TypeError("A promises callback cannot return that same promise."))}else s=o;void 0!==r._state||(i&&a?O(r,s):!1===a?S(r,u):1===e?B(r,s):2===e&&S(r,s))}var U=0;function R(t){t[A]=U++,t._state=void 0,t._result=void 0,t._subscribers=[]}var F=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[A]||R(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?B(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&B(this.promise,this._result))):S(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;void 0===this._state&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===T){var o=void 0,i=void 0,s=!1;try{o=t.then}catch(t){s=!0,i=t}if(o===g&&void 0!==t._state)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(r===L){var u=new r(E);s?S(u,i):x(u,t,o),this._willSettleAt(u,e)}else this._willSettleAt(new r((function(e){return e(t)})),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,r){var n=this.promise;void 0===n._state&&(this._remaining--,2===t?S(n,r):this._result[e]=r),0===this._remaining&&B(n,this._result)},t.prototype._willSettleAt=function(t,e){var r=this;P(t,void 0,(function(t){return r._settledAt(1,e,t)}),(function(t){return r._settledAt(2,e,t)}))},t}(),L=function(){function e(t){this[A]=U++,this._result=this._state=void 0,this._subscribers=[],E!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e((function(e){O(t,e)}),(function(e){S(t,e)}))}catch(e){S(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var r=this.constructor;return t(e)?this.then((function(t){return r.resolve(e()).then((function(){return t}))}),(function(t){return r.resolve(e()).then((function(){throw t}))})):this.then(e,e)},e}();return L.prototype.then=g,L.all=function(t){return new F(this,t).promise},L.race=function(t){var e=this;return n(t)?new e((function(r,n){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(r,n)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))},L.resolve=T,L.reject=function(t){var e=new this(E);return S(e,t),e},L._setScheduler=function(t){s=t},L._setAsap=function(t){u=t},L._asap=u,L.polyfill=function(){var t=void 0;if(void 0!==r)t=r;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=L},L.Promise=L,L},t.exports=n()}).call(this,r(3),r(0))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var a,c=[],f=!1,l=-1;function h(){f&&a&&(f=!1,a.length?c=a.concat(c):l=-1,c.length&&d())}function d(){if(!f){var t=u(h);f=!0;for(var e=c.length;e;){for(a=c,c=[];++l<e;)a&&a[l].run();l=-1,e=c.length}a=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||f||u(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){(function(n){var o;!function(n){"use strict";function i(t){var r=t&&t.Promise||n.Promise,o=t&&t.XMLHttpRequest||n.XMLHttpRequest;return function(){var t=Object.create(n,{fetch:{value:void 0,writable:!0}});return function(e){var n=void 0!==t&&t||"undefined"!=typeof self&&self||void 0!==n&&n,i="URLSearchParams"in n,s="Symbol"in n&&"iterator"in Symbol,u="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in n,c="ArrayBuffer"in n;if(c)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(t){return t&&f.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function p(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return s&&(e[Symbol.iterator]=function(){return e}),e}function y(t){this.map={},t instanceof y?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function b(t){if(t.bodyUsed)return r.reject(new TypeError("Already read"));t.bodyUsed=!0}function v(t){return new r((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function m(t){var e=new FileReader,r=v(e);return e.readAsArrayBuffer(t),r}function w(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:u&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():c&&u&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=w(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(t)||l(t))?this._bodyArrayBuffer=w(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u&&(this.blob=function(){var t=b(this);if(t)return t;if(this._bodyBlob)return r.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return r.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return r.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=b(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?r.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):r.resolve(this._bodyArrayBuffer))}return this.blob().then(m)}),this.text=function(){var t,e,n,o=b(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=v(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return r.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return r.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}y.prototype.append=function(t,e){t=h(t),e=d(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},y.prototype.delete=function(t){delete this.map[h(t)]},y.prototype.get=function(t){return t=h(t),this.has(t)?this.map[t]:null},y.prototype.has=function(t){return this.map.hasOwnProperty(h(t))},y.prototype.set=function(t,e){this.map[h(t)]=d(e)},y.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},y.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),p(t)},y.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),p(t)},y.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),p(t)},s&&(y.prototype[Symbol.iterator]=y.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function T(t,e){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,o=(e=e||{}).body;if(t instanceof T){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new y(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new y(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var i=/([?&])_=[^&]*/;i.test(this.url)?this.url=this.url.replace(i,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function E(t,e){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"",this.headers=new y(e.headers),this.url=e.url||"",this._initBody(t)}T.prototype.clone=function(){return new T(this,{body:this._bodyInit})},_.call(T.prototype),_.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];E.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},e.DOMException=n.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function O(t,i){return new r((function(r,s){var a=new T(t,i);if(a.signal&&a.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var f=new o;function l(){f.abort()}f.onload=function(){var t,e,n={status:f.status,statusText:f.statusText,headers:(t=f.getAllResponseHeaders()||"",e=new y,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};n.url="responseURL"in f?f.responseURL:n.headers.get("X-Request-URL");var o="response"in f?f.response:f.responseText;setTimeout((function(){r(new E(o,n))}),0)},f.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},f.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},f.onabort=function(){setTimeout((function(){s(new e.DOMException("Aborted","AbortError"))}),0)},f.open(a.method,function(t){try{return""===t&&n.location.href?n.location.href:t}catch(e){return t}}(a.url),!0),"include"===a.credentials?f.withCredentials=!0:"omit"===a.credentials&&(f.withCredentials=!1),"responseType"in f&&(u?f.responseType="blob":c&&a.headers.get("Content-Type")&&-1!==a.headers.get("Content-Type").indexOf("application/octet-stream")&&(f.responseType="arraybuffer")),!i||"object"!=typeof i.headers||i.headers instanceof y?a.headers.forEach((function(t,e){f.setRequestHeader(e,t)})):Object.getOwnPropertyNames(i.headers).forEach((function(t){f.setRequestHeader(t,d(i.headers[t]))})),a.signal&&(a.signal.addEventListener("abort",l),f.onreadystatechange=function(){4===f.readyState&&a.signal.removeEventListener("abort",l)}),f.send(void 0===a._bodyInit?null:a._bodyInit)}))}O.polyfill=!0,n.fetch||(n.fetch=O,n.Headers=y,n.Request=T,n.Response=E),e.Headers=y,e.Request=T,e.Response=E,e.fetch=O,Object.defineProperty(e,"__esModule",{value:!0})}(e),{fetch:t.fetch,Headers:t.Headers,Request:t.Request,Response:t.Response,DOMException:t.DOMException}}()}void 0===(o=function(){return i}.call(e,r,e,t))||(t.exports=o)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==n?n:this)}).call(this,r(0))},function(t,e,r){"use strict";r.r(e);var n=function(t,e){for(var r=0,n=e.length,o=t.length;r<n;r++,o++)t[o]=e[r];return t},o=function(t){return t.map((function(t){return function(t){var e=n([],t);if(e.shift(),3!==e.length)throw new Error("Failed removeFirstItemFromAddress.");return e}(t)}))},i=r(1),s=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{a(n.next(t))}catch(t){i(t)}}function u(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}a((n=n.apply(t,e||[])).next())}))},u=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};e.default=function(t){return s(void 0,void 0,void 0,(function(){var e,r,n,s;return u(this,(function(u){switch(u.label){case 0:if("string"!=typeof t)throw new Error("The argument must be a string.");if(!/^[0-9]{7}$/.test(t))throw new Error("The post code is always seven digits half-width numbers.");return[4,Object(i.a)(t.slice(0,3))];case 1:if(404===(e=u.sent()).status)return[2,[]];if(e.status>=400)throw new Error("Network error.");return[4,e.text()];case 2:return r=u.sent(),n=function(t){return t.split("\n").filter((function(t){return t.length>0})).map((function(t){var e=t.split(",");if(4!==e.length)throw new Error("CSV was broken.");return e.map((function(t){return t.replace(/"/g,"")}))}))}(r),s=function(t,e){return e.filter((function(e){return e[0]===t}))}(t.slice(3),n),[2,o(s)]}}))}))}}])})); | ||
| !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.KenAll=t():e.KenAll=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r=function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e},o=function(e){return e.map((function(e){return function(e){var t=r([],e);if(t.shift(),3!==t.length)throw new Error("Failed removeFirstItemFromAddress.");return t}(e)}))},u=function(e){return fetch("https://ken-all.numb86.net/csv/"+e+".csv",{mode:"cors"})},i=function(e,t,n,r){return new(n||(n=Promise))((function(o,u){function i(e){try{c(r.next(e))}catch(e){u(e)}}function f(e){try{c(r.throw(e))}catch(e){u(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,f)}c((r=r.apply(e,t||[])).next())}))},f=function(e,t){var n,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:f(0),throw:f(1),return:f(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function f(u){return function(f){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,f])}}};t.default=function(e){return i(void 0,void 0,void 0,(function(){var t,n,r,i;return f(this,(function(f){switch(f.label){case 0:if("string"!=typeof e)throw new Error("The argument must be a string.");if(!/^[0-9]{7}$/.test(e))throw new Error("The post code is always seven digits half-width numbers.");return[4,u(e.slice(0,3))];case 1:if(404===(t=f.sent()).status)return[2,[]];if(t.status>=400)throw new Error("Network error.");return[4,t.text()];case 2:return n=f.sent(),r=function(e){return e.split("\n").filter((function(e){return e.length>0})).map((function(e){var t=e.split(",");if(4!==t.length)throw new Error("CSV was broken.");return t.map((function(e){return e.replace(/"/g,"")}))}))}(n),i=function(e,t){return t.filter((function(t){return t[0]===e}))}(e.slice(3),r),[2,o(i)]}}))}))}}])})); |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
2
-50%244
10.41%3
-81.25%32972
-34.53%243
-8.99%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed