citation-js 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/citation.js CHANGED
@@ -14526,6 +14526,9 @@ function parseEntities(_ref4) {
14526
14526
  },{"./customProps.json":103,"./ignoredProps.json":106,"./prop.js":108,"./props.json":109,"./response.js":110,"@citation-js/core":10}],105:[function(require,module,exports){
14527
14527
  "use strict";
14528
14528
 
14529
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
14530
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14531
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14529
14532
  Object.defineProperty(exports, "__esModule", {
14530
14533
  value: true
14531
14534
  });
@@ -14538,8 +14541,23 @@ function _interopRequireDefault(obj) {
14538
14541
  };
14539
14542
  }
14540
14543
  function parseWikidata(data, langs) {
14541
- var list = [].concat(data);
14542
- return [].concat(_wikidataSdk["default"].getManyEntities(list, langs || _config["default"].langs));
14544
+ var ids = Array.isArray(data) ? data : [data];
14545
+ var _iterator = _createForOfIteratorHelper(ids),
14546
+ _step;
14547
+ try {
14548
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
14549
+ var id = _step.value;
14550
+ if (!/^Q[1-9][0-9]*$/.test(id)) {
14551
+ throw new Error("Entity \"".concat(id, "\" not found"));
14552
+ }
14553
+ }
14554
+ } catch (err) {
14555
+ _iterator.e(err);
14556
+ } finally {
14557
+ _iterator.f();
14558
+ }
14559
+ var urls = _wikidataSdk["default"].getManyEntities(ids, langs || _config["default"].langs);
14560
+ return Array.isArray(urls) ? urls : [urls];
14543
14561
  }
14544
14562
 
14545
14563
  },{"./config.json":102,"wikidata-sdk":684}],106:[function(require,module,exports){
@@ -15295,6 +15313,9 @@ function completeResponse(entities, old) {
15295
15313
  function simplifyEntities(entities) {
15296
15314
  var simplified = _wikidataSdk.simplify.entities(entities, SIMPLIFY_OPTS);
15297
15315
  for (var id in entities) {
15316
+ if (entities[id].missing === '') {
15317
+ throw new Error("Entity \"".concat(id, "\" not found"));
15318
+ }
15298
15319
  var claims = entities[id].claims;
15299
15320
  if (claims.P348) {
15300
15321
  simplified[id].claims['P348:all'] = _wikidataSdk.simplify.propertyClaims(claims.P348, _objectSpread(_objectSpread({}, SIMPLIFY_OPTS), {}, {