Skip to content

Releases: elliotchance/pie

v1.24.4

13 May 23:41
Compare
Choose a tag to compare
fix: Regexp for Equals() (#138)

Allow the regular expression to be more flexible when the left side is not a simple variable.

Fixes #137

v1.24.3

12 May 23:22
Compare
Choose a tag to compare
abs: lossy precision: don't convert int into float64 (#131)

Fixes #130

v1.24.2

12 May 23:04
Compare
Choose a tag to compare
docs: Fix missing 'pie' in go:generate in README (#127)

v1.24.1

10 May 06:42
Compare
Choose a tag to compare
refactoring: Sequence and SequenceUsing (#126)

Removing duplicate code and also fixing a bug where zero params would cause a panic.

Fixes #125

v1.24.0

09 May 23:23
Compare
Choose a tag to compare
added: SequenceUsing (#122)

SequenceUsing generates slice in range using creator function

There are 3 variations to generate:

    1. [0, n).
    2. [min, max).
    3. [min, max) with step.

If len(params) == 1 considered that will be returned slice between 0 and n, where n is the first param, [0, n).

If len(params) == 2 considered that will be returned slice between min and max, where min is the first param, max is the second, [min, max).

If len(params) > 2 considered that will be returned slice between min and max with step, where min is the first param, max is the second, step is the third one, [min, max) with step, others params will be ignored.

Fixes #107

v1.23.0

09 May 07:45
0ee07df
Compare
Choose a tag to compare
added: Ints and Floats64s (#121)

Ints and Floats64s transforms each element to an int or float64 respectively.

v1.22.0

09 May 07:11
380ad8e
Compare
Choose a tag to compare
added: Strings (#120)

This also allows fmt.Stringer to be used.

v1.21.0

09 May 03:57
81bd720
Compare
Choose a tag to compare
added: custom equality (#113)

Some functions that compare elements, such as Contains will use the following method if it is available on the element type:

    func (a ElementType) Equals(b ElementType) bool

The `ElementType` must be the same for the receiver and argument and it must return a bool. Be careful to create the function on the pointer or non-pointer
type that is used by the slice.

Here is a minimal example:

    type Car struct {
    	Name, Color string
    }

    type Cars []*Car // ElementType is *Car

    func (c *Car) Equals(c2 *Car) bool {
    	return c.Name == c2.Name
    }

Fixes #111

v1.20.1

08 May 22:27
Compare
Choose a tag to compare
fix: non-destructive​Append (#101)

Make sure that Append never alters the receiver​ or other slices sharing the same memory, unlike the built-in append.

Fixes #97

v1.20.0

08 May 22:18
Compare
Choose a tag to compare
added: Sequence (#108)

Sequence generates all numbers in range or returns nil if params invalid

There are 3 variations to generate:

    1. [0, n).
    2. [min, max).
    3. [min, max) with step.

If len(params) == 1 considered that will be returned slice between 0 and n,  where n is the first param, [0, n).
If len(params) == 2 considered that will be returned slice between min and max, where min is the first param, max is the second, [min, max).
If len(params) > 2 considered that will be returned slice between min and max with step, where min is the first param, max is the second, step is the third one, [min, max) with step, others params will be ignored.

Fixes #70