Skip to content

Latest commit

 

History

History
40 lines (24 loc) · 980 Bytes

File metadata and controls

40 lines (24 loc) · 980 Bytes

Class: Array

Provide a unique method that performs all diff steps at once.

All examples will use the following variables:

import * as Differs from '@balmanth/differs';

const base = 'Example'.split('');  // Base char array.
const input = 'eXAMPLe'.split(''); // Input char array.

Method: from(base, input, comparator)

Use this method to calculate the diff between the base and input values.

Syntax

const patches = Differs.Array.from(base, input); // Get the patch array.

Parameters

  • base, the base array, usually is the original/unchanged value.
  • input, the changed array that will be compared with the base array.
  • comparator, An optional comparison function that is called at every comparison.

Return value

  • Returns the patch array where you can see in more details what is the diff between the base and input values.

Reference

Go Back

License

MIT