masticate 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,77 +1,66 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  var _index = require("../index");
4
-
5
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
6
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
-
7
7
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
-
9
8
  var fs = require("fs");
10
-
11
9
  var expect = require("chai").expect;
12
-
13
10
  describe("Chowhound Parser", function () {
14
- it("sets all values", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
15
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
16
- while (1) {
17
- switch (_context2.prev = _context2.next) {
18
- case 0:
19
- fs.readFile("test/fixtures/chowhound.html", /*#__PURE__*/function () {
20
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(err, html) {
21
- var rec, expected, i;
22
- return regeneratorRuntime.wrap(function _callee$(_context) {
23
- while (1) {
24
- switch (_context.prev = _context.next) {
25
- case 0:
26
- _context.next = 2;
27
- return _index.Masticate.parse(html);
28
-
29
- case 2:
30
- rec = _context.sent;
31
- expect(rec.name).to.equal("Steak and Bacon Salad");
32
- expect(rec.author).to.equal("Kim Laidlaw");
33
- expect(rec.cook_time).to.equal(null);
34
- expect(rec.description).to.equal("For this classic steak and bacon salad recipe, crispy bacon mingles with cold grilled steak, romaine hearts, watercress or arugula, crumbled blue cheese, and cherry tomatoes in creamy Blue Cheese–Yogurt Dressing.");
35
- expect(rec.image_url).to.equal("https://www.chowstatic.com/assets/2015/04/31354_steak_bacon_salad.jpg");
36
- expect(rec.ingredients.length).to.equal(8);
37
- expected = ["4 to 6 thick-cut slices bacon, coarsely chopped", "6 cups chopped romaine hearts", "2 cups chopped watercress and/or arugula", "1/2 cup Blue Cheese-Yogurt Dressing (see note), plus more for passing", "1 cup halved cherry tomatoes", "Leftover grilled steak, thinly sliced", "Chopped chives, for garnish", "Crumbled blue cheese, for garnish"];
38
-
39
- for (i = 0; i > rec.ingredients.length; i++) {
40
- expect(rec.ingredients[i]).to.equal([expected[i]]);
41
- }
42
-
43
- expect(rec.instructions).to.equal("1In a frying pan over medium heat, fry the bacon until crisp. Drain on paper towels.\n" + "2Place the salad greens in a wide, shallow salad bowl, drizzle with a little dressing, and toss to coat.\n" + "3Scatter with the bacon and tomatoes then top with the steak.\n" + "4Garnish with some of the chives and blue cheese. Serve, passing additional dressing on the side.\n" + "Share on FacebookShare on RedditPrintEmailSave (33)");
44
- expect(rec.prep_time).to.equal(null);
45
- expect(rec.published_date).to.equal(null);
46
- expect(rec["yield"]).to.equal('4 to 6 servings'); // expect(rec.nutrition.calories).to.equal('192');
47
- // expect(rec.nutrition.cholesterol).to.equal('27.91mg');
48
- // expect(rec.nutrition.fiber).to.equal("2.17g");
49
- // expect(rec.nutrition.protein).to.equal('7.15g');
50
- // expect(rec.nutrition.saturated_fat).to.equal("5.51g");
51
- // expect(rec.nutrition.sodium).to.equal('264.59mg');
52
- // expect(rec.nutrition.sugar).to.equal("3.98g");
53
- // expect(rec.nutrition.total_carbohydrates).to.equal('6.28g');
54
- // expect(rec.nutrition.total_fat).to.equal("15.75g");
55
- // expect(rec.nutrition.trans_fat).to.equal("0.05g");
56
- // expect(rec.nutrition.unsaturated_fat).to.equal(null);
57
-
58
- case 15:
59
- case "end":
60
- return _context.stop();
11
+ it("sets all values", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
12
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
13
+ while (1) switch (_context2.prev = _context2.next) {
14
+ case 0:
15
+ fs.readFile("test/fixtures/chowhound.html", /*#__PURE__*/function () {
16
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(err, html) {
17
+ var rec, expected, i;
18
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19
+ while (1) switch (_context.prev = _context.next) {
20
+ case 0:
21
+ _context.next = 2;
22
+ return _index.Masticate.parse(html);
23
+ case 2:
24
+ rec = _context.sent;
25
+ expect(rec.name).to.equal("Steak and Bacon Salad");
26
+ expect(rec.author).to.equal("Kim Laidlaw");
27
+ expect(rec.cook_time).to.equal(null);
28
+ expect(rec.description).to.equal("For this classic steak and bacon salad recipe, crispy bacon mingles with cold grilled steak, romaine hearts, watercress or arugula, crumbled blue cheese, and cherry tomatoes in creamy Blue Cheese–Yogurt Dressing.");
29
+ expect(rec.image_url).to.equal("https://www.chowstatic.com/assets/2015/04/31354_steak_bacon_salad.jpg");
30
+ expect(rec.ingredients.length).to.equal(8);
31
+ expected = ["4 to 6 thick-cut slices bacon, coarsely chopped", "6 cups chopped romaine hearts", "2 cups chopped watercress and/or arugula", "1/2 cup Blue Cheese-Yogurt Dressing (see note), plus more for passing", "1 cup halved cherry tomatoes", "Leftover grilled steak, thinly sliced", "Chopped chives, for garnish", "Crumbled blue cheese, for garnish"];
32
+ for (i = 0; i > rec.ingredients.length; i++) {
33
+ expect(rec.ingredients[i]).to.equal([expected[i]]);
61
34
  }
62
- }
63
- }, _callee);
64
- }));
65
-
66
- return function (_x, _x2) {
67
- return _ref2.apply(this, arguments);
68
- };
69
- }());
35
+ expect(rec.instructions).to.equal("1In a frying pan over medium heat, fry the bacon until crisp. Drain on paper towels.\n" + "2Place the salad greens in a wide, shallow salad bowl, drizzle with a little dressing, and toss to coat.\n" + "3Scatter with the bacon and tomatoes then top with the steak.\n" + "4Garnish with some of the chives and blue cheese. Serve, passing additional dressing on the side.\n" + "Share on FacebookShare on RedditPrintEmailSave (33)");
36
+ expect(rec.prep_time).to.equal(null);
37
+ expect(rec.published_date).to.equal(null);
38
+ expect(rec["yield"]).to.equal('4 to 6 servings');
70
39
 
71
- case 1:
72
- case "end":
73
- return _context2.stop();
74
- }
40
+ // expect(rec.nutrition.calories).to.equal('192');
41
+ // expect(rec.nutrition.cholesterol).to.equal('27.91mg');
42
+ // expect(rec.nutrition.fiber).to.equal("2.17g");
43
+ // expect(rec.nutrition.protein).to.equal('7.15g');
44
+ // expect(rec.nutrition.saturated_fat).to.equal("5.51g");
45
+ // expect(rec.nutrition.sodium).to.equal('264.59mg');
46
+ // expect(rec.nutrition.sugar).to.equal("3.98g");
47
+ // expect(rec.nutrition.total_carbohydrates).to.equal('6.28g');
48
+ // expect(rec.nutrition.total_fat).to.equal("15.75g");
49
+ // expect(rec.nutrition.trans_fat).to.equal("0.05g");
50
+ // expect(rec.nutrition.unsaturated_fat).to.equal(null);
51
+ case 15:
52
+ case "end":
53
+ return _context.stop();
54
+ }
55
+ }, _callee);
56
+ }));
57
+ return function (_x, _x2) {
58
+ return _ref2.apply(this, arguments);
59
+ };
60
+ }());
61
+ case 1:
62
+ case "end":
63
+ return _context2.stop();
75
64
  }
76
65
  }, _callee2);
77
66
  })));
@@ -1,66 +1,46 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.EpicuriousParser = void 0;
9
-
10
8
  var _schema_org_recipe_parser = require("../schema_org_recipe_parser");
11
-
12
9
  var _cheerio = _interopRequireDefault(require("cheerio"));
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
11
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
-
18
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
19
-
12
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
20
13
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
-
22
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
23
-
24
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
25
-
26
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
27
-
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
28
17
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
29
-
30
18
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
-
32
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
33
-
34
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
-
36
- var EpicuriousParser = /*#__PURE__*/function (_SchemaOrgRecipeParse) {
37
- _inherits(EpicuriousParser, _SchemaOrgRecipeParse);
38
-
39
- var _super = _createSuper(EpicuriousParser);
40
-
19
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
20
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
22
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
+ var EpicuriousParser = exports.EpicuriousParser = /*#__PURE__*/function (_SchemaOrgRecipeParse) {
41
24
  function EpicuriousParser() {
42
25
  _classCallCheck(this, EpicuriousParser);
43
-
44
- return _super.apply(this, arguments);
26
+ return _callSuper(this, EpicuriousParser, arguments);
45
27
  }
46
-
47
- _createClass(EpicuriousParser, null, [{
28
+ _inherits(EpicuriousParser, _SchemaOrgRecipeParse);
29
+ return _createClass(EpicuriousParser, null, [{
48
30
  key: "can_parse",
49
31
  value: function can_parse(html) {
50
32
  return this.matches_domain(html, 'epicurious.com');
51
- } // parse_ingredients() {
33
+ }
34
+
35
+ // parse_ingredients() {
52
36
  // var node = this.recipe_node.find('.ingredients');
53
37
  // return $(node).map(v => $(v).text());
54
38
  // }
39
+
55
40
  // parse_instructions() {
56
41
  // var node = this.node_with_itemprop("recipeInstructions");
57
42
  // var greds = $(node.find(">p")).map(v => $(v).text()).toArray().join("\n");
58
43
  // return greds
59
44
  // }
60
-
61
45
  }]);
62
-
63
- return EpicuriousParser;
64
- }(_schema_org_recipe_parser.SchemaOrgRecipeParser);
65
-
66
- exports.EpicuriousParser = EpicuriousParser;
46
+ }(_schema_org_recipe_parser.SchemaOrgRecipeParser);
@@ -1,67 +1,54 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  var _index = require("../index");
4
-
5
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
6
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
-
7
7
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
-
9
8
  var fs = require("fs");
10
-
11
9
  var expect = require("chai").expect;
12
-
13
10
  describe("Epicurious Parser", function () {
14
- it("sets all values", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
15
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
16
- while (1) {
17
- switch (_context2.prev = _context2.next) {
18
- case 0:
19
- fs.readFile("test/fixtures/epicurious.html", /*#__PURE__*/function () {
20
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(err, html) {
21
- var rec, expected, i;
22
- return regeneratorRuntime.wrap(function _callee$(_context) {
23
- while (1) {
24
- switch (_context.prev = _context.next) {
25
- case 0:
26
- _context.next = 2;
27
- return _index.Masticate.parse(html);
28
-
29
- case 2:
30
- rec = _context.sent;
31
- expect(rec.name).to.equal("Chickpea Pancakes with Leeks, Squash, and Yogurt");
32
- expect(rec.author).to.equal("Alison Roman");
33
- expect(rec.cook_time).to.equal(null);
34
- expect(rec.description).to.equal("Weekday pancakes sound like a stretch? Make the batter Sunday evening and start the week strong.");
35
- expect(rec.image_url).to.equal("https://assets.epicurious.com/photos/54b71f83ac90eb2c34cfbdf0/master/pass/51260630_chickpea-pancakes_1x1.jpg");
36
- expected = ["6 tablespoons olive oil, divided", "1 medium leek, white and pale-green parts only, chopped", "1/2 teaspoon kosher salt, plus more", "Freshly ground black pepper", "1 cup grated peeled squash (such as butternut or kabocha)", "1 large egg", "3/4 cup chickpea flour", "1/4 teaspoon baking powder", "1/2 cup plain yogurt", "1/4 cup coarsely chopped fresh parsley", "Flaky sea salt (such as Maldon)"];
37
- expect(rec.ingredients.length).to.equal(expected.length);
38
-
39
- for (i = 0; i > rec.ingredients.length; i++) {
40
- expect(rec.ingredients[i]).to.equal([expected[i]]);
41
- }
42
-
43
- expect(rec.instructions).to.equal("Preparation Heat 2 tablespoons oil in a large skillet, preferably nonstick, over medium-high.\n" + "Add leek, season with kosher salt and pepper, and cook, stirring occasionally, until leek is softened and starting to brown, about 4 minutes. Add squash and season again. Cook, stirring often, until squash is cooked through and softened, about 4 minutes. Transfer vegetables to a plate and let cool.\n" + "Wipe out skillet and reserve.\n" + "Meanwhile, whisk egg, chickpea flour, baking powder, 1 tablespoon oil, 1/2 teaspoon kosher salt, and 1/2 cup water in a medium bowl; season with pepper and let sit 5 minutes for flour to hydrate. Stir vegetables into batter just to coat.\n" + "Heat 1 1/2 tablespoons oil in reserved skillet over medium-high. Add batter by the 1/4-cupful to make 4 pancakes, gently flattening to about 1/4\" thick. Batter should spread easily—if it doesn't, thin with a little water. Cook until bottoms are lightly browned and bubbles form on top, about 4 minutes. Use a spatula to carefully flip pancakes over and cook until browned and cooked through, about 2 minutes longer. Transfer to a plate and tent with a sheet of foil to keep warm. Repeat with another 1 1/2 tablespoons oil and remaining batter. Serve pancakes topped with yogurt, parsley, sea salt, and pepper.\n" + "Do ahead: Leek and squash can be cooked 2 days ahead; cover and chill. Batter can be made 1 day ahead; cover and chill.");
44
- expect(rec.prep_time).to.equal(null);
45
- expect(rec.published_date).to.equal(null);
46
- expect(rec["yield"]).to.equal('4 servings');
47
-
48
- case 15:
49
- case "end":
50
- return _context.stop();
11
+ it("sets all values", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
12
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
13
+ while (1) switch (_context2.prev = _context2.next) {
14
+ case 0:
15
+ fs.readFile("test/fixtures/epicurious.html", /*#__PURE__*/function () {
16
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(err, html) {
17
+ var rec, expected, i;
18
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19
+ while (1) switch (_context.prev = _context.next) {
20
+ case 0:
21
+ _context.next = 2;
22
+ return _index.Masticate.parse(html);
23
+ case 2:
24
+ rec = _context.sent;
25
+ expect(rec.name).to.equal("Chickpea Pancakes with Leeks, Squash, and Yogurt");
26
+ expect(rec.author).to.equal("Alison Roman");
27
+ expect(rec.cook_time).to.equal(null);
28
+ expect(rec.description).to.equal("Weekday pancakes sound like a stretch? Make the batter Sunday evening and start the week strong.");
29
+ expect(rec.image_url).to.equal("https://assets.epicurious.com/photos/54b71f83ac90eb2c34cfbdf0/master/pass/51260630_chickpea-pancakes_1x1.jpg");
30
+ expected = ["6 tablespoons olive oil, divided", "1 medium leek, white and pale-green parts only, chopped", "1/2 teaspoon kosher salt, plus more", "Freshly ground black pepper", "1 cup grated peeled squash (such as butternut or kabocha)", "1 large egg", "3/4 cup chickpea flour", "1/4 teaspoon baking powder", "1/2 cup plain yogurt", "1/4 cup coarsely chopped fresh parsley", "Flaky sea salt (such as Maldon)"];
31
+ expect(rec.ingredients.length).to.equal(expected.length);
32
+ for (i = 0; i > rec.ingredients.length; i++) {
33
+ expect(rec.ingredients[i]).to.equal([expected[i]]);
51
34
  }
52
- }
53
- }, _callee);
54
- }));
55
-
56
- return function (_x, _x2) {
57
- return _ref2.apply(this, arguments);
58
- };
59
- }());
60
-
61
- case 1:
62
- case "end":
63
- return _context2.stop();
64
- }
35
+ expect(rec.instructions).to.equal("Preparation Heat 2 tablespoons oil in a large skillet, preferably nonstick, over medium-high.\n" + "Add leek, season with kosher salt and pepper, and cook, stirring occasionally, until leek is softened and starting to brown, about 4 minutes. Add squash and season again. Cook, stirring often, until squash is cooked through and softened, about 4 minutes. Transfer vegetables to a plate and let cool.\n" + "Wipe out skillet and reserve.\n" + "Meanwhile, whisk egg, chickpea flour, baking powder, 1 tablespoon oil, 1/2 teaspoon kosher salt, and 1/2 cup water in a medium bowl; season with pepper and let sit 5 minutes for flour to hydrate. Stir vegetables into batter just to coat.\n" + "Heat 1 1/2 tablespoons oil in reserved skillet over medium-high. Add batter by the 1/4-cupful to make 4 pancakes, gently flattening to about 1/4\" thick. Batter should spread easily—if it doesn't, thin with a little water. Cook until bottoms are lightly browned and bubbles form on top, about 4 minutes. Use a spatula to carefully flip pancakes over and cook until browned and cooked through, about 2 minutes longer. Transfer to a plate and tent with a sheet of foil to keep warm. Repeat with another 1 1/2 tablespoons oil and remaining batter. Serve pancakes topped with yogurt, parsley, sea salt, and pepper.\n" + "Do ahead: Leek and squash can be cooked 2 days ahead; cover and chill. Batter can be made 1 day ahead; cover and chill.");
36
+ expect(rec.prep_time).to.equal(null);
37
+ expect(rec.published_date).to.equal(null);
38
+ expect(rec["yield"]).to.equal('4 servings');
39
+ case 15:
40
+ case "end":
41
+ return _context.stop();
42
+ }
43
+ }, _callee);
44
+ }));
45
+ return function (_x, _x2) {
46
+ return _ref2.apply(this, arguments);
47
+ };
48
+ }());
49
+ case 1:
50
+ case "end":
51
+ return _context2.stop();
65
52
  }
66
53
  }, _callee2);
67
54
  })));
package/lib/recipe.js CHANGED
@@ -1,19 +1,17 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.Recipe = exports.Nutrition = void 0;
7
-
8
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
9
-
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
-
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
11
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
12
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
-
14
- var Nutrition = /*#__PURE__*/_createClass(function Nutrition() {
13
+ var Nutrition = exports.Nutrition = /*#__PURE__*/_createClass(function Nutrition() {
15
14
  _classCallCheck(this, Nutrition);
16
-
17
15
  this.calories = null;
18
16
  this.cholesterol = null;
19
17
  this.fiber = null;
@@ -26,12 +24,8 @@ var Nutrition = /*#__PURE__*/_createClass(function Nutrition() {
26
24
  this.trans_fat = null;
27
25
  this.unsaturated_fat = null;
28
26
  });
29
-
30
- exports.Nutrition = Nutrition;
31
-
32
- var Recipe = /*#__PURE__*/_createClass(function Recipe() {
27
+ var Recipe = exports.Recipe = /*#__PURE__*/_createClass(function Recipe() {
33
28
  _classCallCheck(this, Recipe);
34
-
35
29
  this.author = null;
36
30
  this.canonical_url = null;
37
31
  this.cook_time = null;
@@ -45,6 +39,4 @@ var Recipe = /*#__PURE__*/_createClass(function Recipe() {
45
39
  this.published_date = null;
46
40
  this.total_time = null;
47
41
  this["yield"] = null;
48
- });
49
-
50
- exports.Recipe = Recipe;
42
+ });
@@ -1,45 +1,31 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.RecipeParser = void 0;
9
-
10
7
  var _cheerio = _interopRequireDefault(require("cheerio"));
11
-
12
8
  var _recipe = require("./recipe");
13
-
14
9
  var _attributes = require("./attributes");
15
-
16
10
  var _ = _interopRequireWildcard(require("async"));
17
-
18
11
  var _canonical_url_parser = require("./canonical_url_parser");
19
-
20
12
  var Duration = _interopRequireWildcard(require("iso8601-duration"));
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
26
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
-
16
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
28
17
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
-
30
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
31
-
18
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
32
19
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
33
-
34
- var RecipeParser = /*#__PURE__*/function () {
20
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
21
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
+ var RecipeParser = exports.RecipeParser = /*#__PURE__*/function () {
35
23
  function RecipeParser(doc) {
36
24
  _classCallCheck(this, RecipeParser);
37
-
38
25
  this.doc = doc;
39
26
  this.recipe = new _recipe.Recipe();
40
27
  }
41
-
42
- _createClass(RecipeParser, [{
28
+ return _createClass(RecipeParser, [{
43
29
  key: "parse",
44
30
  value: function parse() {
45
31
  var self = this;
@@ -80,8 +66,4 @@ var RecipeParser = /*#__PURE__*/function () {
80
66
  return parser.canonical_domain == domain;
81
67
  }
82
68
  }]);
83
-
84
- return RecipeParser;
85
- }();
86
-
87
- exports.RecipeParser = RecipeParser;
69
+ }();