How to use array-equal - 8 common examples

To help you get started, we’ve selected a few array-equal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nordnet / nordnet-ui-kit / src / components / spark-graph / interpolate.js View on Github external
// If none of the above criterias are met assume that we
  // are dealing with a completely new dataset

  if (pointsFrom.length < pointsTo.length) {
    const seqPos = findSequencePositionInArray(pointsTo, pointsFrom);
    return seqPos ? { frontDelta: seqPos.start, backDelta: pointsTo.length - seqPos.stop - 1 } : null;
  }

  if (pointsFrom.length > pointsTo.length) {
    const seqPos = findSequencePositionInArray(pointsFrom, pointsTo);
    return seqPos ? { frontDelta: -seqPos.start, backDelta: seqPos.stop + 1 - pointsFrom.length } : null;
  }

  for (let i = 1; i < pointsFrom.length; i++) {
    if (pointsFrom[i] === pointsTo[0]) {
      if (arrayEqual(pointsFrom.slice(i), pointsTo.slice(0, pointsTo.length - i))) {
        return { frontDelta: -i, backDelta: i };
      }
    }
  }

  return null;
}
github este / este / components / editor / EditorMenuBreadcrumbs.js View on Github external
const buttons = activePath.reduce((buttons, pathIndex, index) => {
      const child = pathChildren[pathIndex];
      // Written like this because of Flow type refinements.
      if (stringFound || typeof child === 'string') {
        stringFound = true;
        return buttons;
      }
      pathChildren = child.props.children;
      const key = getElementKey(child);
      // Enforce autoFocus via activePath. Remember autoFocus uses identity.
      const autoFocus = index === activePath.length - 1 && activePath;
      buttonPath = buttonPath.concat(pathIndex);
      const active =
        activeSection === 'element' && arrayEqual(activePath, buttonPath);

      return [
        ...buttons,
        
          
          
            {child.type}
          
        ,
      ];
    }, []);
github nordnet / nordnet-ui-kit / src / components / spark-graph / spark-graph.jsx View on Github external
const {
      points,
      stroke,
      strokeWidth,
      className,
      style,
      ...rest
    } = this.props;
    const { width, height, pointsFrom, pointsTo } = this.state;
    const styles = Object.assign({
      width: !this.props.width ? '100%' : `${width}px`,
      height: !this.props.height ? '100%' : `${height}px`,
    }, style);
    let pointsToRender;

    if (!pointsFrom || arrayEqual(pointsFrom, pointsTo)) {
      pointsToRender = transformPoints(points, width, height, strokeWidth);
    }

    return (
      <svg viewBox="{`0" style="{styles}"> {
          this.svgNode = node;
        }}
      &gt;
        </svg>
github SpoonX / aurelia-charts / dist / es2015 / config.js View on Github external
chartScales.scales.forEach(chartScale => {
        if (arrayEquals(scale, chartScale)) {
          result.push(chartScales.constructor);
        }
      });
    });
github nordnet / nordnet-ui-kit / src / components / spark-graph / interpolate.js View on Github external
function pointInterpolator(pointsFrom, pointsTo, width, height, strokeWidth) {
  if (!pointsFrom || arrayEqual(pointsFrom, pointsTo)) {
    return null;
  }

  const from = pointsFrom.length === 1 ? [...pointsFrom, ...pointsFrom] : pointsFrom;
  const to = pointsTo.length === 1 ? [...pointsTo, ...pointsTo] : pointsTo;
  const pointChange = analyzeDataPattern(from, to);
  const coordsFrom = transformPoints(from, width, height, strokeWidth);
  const coordsTo = transformPoints(to, width, height, strokeWidth);
  let res;

  if (pointChange) {
    res = addSmoothTransisionPoints(coordsFrom, coordsTo, pointChange.frontDelta, pointChange.backDelta);
  } else {
    res = addUndefinedTransitionPoints(coordsFrom, coordsTo);
  }
github SpoonX / aurelia-charts / src / config.js View on Github external
chartScales.scales.forEach(chartScale => {
        if (arrayEquals(scale, chartScale)) {
          result.push(chartScales.constructor);
        }
      });
    });
github nordnet / nordnet-ui-kit / src / components / spark-graph / interpolate.js View on Github external
function colorInterpolator(pointsFrom, pointsTo, strokeFrom, strokeTo) {
  if (!pointsFrom || arrayEqual(pointsFrom, pointsTo)) {
    return null;
  }

  const from = getStrokeColor(pointsFrom, strokeFrom);
  const to = getStrokeColor(pointsTo, strokeTo);

  if (from !== to) {
    return interpolateRgb(from, to);
  }

  return null;
}
github este / este / components / editor / EditorElement.js View on Github external
  static pathEqual = (path1: Path, path2: Path) => arrayEqual(path1, path2);

array-equal

Check if two arrays are equal

MIT
Latest version published 6 months ago

Package Health Score

81 / 100
Full package analysis

Popular array-equal functions