'use strict'; // src/index.ts var makeMatrix = (dimensions, initialValues = null) => { const initialPosition = Array(dimensions.length).fill(0); return _makeMatrix(dimensions, initialValues, initialPosition); }; function _makeMatrix(dimensions, initialValues, currentPosition) { const [currentDimensionLength, ...remainingDimensions] = dimensions; const currentDimension = currentPosition.length - remainingDimensions.length - 1; return [...Array(currentDimensionLength)].map((_, i) => { currentPosition[currentDimension] = i; return remainingDimensions.length > 0 ? _makeMatrix(remainingDimensions, initialValues, currentPosition) : initialValues instanceof Function ? initialValues(currentPosition.slice()) : initialValues; }); } exports.makeMatrix = makeMatrix; //# sourceMappingURL=index.cjs.map //# sourceMappingURL=index.cjs.map