zippa
Version:
A Generic Zipper Library
27 lines (23 loc) • 597 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ArrayZipper = undefined;
var _zipper = require('./zipper');
/**
* Zipper for nested Arrays.
*
* Don't use with new keyword - use the function plainly
* or with `ArrayZipper.from([1, 2, 3])`.
*
* @param {Array} arr - the data structure to make a zipper for
* @return {Zipper}
*/
var ArrayZipper = exports.ArrayZipper = (0, _zipper.makeZipper)(function (arr) {
return !!arr.length;
}, function (arr) {
return arr;
}, function (_, children) {
return children;
});
exports.default = ArrayZipper;