remove elements of arrayB from arrayA
331920
function subtractModules(modulesA, modulesB) {
    const subtracted = [];
    for (const module of modulesA) {
      if (!modulesB.includes(module)) {
        subtracted.push(module);
      }
    }
    return subtracted;
  }
178385
@SafeVarargs
    public static int[] removeAll(final int[] a, final int... elements) {
        if (N.isNullOrEmpty(a)) {
            return N.EMPTY_INT_ARRAY;
        } else if (N.isNullOrEmpty(elements)) {
            return a.clone();
        } else if (elements.length == 1) {
            return removeAllOccurrences(a, elements[0]);
        }

        final IntList list = IntList.of(a.clone());
        list.removeAll(IntList.of(elements));
        return list.trimToSize().array();
    }
384176
public static function merge_retain_recursive($array_a = array(), $array_b = array())
	{
		$array_merge = $array_a;

		if (empty($array_a) && empty($array_b))
		{
			return $array_merge;
		}

		foreach ($array_b as $field => $value)
		{
			if (! array_key_exists($field, $array_a))
			{
				$array_merge[$field] = $value;
				continue;
			}

			if (! empty($value))
			{
				if (is_array($array_merge[$field]) && is_array($value))
				{
					$array_merge[$field] = self::merge_retain_recursive($array_merge[$field], $value);
				}
				else
				{
					$array_merge[$field] = $value;
				}
			}
		}

		return $array_merge;
	}
1044584
public static function trimRecursive(array $array)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return [];
        }

        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result[$key] = self::trimRecursive($value);

                continue;
            }

            if (is_string($value)) {
                $value = trim($value);
            }

            $result[$key] = $value;
        }

        return $result;
    }
799896
@SafeVarargs
    public static boolean[] removeAll(final boolean[] a, final boolean... elements) {
        if (N.isNullOrEmpty(a)) {
            return N.EMPTY_BOOLEAN_ARRAY;
        } else if (N.isNullOrEmpty(elements)) {
            return a.clone();
        } else if (elements.length == 1) {
            return removeAllOccurrences(a, elements[0]);
        }

        final BooleanList list = BooleanList.of(a.clone());
        list.removeAll(BooleanList.of(elements));
        return list.trimToSize().array();
    }
328790
public static int[] removeAt (int[] list, int index)
    {
        // this will NPE if the bastards passed a null list, which is how
        // we'll let them know not to do that
        int nlength = list.length-1;

        // create a new array minus the removed element
        int[] nlist = new int[nlength];
        System.arraycopy(list, 0, nlist, 0, index);
        System.arraycopy(list, index+1, nlist, index, nlength-index);

        return nlist;
    }
420946
function(originalArray) {
            var cleanArray = [],
                i = -1;

            for (i = 0; i < originalArray.length; i++) {
                if (originalArray[i] !== '') {
                    cleanArray.push(originalArray[i]);
                }
            }

            return cleanArray;
        }
224080
function sortArrayByIndex(array) {

  let ii = 0;
  let length = array.length;

  let output = [];

  for (; ii < length; ++ii) {
    output[array[ii].index] = array[ii];
    delete array[ii].index;
  };

  return (output);

}
885344
def remove_by(keys, original):
    """"""
    for i in [
            original[index]
            for index, needed in enumerate(keys) if not needed
    ]:
        original.remove(i)
858813
public static function remove(array $array, string $key): array
    {
        // Extract key/path.
        $keyLast = Str::last($key, '.');
        $key = Str::removeLast($key, '.');

        // If found, remove element.
        $arrayElement = &self::dataByPath($array, $key, false, 'not.found');
        if ($arrayElement !== 'not.found') {
            if (array_key_exists($keyLast, $arrayElement)) {
                unset($arrayElement[$keyLast]);
            }
        }

        return $array;
    }
86466
function shift(arr, index) {
    for (let i = index; i < arr.length; i++) {
        arr[i] = arr[i + 1];
    }
    delete arr[arr.length - 1];
    arr.length -= 1;
}
711470
function removeDoubles( arrInput ) {
    const
    arrOutput = [],
    map = {};
    arrInput.forEach( function forEachItem( itm ) {
        if ( itm in map ) return;
        map[ itm ] = 1;
        arrOutput.push( itm );
    } );
    return arrOutput;
}
353986
@Override
  public Float remove(int index) {
    rangeCheck(index);
    float value = elements[index];
    for (int i = index + 1; i < size; i++) {
      elements[i - 1] = elements[i];
    }
    size -= 1;
    return value;
  }
941185
function removeFromList(i, L, R) {
    R[L[i]] = R[i];
    L[R[i]] = L[i];
    R[i] = i;
    L[i] = i;
}
1021802
public void removeAt(int index) {
        System.arraycopy(mKeys, index + 1, mKeys, index, mSize - (index + 1));
        System.arraycopy(mValues, index + 1, mValues, index, mSize - (index + 1));
        mSize--;
    }
1313947
function removeFromArrayByNode(node, eleNode) {
  const elements = node.elements;

  if (!elements.includes(eleNode)) {
    logger.warn('Failed to find element when trying to remove element from array.');
    return [];
  }

  if (!node._filePath) {
    throw new Error('No _filePath property found on node when removing element from array');
  }

  const content = vio.getContent(node._filePath);

  let startPos = nearestCharBefore(',', content, eleNode.start);
  let isFirstElement = false;
  if (startPos < 0) {
    // it's the first element
    isFirstElement = true;
    startPos = node.start + 1; // start from the char just after the '['
  }

  let endPos = eleNode.end;

  if (elements.length === 1 || isFirstElement) {
    // if the element is the only element, try to remove the trailing comma if exists
    const nextComma = nearestCharAfter(',', content, endPos - 1);
    if (nextComma >= 0) endPos = nextComma + 1;
  }

  return [
    {
      start: startPos,
      end: endPos,
      replacement: '',
    },
  ];
}
929008
function unlistenArrayEvents(array, listener) {
	var stub = array._chartjs;
	if (!stub) {
		return;
	}

	var listeners = stub.listeners;
	var index = listeners.indexOf(listener);
	if (index !== -1) {
		listeners.splice(index, 1);
	}

	if (listeners.length > 0) {
		return;
	}

	arrayEvents.forEach(function(key) {
		delete array[key];
	});

	delete array._chartjs;
}