MCPcopy Index your code
hub / github.com/SortableJS/Sortable / toFn

Function toFn

src/Sortable.js:248–272  ·  view source on GitHub ↗
(value, pull)

Source from the content-addressed store, hash-verified

246
247 _prepareGroup = function (options) {
248 function toFn(value, pull) {
249 return function(to, from, dragEl, evt) {
250 let sameGroup = to.options.group.name &&
251 from.options.group.name &&
252 to.options.group.name === from.options.group.name;
253
254 if (value == null && (pull || sameGroup)) {
255 // Default pull value
256 // Default pull and put value if same group
257 return true;
258 } else if (value == null || value === false) {
259 return false;
260 } else if (pull && value === 'clone') {
261 return value;
262 } else if (typeof value === 'function') {
263 return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
264 } else {
265 let otherGroup = (pull ? to : from).options.group.name;
266
267 return (value === true ||
268 (typeof value === 'string' && value === otherGroup) ||
269 (value.join && value.indexOf(otherGroup) > -1));
270 }
271 };
272 }
273
274 let group = {};
275 let originalGroup = options.group;

Callers 1

_prepareGroupFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…