ladda-observable
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -1,82 +0,16 @@ | ||
module.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; | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // 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'; | ||
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var laddaFp = require('ladda-fp'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
@@ -98,3 +32,3 @@ var getOrCreateContainer = function getOrCreateContainer(type, relationships) { | ||
var parent = config.viewOf; | ||
return getParentViews(configs, parent, [].concat(_toConsumableArray(res), [parent])); | ||
return getParentViews(configs, parent, [].concat(toConsumableArray(res), [parent])); | ||
} | ||
@@ -107,3 +41,3 @@ return res; | ||
var parents = getParentViews(configs, type); | ||
container.parents = [].concat(_toConsumableArray(container.parents), _toConsumableArray(parents)); | ||
container.parents = [].concat(toConsumableArray(container.parents), toConsumableArray(parents)); | ||
parents.forEach(function (parent) { | ||
@@ -125,3 +59,3 @@ getOrCreateContainer(parent, rels).views.push(type); | ||
var analyzeEntityRelationships = exports.analyzeEntityRelationships = function analyzeEntityRelationships(entityConfigs) { | ||
var analyzeEntityRelationships = function analyzeEntityRelationships(entityConfigs) { | ||
var relationships = Object.keys(entityConfigs).reduce(function (rels, type) { | ||
@@ -133,394 +67,2 @@ return analyzeViews(entityConfigs, type, rels); | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports) { | ||
module.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; | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // 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 = 0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var debug = exports.debug = function debug(x) { | ||
console.log(x); // eslint-disable-line no-console | ||
return x; | ||
}; | ||
var identity = exports.identity = function identity(x) { | ||
return x; | ||
}; | ||
var curry = exports.curry = function curry(f) { | ||
return function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var nrArgsRequired = f.length; | ||
if (args.length < nrArgsRequired) { | ||
return curry(f.bind.apply(f, [null].concat(args))); | ||
} | ||
return f.apply(undefined, args); | ||
}; | ||
}; | ||
var passThrough = exports.passThrough = curry(function (f, x) { | ||
f(x); | ||
return x; | ||
}); | ||
var startsWith = exports.startsWith = curry(function (x, xs) { | ||
return xs.indexOf(x) === 0; | ||
}); | ||
var join = exports.join = curry(function (separator, x, y) { | ||
return x + separator + y; | ||
}); | ||
var on = exports.on = curry(function (f, g, h, x) { | ||
return f(g(x), h(x)); | ||
}); | ||
// a -> a -> bool | ||
var isEqual = exports.isEqual = curry(function (x, y) { | ||
return x === y; | ||
}); | ||
// bool -> bool | ||
var not = exports.not = function not(x) { | ||
return !x; | ||
}; | ||
var on2 = exports.on2 = curry(function (f, g, h, x, y) { | ||
return f(g(x), h(y)); | ||
}); | ||
var init = exports.init = function init(xs) { | ||
return xs.slice(0, xs.length - 1); | ||
}; | ||
var tail = exports.tail = function tail(xs) { | ||
return xs.slice(1, xs.length); | ||
}; | ||
var last = exports.last = function last(xs) { | ||
return xs[xs.length - 1]; | ||
}; | ||
var head = exports.head = function head(xs) { | ||
return xs[0]; | ||
}; | ||
var map = exports.map = curry(function (fn, xs) { | ||
return xs.map(fn); | ||
}); | ||
var map_ = exports.map_ = curry(function (fn, xs) { | ||
map(fn, xs); | ||
}); | ||
var reverse = exports.reverse = function reverse(xs) { | ||
return xs.slice().reverse(); | ||
}; | ||
var reduce = exports.reduce = curry(function (f, currResult, xs) { | ||
map_(function (x) { | ||
currResult = f(currResult, x); | ||
}, xs); | ||
return currResult; | ||
}); | ||
var compose = exports.compose = function compose() { | ||
for (var _len2 = arguments.length, fns = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
fns[_key2] = arguments[_key2]; | ||
} | ||
return function () { | ||
return reduce(function (m, f) { | ||
return f(m); | ||
}, last(fns).apply(undefined, arguments), tail(reverse(fns))); | ||
}; | ||
}; | ||
var prop = exports.prop = curry(function (key, x) { | ||
return x[key]; | ||
}); | ||
// [a] -> [b] -> [[a, b]] | ||
var zip = exports.zip = curry(function (xs, ys) { | ||
var toTake = Math.min(xs.length, ys.length); | ||
var zs = []; | ||
for (var i = 0; i < toTake; i++) { | ||
zs.push([xs[i], ys[i]]); | ||
} | ||
return zs; | ||
}); | ||
// BinaryFn -> BinaryFn | ||
var flip = exports.flip = function flip(fn) { | ||
return curry(function (x, y) { | ||
return fn(y, x); | ||
}); | ||
}; | ||
// Object -> [[key, val]] | ||
var toPairs = exports.toPairs = function toPairs(x) { | ||
var keys = Object.keys(x); | ||
var getValue = flip(prop)(x); | ||
return zip(keys, map(getValue, keys)); | ||
}; | ||
// [[key, val]] -> Object<Key, Val> | ||
var fromPairs = exports.fromPairs = function fromPairs(xs) { | ||
var addToObj = function addToObj(o, _ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
k = _ref2[0], | ||
v = _ref2[1]; | ||
return passThrough(function () { | ||
o[k] = v; | ||
}, o); | ||
}; | ||
return reduce(addToObj, {}, xs); | ||
}; | ||
// ([a, b] -> c) -> Map a b -> [c] | ||
var mapObject = exports.mapObject = on2(map, identity, toPairs); | ||
var writeToObject = curry(function (o, k, v) { | ||
o[k] = v; | ||
return o; | ||
}); | ||
// (a -> b) -> Object -> Object | ||
var mapValues = exports.mapValues = curry(function (fn, o) { | ||
var keys = Object.keys(o); | ||
return reduce(function (m, x) { | ||
m[x] = fn(o[x]); | ||
return m; | ||
}, {}, keys); | ||
}); | ||
// Object<a, b> -> [b] | ||
var values = exports.values = mapObject(function (pair) { | ||
return pair[1]; | ||
}); | ||
// (a -> b) -> [Object] -> Object<b, a> | ||
var toObject = exports.toObject = curry(function (getK, xs) { | ||
return reduce(function (m, x) { | ||
return writeToObject(m, getK(x), x); | ||
}, {}, xs); | ||
}); | ||
var takeIf = curry(function (p, m, x) { | ||
if (p(x)) { | ||
m.push(x); | ||
} | ||
return m; | ||
}); | ||
var filter = exports.filter = curry(function (p, xs) { | ||
return reduce(takeIf(p), [], xs); | ||
}); | ||
// Object -> Object | ||
var clone = exports.clone = function clone(o) { | ||
if (Array.isArray(o)) { | ||
return o.slice(0); | ||
} | ||
if ((typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object') { | ||
return _extends({}, o); | ||
} | ||
throw new TypeError('Called with something else than an object/array'); | ||
}; | ||
// (a -> bool) -> Object -> Object | ||
var filterObject = exports.filterObject = curry(function (p, o) { | ||
var getKeys = compose(filter(p), Object.keys); | ||
var getProperty = flip(prop); | ||
var keys = getKeys(o); | ||
var createObject = compose(fromPairs, zip(keys), map(getProperty(o))); | ||
return createObject(keys); | ||
}); | ||
var copyFunction = exports.copyFunction = function copyFunction(f) { | ||
var newF = f.bind(null); | ||
for (var x in f) { | ||
if (f.hasOwnProperty(x)) { | ||
newF[x] = f[x]; | ||
} | ||
} | ||
return newF; | ||
}; | ||
var get = exports.get = curry(function (props, o) { | ||
return reduce(function (m, p) { | ||
if (!m) { | ||
return m; | ||
} | ||
return prop(p, m); | ||
}, o, props); | ||
}); | ||
var set = exports.set = curry(function (props, val, o) { | ||
if (!props.length) { | ||
return o; | ||
} | ||
var update = function update(items, obj) { | ||
if (!items.length) { | ||
return obj; | ||
} | ||
var _head = head(items), | ||
_head2 = _slicedToArray(_head, 2), | ||
k = _head2[0], | ||
nextVal = _head2[1]; | ||
var next = items.length === 1 ? nextVal : _extends({}, prop(k, obj), nextVal); | ||
return _extends({}, obj, _defineProperty({}, k, update(tail(items), next))); | ||
}; | ||
var zipped = [].concat(_toConsumableArray(map(function (k) { | ||
return [k, {}]; | ||
}, init(props))), [[last(props), val]]); | ||
return update(zipped, o); | ||
}); | ||
var concat = exports.concat = curry(function (a, b) { | ||
return a.concat(b); | ||
}); | ||
var flatten = exports.flatten = function flatten(arrs) { | ||
return reduce(concat, [], arrs); | ||
}; | ||
var uniq = exports.uniq = function uniq(arr) { | ||
return [].concat(_toConsumableArray(new Set(arr))); | ||
}; | ||
var fst = exports.fst = function fst(arr) { | ||
return arr[0]; | ||
}; | ||
var snd = exports.snd = function snd(arr) { | ||
return arr[1]; | ||
}; | ||
var toIdMap = exports.toIdMap = toObject(prop('id')); | ||
var noop = exports.noop = function noop() {}; | ||
var removeAtIndex = exports.removeAtIndex = curry(function (i, list) { | ||
var isOutOfBounds = i === -1 || i > list.length - 1; | ||
return isOutOfBounds ? list : [].concat(_toConsumableArray(list.slice(0, i)), _toConsumableArray(list.slice(i + 1))); | ||
}); | ||
var removeElement = exports.removeElement = curry(function (el, list) { | ||
return removeAtIndex(list.indexOf(el), list); | ||
}); | ||
/***/ }) | ||
/******/ ]); | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.observable = undefined; | ||
var _laddaFp = __webpack_require__(1); | ||
var _helper = __webpack_require__(0); | ||
var isNoOperation = function isNoOperation(change) { | ||
@@ -585,7 +127,7 @@ return change.operation === 'NO_OPERATION'; | ||
fn.apply(undefined, args).then(function (res) { | ||
return (0, _laddaFp.map_)(function (subscription) { | ||
return laddaFp.map_(function (subscription) { | ||
return subscription.onNext(res); | ||
}, subscriptions); | ||
}, function (err) { | ||
return (0, _laddaFp.map_)(function (subscription) { | ||
return laddaFp.map_(function (subscription) { | ||
return subscription.onError(err); | ||
@@ -604,5 +146,5 @@ }, subscriptions); | ||
var removeSubscription = function removeSubscription(subscription) { | ||
subscriptions = (0, _laddaFp.removeElement)(subscription, subscriptions); | ||
subscriptions = laddaFp.removeElement(subscription, subscriptions); | ||
if (subscriptions.length === 0) { | ||
state.changeListeners = (0, _laddaFp.removeElement)(changeListener, state.changeListeners); | ||
state.changeListeners = laddaFp.removeElement(changeListener, state.changeListeners); | ||
} | ||
@@ -613,3 +155,3 @@ }; | ||
subscribe: function subscribe(onNext) { | ||
var onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _laddaFp.noop; | ||
var onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : laddaFp.noop; | ||
@@ -636,3 +178,3 @@ var subscription = { onNext: onNext, onError: onError }; | ||
var observable = exports.observable = function observable() { | ||
var observable = function observable() { | ||
return function (_ref) { | ||
@@ -646,6 +188,6 @@ var addChangeListener = _ref.addChangeListener, | ||
var relationships = (0, _helper.analyzeEntityRelationships)(entityConfigs); | ||
var relationships = analyzeEntityRelationships(entityConfigs); | ||
addChangeListener(function (change) { | ||
return (0, _laddaFp.map_)(function (c) { | ||
return laddaFp.map_(function (c) { | ||
return c(change); | ||
@@ -668,3 +210,2 @@ }, state.changeListeners); | ||
/***/ }) | ||
/******/ ]); | ||
exports.observable = observable; |
{ | ||
"name": "ladda-observable", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"description": "Observable plugin for Ladda", | ||
"main": "dist/bundle.js", | ||
"module": "dist/module.js", | ||
"files": [ | ||
"dist/module.js" | ||
], | ||
"dependencies": { | ||
"ladda-fp": "^0.2.0" | ||
"ladda-fp": "^0.2.3" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.9.0", | ||
"babel-loader": "^7.0.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-istanbul": "^4.0.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"babel-preset-stage-2": "^6.5.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-stage-1": "^6.24.1", | ||
"babel-register": "^6.9.0", | ||
@@ -23,14 +26,16 @@ "chai": "^3.5.0", | ||
"gitbook-cli": "^2.3.0", | ||
"ladda-cache": "0.2.7", | ||
"ladda-cache": "^0.2.15", | ||
"mocha": "^2.5.3", | ||
"nyc": "^10.1.2", | ||
"rollup": "^0.53.0", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"sinon": "^1.17.7", | ||
"sinon-chai": "^2.8.0", | ||
"webpack": "^2.4.1" | ||
"sinon-chai": "^2.8.0" | ||
}, | ||
"scripts": { | ||
"test": "env NODE_PATH=$NODE_PATH:$PWD/src ./node_modules/.bin/mocha --compilers js:babel-register --reporter spec src/*.spec.js 'src/**/*.spec.js' --require mocha.config", | ||
"coverage": "env NODE_PATH=$NODE_PATH:$PWD/src nyc -x '**/*.spec.js' -x '**/*.config.js' --reporter=lcov --reporter=text mocha --compilers js:babel-register --reporter spec src/*.spec.js 'src/**/*.spec.js' --require mocha.config", | ||
"test": "env NODE_PATH=$NODE_PATH:$PWD/src NODE_ENV=test ./node_modules/.bin/mocha --compilers js:babel-register --reporter spec src/*.spec.js 'src/**/*.spec.js' --require mocha.config", | ||
"coverage": "env NODE_PATH=$NODE_PATH:$PWD/src NODE_ENV=test nyc -x '**/*.spec.js' -x '**/*.config.js' --reporter=lcov --reporter=text mocha --compilers js:babel-register --reporter spec src/*.spec.js 'src/**/*.spec.js' --require mocha.config", | ||
"lint": "eslint src", | ||
"prepublish": "npm run lint && npm test && webpack" | ||
"prepublish": "npm run lint && npm test && npm run build", | ||
"build": "rollup -c" | ||
}, | ||
@@ -37,0 +42,0 @@ "author": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17249
5
344
1
Updatedladda-fp@^0.2.3