data-joint
Advanced tools
Comparing version 1.2.6 to 1.3.0
@@ -1,2 +0,2 @@ | ||
// Version 1.2.6 data-joint - https://github.com/vasturiano/data-joint | ||
// Version 1.3.0 data-joint - https://github.com/vasturiano/data-joint | ||
(function (global, factory) { | ||
@@ -8,5 +8,31 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
function _iterableToArrayLimit$1(arr, i) { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
@@ -18,6 +44,4 @@ var symbols = Object.getOwnPropertySymbols(object); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
@@ -32,7 +56,6 @@ for (var i = 1; i < arguments.length; i++) { | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
key = _toPropertyKey$1(key); | ||
if (key in obj) { | ||
@@ -48,6 +71,4 @@ Object.defineProperty(obj, key, { | ||
} | ||
return obj; | ||
} | ||
function _objectWithoutPropertiesLoose$1(source, excluded) { | ||
@@ -58,3 +79,2 @@ if (source == null) return {}; | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
@@ -65,16 +85,10 @@ key = sourceKeys[i]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties$1(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose$1(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
@@ -87,56 +101,19 @@ key = sourceSymbolKeys[i]; | ||
} | ||
return target; | ||
} | ||
function _slicedToArray$1(arr, i) { | ||
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); | ||
} | ||
function _toConsumableArray$1(arr) { | ||
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); | ||
} | ||
function _arrayWithoutHoles$1(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); | ||
} | ||
function _arrayWithHoles$1(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArray$1(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit$1(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i == null) return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_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"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _unsupportedIterableToArray$1(o, minLen) { | ||
@@ -150,19 +127,55 @@ if (!o) return; | ||
} | ||
function _arrayLikeToArray$1(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; | ||
} | ||
function _nonIterableSpread$1() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _nonIterableRest$1() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _toPrimitive$1(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || "default"); | ||
if (typeof res !== "object") return res; | ||
throw new TypeError("@@toPrimitive must return a primitive value."); | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
} | ||
function _toPropertyKey$1(arg) { | ||
var key = _toPrimitive$1(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -173,3 +186,2 @@ if (source == null) return {}; | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
@@ -180,16 +192,10 @@ key = sourceKeys[i]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
@@ -202,56 +208,19 @@ key = sourceSymbolKeys[i]; | ||
} | ||
return target; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i == null) return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_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"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
@@ -265,23 +234,16 @@ if (!o) return; | ||
} | ||
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; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
@@ -292,9 +254,6 @@ var res = prim.call(input, hint || "default"); | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
@@ -319,10 +278,8 @@ } | ||
var keyAccessor = _ref.keyAccessor, | ||
isProp = _ref.isProp; | ||
isProp = _ref.isProp; | ||
var key; | ||
if (isProp) { | ||
var _itemVal = itemVal, | ||
propVal = _itemVal[keyAccessor], | ||
rest = _objectWithoutProperties(_itemVal, [keyAccessor].map(_toPropertyKey)); | ||
propVal = _itemVal[keyAccessor], | ||
rest = _objectWithoutProperties(_itemVal, [keyAccessor].map(_toPropertyKey)); | ||
key = propVal; | ||
@@ -333,3 +290,2 @@ itemVal = rest; | ||
} | ||
if (idx + 1 < keys.length) { | ||
@@ -339,3 +295,2 @@ if (!iterObj.hasOwnProperty(key)) { | ||
} | ||
iterObj = iterObj[key]; | ||
@@ -348,3 +303,2 @@ } else { | ||
} | ||
iterObj[key].push(itemVal); | ||
@@ -358,3 +312,2 @@ } else { | ||
}, {}); | ||
if (multiItem instanceof Function) { | ||
@@ -364,3 +317,2 @@ // Reduce leaf multiple values | ||
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
if (level === keys.length) { | ||
@@ -376,14 +328,10 @@ Object.keys(node).forEach(function (k) { | ||
})(indexedResult); // IIFE | ||
} | ||
var result = indexedResult; | ||
if (flattenKeys) { | ||
// flatten into array | ||
result = []; | ||
(function flatten(node) { | ||
var accKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
if (accKeys.length === keys.length) { | ||
@@ -397,5 +345,4 @@ result.push({ | ||
var _ref3 = _slicedToArray(_ref2, 2), | ||
key = _ref3[0], | ||
val = _ref3[1]; | ||
key = _ref3[0], | ||
val = _ref3[1]; | ||
return flatten(val, [].concat(_toConsumableArray(accKeys), [key])); | ||
@@ -406,3 +353,2 @@ }); | ||
if (keyAccessors instanceof Array && keyAccessors.length === 0 && result.length === 1) { | ||
@@ -413,3 +359,2 @@ // clear keys if there's no key accessors (single result) | ||
} | ||
return result; | ||
@@ -419,3 +364,2 @@ }); | ||
var _excluded = ["createObj", "updateObj", "exitObj", "objBindAttr", "dataBindAttr"]; | ||
function diffArrays(prev, next, idAccessor) { | ||
@@ -427,3 +371,2 @@ var result = { | ||
}; | ||
if (!idAccessor) { | ||
@@ -444,5 +387,4 @@ // use object references for comparison | ||
var _ref2 = _slicedToArray$1(_ref, 2), | ||
id = _ref2[0], | ||
item = _ref2[1]; | ||
id = _ref2[0], | ||
item = _ref2[1]; | ||
var type = !prevById.hasOwnProperty(id) ? 'enter' : !nextById.hasOwnProperty(id) ? 'exit' : 'update'; | ||
@@ -452,19 +394,15 @@ result[type].push(type === 'update' ? [prevById[id], nextById[id]] : item); | ||
} | ||
return result; | ||
} | ||
function dataBindDiff(data, existingObjs, _ref3) { | ||
var _ref3$objBindAttr = _ref3.objBindAttr, | ||
objBindAttr = _ref3$objBindAttr === void 0 ? '__obj' : _ref3$objBindAttr, | ||
_ref3$dataBindAttr = _ref3.dataBindAttr, | ||
dataBindAttr = _ref3$dataBindAttr === void 0 ? '__data' : _ref3$dataBindAttr, | ||
idAccessor = _ref3.idAccessor, | ||
_ref3$purge = _ref3.purge, | ||
purge = _ref3$purge === void 0 ? false : _ref3$purge; | ||
objBindAttr = _ref3$objBindAttr === void 0 ? '__obj' : _ref3$objBindAttr, | ||
_ref3$dataBindAttr = _ref3.dataBindAttr, | ||
dataBindAttr = _ref3$dataBindAttr === void 0 ? '__data' : _ref3$dataBindAttr, | ||
idAccessor = _ref3.idAccessor, | ||
_ref3$purge = _ref3.purge, | ||
purge = _ref3$purge === void 0 ? false : _ref3$purge; | ||
var isObjValid = function isObjValid(obj) { | ||
return obj.hasOwnProperty(dataBindAttr); | ||
}; | ||
var removeObjs = existingObjs.filter(function (obj) { | ||
@@ -485,5 +423,4 @@ return !isObjValid(obj); | ||
var _ref5 = _slicedToArray$1(_ref4, 2), | ||
prevD = _ref5[0], | ||
nextD = _ref5[1]; | ||
prevD = _ref5[0], | ||
nextD = _ref5[1]; | ||
if (prevD !== nextD) { | ||
@@ -494,3 +431,2 @@ // transfer obj to new data point (if different) | ||
} | ||
return nextD; | ||
@@ -503,30 +439,30 @@ }); | ||
} | ||
function viewDigest(data, existingObjs, // list | ||
appendObj, // item => {...} function | ||
function viewDigest(data, existingObjs, | ||
// list | ||
appendObj, | ||
// item => {...} function | ||
removeObj, // item => {...} function | ||
_ref7) { | ||
var _ref7$createObj = _ref7.createObj, | ||
createObj = _ref7$createObj === void 0 ? function (d) { | ||
return {}; | ||
} : _ref7$createObj, | ||
_ref7$updateObj = _ref7.updateObj, | ||
updateObj = _ref7$updateObj === void 0 ? function (obj, d) {} : _ref7$updateObj, | ||
_ref7$exitObj = _ref7.exitObj, | ||
exitObj = _ref7$exitObj === void 0 ? function (obj) {} : _ref7$exitObj, | ||
_ref7$objBindAttr = _ref7.objBindAttr, | ||
objBindAttr = _ref7$objBindAttr === void 0 ? '__obj' : _ref7$objBindAttr, | ||
_ref7$dataBindAttr = _ref7.dataBindAttr, | ||
dataBindAttr = _ref7$dataBindAttr === void 0 ? '__data' : _ref7$dataBindAttr, | ||
dataDiffOptions = _objectWithoutProperties$1(_ref7, _excluded); | ||
createObj = _ref7$createObj === void 0 ? function (d) { | ||
return {}; | ||
} : _ref7$createObj, | ||
_ref7$updateObj = _ref7.updateObj, | ||
updateObj = _ref7$updateObj === void 0 ? function (obj, d) {} : _ref7$updateObj, | ||
_ref7$exitObj = _ref7.exitObj, | ||
exitObj = _ref7$exitObj === void 0 ? function (obj) {} : _ref7$exitObj, | ||
_ref7$objBindAttr = _ref7.objBindAttr, | ||
objBindAttr = _ref7$objBindAttr === void 0 ? '__obj' : _ref7$objBindAttr, | ||
_ref7$dataBindAttr = _ref7.dataBindAttr, | ||
dataBindAttr = _ref7$dataBindAttr === void 0 ? '__data' : _ref7$dataBindAttr, | ||
dataDiffOptions = _objectWithoutProperties$1(_ref7, _excluded); | ||
var _dataBindDiff = dataBindDiff(data, existingObjs, _objectSpread2({ | ||
objBindAttr: objBindAttr, | ||
dataBindAttr: dataBindAttr | ||
}, dataDiffOptions)), | ||
enter = _dataBindDiff.enter, | ||
update = _dataBindDiff.update, | ||
exit = _dataBindDiff.exit; // Remove exiting points | ||
objBindAttr: objBindAttr, | ||
dataBindAttr: dataBindAttr | ||
}, dataDiffOptions)), | ||
enter = _dataBindDiff.enter, | ||
update = _dataBindDiff.update, | ||
exit = _dataBindDiff.exit; | ||
// Remove exiting points | ||
exit.forEach(function (d) { | ||
@@ -541,6 +477,9 @@ var obj = d[objBindAttr]; | ||
var pointsData = [].concat(_toConsumableArray$1(enter), _toConsumableArray$1(update)); | ||
updateObjs(pointsData); // Add new points | ||
updateObjs(pointsData); | ||
newObjs.forEach(appendObj); // | ||
// Add new points | ||
newObjs.forEach(appendObj); | ||
// | ||
function createObjs(data) { | ||
@@ -550,3 +489,2 @@ var newObjs = []; | ||
var obj = createObj(d); | ||
if (obj) { | ||
@@ -560,7 +498,5 @@ obj[dataBindAttr] = d; | ||
} | ||
function updateObjs(data) { | ||
data.forEach(function (d) { | ||
var obj = d[objBindAttr]; | ||
if (obj) { | ||
@@ -567,0 +503,0 @@ obj[dataBindAttr] = d; |
@@ -1,2 +0,2 @@ | ||
// Version 1.2.6 data-joint - https://github.com/vasturiano/data-joint | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).dataJoint=r()}(this,(function(){"use strict";function t(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function r(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function e(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==e)return;var n,o,i=[],a=!0,u=!1;try{for(e=e.call(t);!(a=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==e.return||e.return()}finally{if(u)throw o}}return i}(t,r)||i(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){if(t){if("string"==typeof t)return a(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,r):void 0}}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function u(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function c(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==e)return;var n,o,i=[],a=!0,u=!1;try{for(e=e.call(t);!(a=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==e.return||e.return()}finally{if(u)throw o}}return i}(t,r)||l(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||l(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,r){if(t){if("string"==typeof t)return s(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(t,r):void 0}}function s(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function y(t){var r=function(t,r){if("object"!=typeof t||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}var p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=(r instanceof Array?r.length?r:[void 0]:[r]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),i=t.reduce((function(t,r){var n=t,i=r;return o.forEach((function(t,r){var a,c=t.keyAccessor;if(t.isProp){var f=i,l=f[c],s=u(f,[c].map(y));a=l,i=s}else a=c(i,r);r+1<o.length?(n.hasOwnProperty(a)||(n[a]={}),n=n[a]):e?(n.hasOwnProperty(a)||(n[a]=[]),n[a].push(i)):n[a]=i})),t}),{});e instanceof Function&&function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;n===o.length?Object.keys(r).forEach((function(t){return r[t]=e(r[t])})):Object.values(r).forEach((function(r){return t(r,n+1)}))}(i);var a=i;return n&&(a=[],function t(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.length===o.length?a.push({keys:e,vals:r}):Object.entries(r).forEach((function(r){var n=c(r,2),o=n[0],i=n[1];return t(i,[].concat(f(e),[o]))}))}(i),r instanceof Array&&0===r.length&&1===a.length&&(a[0].keys=[])),a},d=["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"];function b(t,e,i){var a=i.objBindAttr,u=void 0===a?"__obj":a,c=i.dataBindAttr,f=void 0===c?"__data":c,l=i.idAccessor,s=i.purge,y=void 0!==s&&s,d=function(t){return t.hasOwnProperty(f)},b=e.filter((function(t){return!d(t)})),v=e.filter(d).map((function(t){return t[f]})),h=y?{enter:t,exit:v,update:[]}:function(t,r,e){var i={enter:[],update:[],exit:[]};if(e){var a=p(t,e,!1),u=p(r,e,!1),c=Object.assign({},a,u);Object.entries(c).forEach((function(t){var r=n(t,2),e=r[0],o=r[1],c=a.hasOwnProperty(e)?u.hasOwnProperty(e)?"update":"exit":"enter";i[c].push("update"===c?[a[e],u[e]]:o)}))}else{var f=new Set(t),l=new Set(r);new Set([].concat(o(f),o(l))).forEach((function(t){var r=f.has(t)?l.has(t)?"update":"exit":"enter";i[r].push("update"===r?[t,t]:t)}))}return i}(v,t,l);return h.update=h.update.map((function(t){var r=n(t,2),e=r[0],o=r[1];return e!==o&&(o[u]=e[u],o[u][f]=o),o})),h.exit=h.exit.concat(b.map((function(t){return r({},u,t)}))),h}return function(n,i,a,u,c){var f=c.createObj,l=void 0===f?function(t){return{}}:f,s=c.updateObj,y=void 0===s?function(t,r){}:s,p=c.exitObj,v=void 0===p?function(t){}:p,h=c.objBindAttr,m=void 0===h?"__obj":h,O=c.dataBindAttr,g=void 0===O?"__data":O,j=e(c,d),w=b(n,i,function(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({objBindAttr:m,dataBindAttr:g},j)),A=w.enter,S=w.update;w.exit.forEach((function(t){var r=t[m];delete t[m],v(r),u(r)}));var P=function(t){var r=[];return t.forEach((function(t){var e=l(t);e&&(e[g]=t,t[m]=e,r.push(e))})),r}(A);!function(t){t.forEach((function(t){var r=t[m];r&&(r[g]=t,y(r,t))}))}([].concat(o(A),o(S))),P.forEach(a)}})); | ||
// Version 1.3.0 data-joint - https://github.com/vasturiano/data-joint | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).dataJoint=r()}(this,(function(){"use strict";function t(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function r(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=typeof t||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function e(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],c=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(t,r)||i(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){if(t){if("string"==typeof t)return a(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,r):void 0}}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function u(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function c(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],c=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(t,r)||l(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||l(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,r){if(t){if("string"==typeof t)return s(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(t,r):void 0}}function s(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function y(t){var r=function(t,r){if("object"!=typeof t||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}var p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=(r instanceof Array?r.length?r:[void 0]:[r]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),i=t.reduce((function(t,r){var n=t,i=r;return o.forEach((function(t,r){var a,c=t.keyAccessor;if(t.isProp){var f=i,l=f[c],s=u(f,[c].map(y));a=l,i=s}else a=c(i,r);r+1<o.length?(n.hasOwnProperty(a)||(n[a]={}),n=n[a]):e?(n.hasOwnProperty(a)||(n[a]=[]),n[a].push(i)):n[a]=i})),t}),{});e instanceof Function&&function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;n===o.length?Object.keys(r).forEach((function(t){return r[t]=e(r[t])})):Object.values(r).forEach((function(r){return t(r,n+1)}))}(i);var a=i;return n&&(a=[],function t(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.length===o.length?a.push({keys:e,vals:r}):Object.entries(r).forEach((function(r){var n=c(r,2),o=n[0],i=n[1];return t(i,[].concat(f(e),[o]))}))}(i),r instanceof Array&&0===r.length&&1===a.length&&(a[0].keys=[])),a},b=["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"];function d(t,e,i){var a=i.objBindAttr,u=void 0===a?"__obj":a,c=i.dataBindAttr,f=void 0===c?"__data":c,l=i.idAccessor,s=i.purge,y=void 0!==s&&s,b=function(t){return t.hasOwnProperty(f)},d=e.filter((function(t){return!b(t)})),v=e.filter(b).map((function(t){return t[f]})),h=y?{enter:t,exit:v,update:[]}:function(t,r,e){var i={enter:[],update:[],exit:[]};if(e){var a=p(t,e,!1),u=p(r,e,!1),c=Object.assign({},a,u);Object.entries(c).forEach((function(t){var r=n(t,2),e=r[0],o=r[1],c=a.hasOwnProperty(e)?u.hasOwnProperty(e)?"update":"exit":"enter";i[c].push("update"===c?[a[e],u[e]]:o)}))}else{var f=new Set(t),l=new Set(r);new Set([].concat(o(f),o(l))).forEach((function(t){var r=f.has(t)?l.has(t)?"update":"exit":"enter";i[r].push("update"===r?[t,t]:t)}))}return i}(v,t,l);return h.update=h.update.map((function(t){var r=n(t,2),e=r[0],o=r[1];return e!==o&&(o[u]=e[u],o[u][f]=o),o})),h.exit=h.exit.concat(d.map((function(t){return r({},u,t)}))),h}return function(n,i,a,u,c){var f=c.createObj,l=void 0===f?function(t){return{}}:f,s=c.updateObj,y=void 0===s?function(t,r){}:s,p=c.exitObj,v=void 0===p?function(t){}:p,h=c.objBindAttr,m=void 0===h?"__obj":h,O=c.dataBindAttr,j=void 0===O?"__data":O,g=e(c,b),w=d(n,i,function(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({objBindAttr:m,dataBindAttr:j},g)),A=w.enter,S=w.update;w.exit.forEach((function(t){var r=t[m];delete t[m],v(r),u(r)}));var P=function(t){var r=[];return t.forEach((function(t){var e=l(t);e&&(e[j]=t,t[m]=e,r.push(e))})),r}(A);!function(t){t.forEach((function(t){var r=t[m];r&&(r[j]=t,y(r,t))}))}([].concat(o(A),o(S))),P.forEach(a)}})); |
{ | ||
"name": "data-joint", | ||
"version": "1.2.6", | ||
"version": "1.3.0", | ||
"description": "Perform data joins with any type of JS objects", | ||
"type": "module", | ||
"unpkg": "dist/data-joint.min.js", | ||
"main": "dist/data-joint.common.js", | ||
"module": "dist/data-joint.module.js", | ||
"main": "dist/data-joint.mjs", | ||
"module": "dist/data-joint.mjs", | ||
"types": "dist/data-joint.d.ts", | ||
"exports": { | ||
"umd": "./dist/data-joint.min.js", | ||
"default": "./dist/data-joint.mjs" | ||
}, | ||
"sideEffects": false, | ||
@@ -41,18 +46,19 @@ "homepage": "https://github.com/vasturiano/data-joint", | ||
"dependencies": { | ||
"index-array-by": "^1.3.3" | ||
"index-array-by": "^1.4.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.18.10", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.18.9", | ||
"@babel/preset-env": "^7.18.10", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^22.0.2", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.78.0", | ||
"rollup-plugin-dts": "^4.2.2", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"typescript": "^4.7.4" | ||
"@babel/core": "^7.20.12", | ||
"@babel/preset-env": "^7.20.2", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@rollup/plugin-terser": "^0.4.0", | ||
"rimraf": "^4.1.2", | ||
"rollup": "^3.14.0", | ||
"rollup-plugin-dts": "^5.1.1", | ||
"typescript": "^4.9.5" | ||
}, | ||
"engines": { | ||
"node": ">=12" | ||
} | ||
} |
@@ -17,7 +17,3 @@ data-joint | ||
``` | ||
or | ||
```js | ||
const dataJoint = require('data-joint'); | ||
``` | ||
or even | ||
or using a *script* tag | ||
```html | ||
@@ -24,0 +20,0 @@ <script src="//unpkg.com/data-joint"></script> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
Yes
72117
11
915
75
Updatedindex-array-by@^1.4.0