JSPM

swap-subarray

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q26070F
  • License CC0-1.0

Swap a SubArray

Package Exports

  • swap-subarray

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swap-subarray) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

swap-subarray

Swap a SubArray

install

npm install swap-subarray

usage

import swapSubArray from 'swap-subarray';

// the original array
const array = [0, 1, 2, 3];

// the sub-array to swap out
const subArray = [1, 2];

// the new sub-array to swap in
const newSubArray = [99, 100];

const result = swapSubArray({ array, subArray, newSubArray });
// result is [0, 99, 100, 3];