The .distinct() function is similar to the SQL distinct function in which it removes duplicates for a given set of fields.

String Parameters

The .distinct() function can take zero to many parameters. Each parameter is the name of the field to perform a distinction on. Zero arguments are only used on arrays of strings and numbers, see example below.

distinct( string, string, string, …)
distinct(...fields: string[]): jinqJs;

No Parameters

var result = new jinqJs()
                  .from([1,2,2,3,4,3,5])
                  .distinct()
                  .select();

/* result:	[1,2,3,4,5] */

String Parameters

String Array Parameter

The .distinct() function can take a single parameter that is an array of strings. Each element in the array is the name of the field to perform a distinction on.

distinct( Array(string) )
distinct(fields: string[]): jinqJs;