Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hscmap/fits

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hscmap/fits - npm Package Compare versions

Comparing version 1.3.3 to 2.0.0

build/dist/4c54190d322a6fd1bd92.worker.js

317

build/dist/index.js

@@ -1,316 +0,1 @@

(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var common_1 = __webpack_require__(1);
var Hdu = /** @class */ (function () {
function Hdu(header, data, dataType) {
this.header = header;
this.data = data;
this.dataType = dataType;
}
Hdu.fromSource = function (source) {
return new Hdu(source.header, source.data, source.dataType);
};
Hdu.prototype.card = function (key, type) {
return common_1.card(this.header, key, type);
};
Hdu.prototype.uint8array = function (cb) { this.typedArray(common_1.DataType.uint8, Uint8Array, cb); };
Hdu.prototype.uint16array = function (cb) { this.typedArray(common_1.DataType.uint16, Uint16Array, cb); };
Hdu.prototype.uint32array = function (cb) { this.typedArray(common_1.DataType.uint32, Uint32Array, cb); };
Hdu.prototype.float32arrray = function (cb) { this.typedArray(common_1.DataType.float32, Float32Array, cb); };
Hdu.prototype.float64arrray = function (cb) { this.typedArray(common_1.DataType.float64, Float64Array, cb); };
Hdu.prototype.typedArray = function (dataType, ctr, cb) {
if (this.dataType != dataType)
throw new Error("type mismatch: " + common_1.DataType[this.dataType] + " -> " + common_1.DataType[dataType]);
cb(new ctr(this.data));
};
return Hdu;
}());
exports.Hdu = Hdu;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DataType;
(function (DataType) {
DataType[DataType["uint8"] = 0] = "uint8";
DataType[DataType["uint16"] = 1] = "uint16";
DataType[DataType["uint32"] = 2] = "uint32";
DataType[DataType["float32"] = 3] = "float32";
DataType[DataType["float64"] = 4] = "float64";
})(DataType = exports.DataType || (exports.DataType = {}));
function card(header, key, type, defaultValue) {
var value = header[key];
if (value == undefined)
value = defaultValue;
if (typeof value != type)
throw new Error("Type mismatch: " + value + " for " + key);
return value;
}
exports.card = card;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(3);
module.exports = __webpack_require__(4);
/***/ }),
/* 3 */
/***/ (function(module, exports) {
module.exports = require("es6-promise/auto");
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fits_1 = __webpack_require__(5);
exports.Fits = fits_1.Fits;
var hdu_1 = __webpack_require__(0);
exports.Hdu = hdu_1.Hdu;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var decoder_1 = __webpack_require__(6);
var common_1 = __webpack_require__(1);
var Fits = /** @class */ (function (_super) {
__extends(Fits, _super);
function Fits() {
return _super.call(this) || this;
}
Fits.decode = function (arraybuffer, hduDecodeOptions) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.decoder || (this.decoder = new decoder_1.Decoder());
return [4 /*yield*/, this.decoder.decode(arraybuffer, hduDecodeOptions)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
Fits.fetch = function (url, hduDecodeOptions) {
return __awaiter(this, void 0, void 0, function () {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.decode;
return [4 /*yield*/, ajax(url)];
case 1: return [4 /*yield*/, _a.apply(this, [_b.sent(), hduDecodeOptions])];
case 2: return [2 /*return*/, _b.sent()];
}
});
});
};
Fits.DataType = common_1.DataType;
return Fits;
}(Array));
exports.Fits = Fits;
function ajax(url) {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onload = function () { return resolve(xhr.response); };
xhr.onerror = function (error) { return reject(error); };
xhr.responseType = 'arraybuffer';
xhr.send();
});
}
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DecodeWorker = __webpack_require__(7);
var hdu_1 = __webpack_require__(0);
var Decoder = /** @class */ (function () {
function Decoder() {
this.requestId = 0;
this.callbacks = new Map();
}
Decoder.prototype.decode = function (fileContent, hduDecodeOptions) {
var _this = this;
return new Promise(function (resolve, reject) {
var worker = _this.setupWorker();
var requestId = ++_this.requestId;
var request = {
requestId: requestId,
fileContent: fileContent,
hduDecodeOptions: hduDecodeOptions,
};
_this.callbacks.set(requestId, {
resolve: resolve,
reject: reject,
});
worker.postMessage(request);
});
};
Decoder.prototype.setupWorker = function () {
var _this = this;
if (this.worker)
return this.worker;
this.worker = new DecodeWorker();
this.worker.addEventListener('message', function (e) {
var response = e.data;
var _a = _this.callbacks.get(response.requestId), resolve = _a.resolve, reject = _a.reject;
response.error ? reject(response.error) : resolve(response.hduSources.map(hdu_1.Hdu.fromSource));
_this.callbacks.delete(response.requestId);
});
return this.worker;
};
Decoder.prototype.close = function () {
this.worker.terminate();
};
return Decoder;
}());
exports.Decoder = Decoder;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = function() {
return new Worker(__webpack_require__.p + "8a759e0fa39a925b8dd4.worker.js");
};
/***/ })
/******/ ])));
!function(t,e){for(var r in e)t[r]=e[r]}(exports,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,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},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=7)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.uint8=0]="uint8",t[t.uint16=1]="uint16",t[t.uint32=2]="uint32",t[t.float32=3]="float32",t[t.float64=4]="float64"}(e.DataType||(e.DataType={})),e.card=function(t,e,r,n){var o=t[e];if(void 0==o&&(o=n),typeof o!=r)throw new Error("Type mismatch: "+o+" for "+e);return o}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=function(){function t(t,e,r){this.header=t,this.data=e,this.dataType=r}return t.fromSource=function(e){return new t(e.header,e.data,e.dataType)},t.prototype.card=function(t,e){return n.card(this.header,t,e)},t.prototype.uint8array=function(){return this.typedArray(n.DataType.uint8,Uint8Array)},t.prototype.uint16array=function(){return this.typedArray(n.DataType.uint16,Uint16Array)},t.prototype.uint32array=function(){return this.typedArray(n.DataType.uint32,Uint32Array)},t.prototype.float32array=function(){return this.typedArray(n.DataType.float32,Float32Array)},t.prototype.float64array=function(){return this.typedArray(n.DataType.float64,Float64Array)},t.prototype.typedArray=function(t,e){if(this.dataType!=t)throw new Error("type mismatch: "+n.DataType[this.dataType]+" -> "+n.DataType[t]);return new e(this.data)},t}();e.Hdu=o},function(t,e,r){t.exports=function(){return new Worker(r.p+"4c54190d322a6fd1bd92.worker.js")}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2),o=r(1),i=function(){function t(){this.requestId=0,this.callbacks=new Map}return t.prototype.decode=function(t,e){var r=this;return new Promise(function(n,o){var i=r.setupWorker(),a=++r.requestId,u={requestId:a,fileContent:t,hduDecodeOptions:e};r.callbacks.set(a,{resolve:n,reject:o}),i.postMessage(u)})},t.prototype.setupWorker=function(){var t=this;return this.worker?this.worker:(this.worker=new n,this.worker.addEventListener("message",function(e){var r=e.data,n=t.callbacks.get(r.requestId),i=n.resolve,a=n.reject;r.error?a(r.error):i(r.hduSources.map(o.Hdu.fromSource)),t.callbacks.delete(r.requestId)}),this.worker)},t.prototype.close=function(){this.worker.terminate()},t}();e.Decoder=i},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(a,u)}c((n=n.apply(t,e||[])).next())})},a=this&&this.__generator||function(t,e){var r,n,o,i,a={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(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}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])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=r(3),c=r(0),s=function(t){function e(){return t.call(this)||this}return o(e,t),e.decode=function(t,e){return i(this,void 0,void 0,function(){return a(this,function(r){switch(r.label){case 0:return this.decoder||(this.decoder=new u.Decoder),[4,this.decoder.decode(t,e)];case 1:return[2,r.sent()]}})})},e.fetch=function(t,e){return i(this,void 0,void 0,function(){var r;return a(this,function(n){switch(n.label){case 0:return r=this.decode,[4,function(t){return new Promise(function(e,r){var n=new XMLHttpRequest;n.open("GET",t),n.onload=function(){return e(n.response)},n.onerror=function(t){return r(t)},n.responseType="arraybuffer",n.send()})}(t)];case 1:return[4,r.apply(this,[n.sent(),e])];case 2:return[2,n.sent()]}})})},e.DataType=c.DataType,e}(Array);e.Fits=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(4);e.Fits=n.Fits;var o=r(1);e.Hdu=o.Hdu},function(t,e){t.exports=require("es6-promise/auto")},function(t,e,r){r(6),t.exports=r(5)}]));

@@ -9,8 +9,8 @@ import { Header, HduSource, CardTypes, DataType } from "./common";

card<T extends keyof CardTypes>(key: string, type: T): CardTypes[T];
uint8array(cb: (array: Uint8Array) => void): void;
uint16array(cb: (array: Uint16Array) => void): void;
uint32array(cb: (array: Uint32Array) => void): void;
float32arrray(cb: (array: Float32Array) => void): void;
float64arrray(cb: (array: Float64Array) => void): void;
private typedArray<T>(dataType, ctr, cb);
uint8array(): Uint8Array;
uint16array(): Uint16Array;
uint32array(): Uint32Array;
float32array(): Float32Array;
float64array(): Float64Array;
private typedArray<T>(dataType, ctr);
}
{
"name": "@hscmap/fits",
"version": "1.3.3",
"version": "2.0.0",
"description": "fits (Flexible Image Transport System) reader module",

@@ -8,4 +8,5 @@ "main": "build/dist/index.js",

"scripts": {
"prepublish": "webpack --config ./build/webpack.config.js --context build",
"example": "webpack --config ./example/webpack.config.js --context example",
"prepublish": "webpack --config ./build/webpack.config.js --context build --mode production",
"example": "webpack --config ./example/webpack.config.js --context example --mode production",
"example-server": "webpack-dev-server --config ./example/webpack.config.js --context example --mode development",
"gh-pages": "npm run example && gh-pages -d example/dist"

@@ -20,15 +21,16 @@ },

"dependencies": {
"es6-promise": "^4.1.1",
"es6-promise": "^4.2.4",
"gzip-js": "^0.3.2"
},
"devDependencies": {
"typescript": "^2.6.2",
"file-loader": "^1.1.5",
"html-webpack-plugin": "^2.30.1",
"ts-loader": "^3.1.0",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.3",
"worker-loader": "^1.1.0"
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.2.0",
"ts-loader": "^4.2.0",
"typescript": "^2.8.3",
"webpack": "^4.6.0",
"webpack-cli": "^2.0.15",
"webpack-dev-server": "^3.1.3",
"worker-loader": "^1.1.1"
},
"repository": "github:michitaro/fits"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc