UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

15 lines (14 loc) 386 B
/** * Removes value from an array. * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` * @param {Array} array * @param {*} value * @return {Array} original array */ export const removeFromArray = <T>(array: T[], value: T): T[] => { const idx = array.indexOf(value); if (idx !== -1) { array.splice(idx, 1); } return array; };