source: node_modules/ramda-adjunct/lib/internal/ap.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 2.6 KB
Line 
1"use strict";
2
3function _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); }
4exports.__esModule = true;
5exports["default"] = void 0;
6var _ramda = require("ramda");
7var _isFunction = _interopRequireDefault(require("../isFunction"));
8var fl = _interopRequireWildcard(require("../fantasy-land/mapping"));
9function _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); }
10function _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; }
11function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12var isFunctor = (0, _ramda.either)((0, _ramda.pathSatisfies)(_isFunction["default"], ['map']), (0, _ramda.pathSatisfies)(_isFunction["default"], [fl.map]));
13var isApply = (0, _ramda.both)(isFunctor, (0, _ramda.either)((0, _ramda.pathSatisfies)(_isFunction["default"], ['ap']), (0, _ramda.pathSatisfies)(_isFunction["default"], [fl.ap])));
14var ap = (0, _ramda.curryN)(2, function (applyF, applyX) {
15 // return original ramda `ap` if not Apply spec
16 if (!isApply(applyF) || !isApply(applyX)) {
17 return (0, _ramda.ap)(applyF, applyX);
18 }
19 try {
20 // new version of `ap` starting from ramda version > 0.23.0
21 return applyF.ap(applyX);
22 } catch (e) {
23 // old version of `ap` till ramda version <= 0.23.0
24 return applyX.ap(applyF);
25 }
26});
27var _default = ap;
28exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.