Skip to content

Commit

Permalink
Prepare for version bump to 0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
allejo committed Mar 2, 2022
1 parent 5058f63 commit 9d37428
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Changelog

## v0.2.3-dev
## v0.2.3

**2022-??-??[Diff](https://github.com/maciejczyzewski/bottomline/compare/0.2.2...0.2.3)[Docs](https://maciejczyzewski.github.io/bottomline/)**
**2022-03-01[Diff](https://github.com/maciejczyzewski/bottomline/compare/0.2.2...0.2.3)[Docs](https://maciejczyzewski.github.io/bottomline/)**

* Updates to the `__::slug()` function,
- Optimized to be more performant when given plain, old ASCII text
- Has a workaround for [a bug in PHP 8.1](https://github.com/php/php-src/issues/7898) that would return an empty string
* Added `__::dropWhile`, `__::dropRight`, and `dropRightWhile`
* Added `__::dropWhile`, `__::dropRight`, and `__::dropRightWhile`
* Fix error in `__::mapKeys` that affected PHP 5.5

## v0.2.2

Expand Down
21 changes: 18 additions & 3 deletions docs/_data/fxn_registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@
"type": "int"
}
],
"changelog": [],
"changelog": [
{
"version": "0.2.3",
"message": "added to Bottomline"
}
],
"exceptions": [],
"return": {
"type": "array|\\Generator",
Expand Down Expand Up @@ -214,7 +219,12 @@
"type": "\\Closure|float|int|string|bool"
}
],
"changelog": [],
"changelog": [
{
"version": "0.2.3",
"message": "added to Bottomline"
}
],
"exceptions": [],
"return": {
"type": "array|\\Generator",
Expand Down Expand Up @@ -246,7 +256,12 @@
"type": "\\Closure|float|int|string|bool"
}
],
"changelog": [],
"changelog": [
{
"version": "0.2.3",
"message": "added to Bottomline"
}
],
"exceptions": [],
"return": {
"type": "array|\\Generator",
Expand Down
8 changes: 4 additions & 4 deletions src/__/__.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
** Sequences [1]
*****************************************************************
* bottomline v0.2.1 *
* bottomline v0.2.3 *
* bottomline is licensed under the MIT license *
* Copyright (c) 2014 Maciej A. Czyzewski *
*****************************************************************/
Expand All @@ -33,9 +33,9 @@
* @method static array|\Generator chunk(iterable $iterable, int $size = 1, bool $preserveKeys = false) <p>Creates an array of elements split into groups the length of <code>$size</code>.</p><br><p>If array can't be split evenly, the final chunk will be the remaining elements. When <code>$preserveKeys</code> is set to TRUE, keys will be preserved. Default is FALSE, which will reindex the chunk numerically.</p> <p><strong>Usage</strong></p> <pre><code class="language-php">__::chunk([1, 2, 3, 4, 5], 3);</code></pre> <p><strong>Result</strong></p> <pre><code>[[1, 2, 3], [4, 5]]</code></pre><h2>Changelog</h2><ul><li><p><code>0.2.0</code> - iterable objects are now supported</p></li></ul><h2>Exceptions</h2><ul><li><p><code>\InvalidArgumentException</code> - when an non-array or non-traversable object is given for $iterable.</p></li><li><p><code>\Exception</code> - when an <code>\IteratorAggregate</code> is given and <code>getIterator()</code> throws an exception.</p></li></ul><h2>Returns</h2><p>When given a <code>\Traversable</code> object for <code>$iterable</code>, a generator will be returned. Otherwise, an array will be returned.</p>
* @method static array|\Generator compact(iterable $iterable) <p>Creates an array with all falsey values removed.</p><br><p>The following values are considered falsey:</p> <ul> <li><code>false</code></li> <li><code>null</code></li> <li><code>0</code></li> <li><code>""</code></li> <li><code>undefined</code></li> <li><code>NaN</code></li> </ul> <p><strong>Usage</strong></p> <pre><code class="language-php">__::compact([0, 1, false, 2, '', 3]);</code></pre> <p><strong>Result</strong></p> <pre><code>[1, 2, 3]</code></pre><h2>Changelog</h2><ul><li><p><code>0.2.0</code> - iterable objects are now supported</p></li></ul>
* @method static array|\Generator drop(iterable $input, int $number = 1) <p>Creates a slice of array with n elements dropped from the beginning.</p><br><p><strong>Usage</strong></p> <pre><code class="language-php">__::drop([0, 1, 3, 5], 2);</code></pre> <p><strong>Result</strong></p> <pre><code>[3, 5]</code></pre><h2>Changelog</h2><ul><li><p><code>0.2.0</code> - iterable objects are now supported</p></li></ul>
* @method static array|\Generator dropRight(iterable $input, int $number = 1) <p>Creates a slice of an array with n elements dropped from the end.</p><br><p>If the provided iterator is an array, then an array will be returned. Otherwise, a Generator will be returned. In this latter case, the entire iterable will be buffered in memory. If the iterable contains many elements, then this could cause memory issues.</p> <p><strong>Usage</strong></p> <pre><code class="language-php">__::dropRight([0, 1, 3, 5], 2);</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[0, 1]</code></pre><h2>Returns</h2><p>An array containing a subset of the input array with front items matching the condition removed. If the provided iterable is not an array, then a Generator will be returned.</p>
* @method static array|\Generator dropRightWhile(iterable $input, \Closure|float|int|string|bool $condition) <p>Creates a slice of the provided array with all elements matching the condition removed from the end.</p><br><p>If the provided iterator is an array, then an array will be returned. Otherwise, a Generator will be returned. In this latter case, the entire iterable will be buffered in memory. If the iterable contains many elements, then this could cause memory issues.</p> <p><strong>Drop by Primitive Condition</strong></p> <pre><code class="language-php">__::dropRightWhile([1, 2, 3, 3], 3);</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[1, 2]</code></pre> <p><strong>Drop by Callback</strong></p> <pre><code class="language-php">__::dropRightWhile([1, 2, 3, 4, 5], static function ($item) {<br /> return $item &gt; 3;<br /> });</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[1, 2, 3]</code></pre><h2>Returns</h2><p>An array containing a subset of the input array with front items matching the condition removed. If the provided iterable is not an array, then a Generator will be returned.</p>
* @method static array|\Generator dropWhile(array|iterable $input, \Closure|float|int|string|bool $condition) <p>Creates a slice of the provided array with all elements matching the condition removed from the front.</p><br><p><strong>Drop by Primitive Condition</strong></p> <pre><code class="language-php">__::dropWhile([1, 1, 2, 3, 4], 1);</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[2, 3, 4]</code></pre> <p><strong>Drop by Callback</strong></p> <pre><code class="language-php">__::dropWhile([1, 2, 3, 4, 5], static function ($item) {<br /> return $item &lt; 3;<br /> });</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[3, 4, 5]</code></pre><h2>Returns</h2><p>An array containing a subset of the input array with front items matching the condition removed. If the input was not an array, then a \Generator will be returned.</p>
* @method static array|\Generator dropRight(iterable $input, int $number = 1) <p>Creates a slice of an array with n elements dropped from the end.</p><br><p>If the provided iterator is an array, then an array will be returned. Otherwise, a Generator will be returned. In this latter case, the entire iterable will be buffered in memory. If the iterable contains many elements, then this could cause memory issues.</p> <p><strong>Usage</strong></p> <pre><code class="language-php">__::dropRight([0, 1, 3, 5], 2);</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[0, 1]</code></pre><h2>Changelog</h2><ul><li><p><code>0.2.3</code> - added to Bottomline</p></li></ul><h2>Returns</h2><p>An array containing a subset of the input array with front items matching the condition removed. If the provided iterable is not an array, then a Generator will be returned.</p>
* @method static array|\Generator dropRightWhile(iterable $input, \Closure|float|int|string|bool $condition) <p>Creates a slice of the provided array with all elements matching the condition removed from the end.</p><br><p>If the provided iterator is an array, then an array will be returned. Otherwise, a Generator will be returned. In this latter case, the entire iterable will be buffered in memory. If the iterable contains many elements, then this could cause memory issues.</p> <p><strong>Drop by Primitive Condition</strong></p> <pre><code class="language-php">__::dropRightWhile([1, 2, 3, 3], 3);</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[1, 2]</code></pre> <p><strong>Drop by Callback</strong></p> <pre><code class="language-php">__::dropRightWhile([1, 2, 3, 4, 5], static function ($item) {<br /> return $item &gt; 3;<br /> });</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[1, 2, 3]</code></pre><h2>Changelog</h2><ul><li><p><code>0.2.3</code> - added to Bottomline</p></li></ul><h2>Returns</h2><p>An array containing a subset of the input array with front items matching the condition removed. If the provided iterable is not an array, then a Generator will be returned.</p>
* @method static array|\Generator dropWhile(array|iterable $input, \Closure|float|int|string|bool $condition) <p>Creates a slice of the provided array with all elements matching the condition removed from the front.</p><br><p><strong>Drop by Primitive Condition</strong></p> <pre><code class="language-php">__::dropWhile([1, 1, 2, 3, 4], 1);</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[2, 3, 4]</code></pre> <p><strong>Drop by Callback</strong></p> <pre><code class="language-php">__::dropWhile([1, 2, 3, 4, 5], static function ($item) {<br /> return $item &lt; 3;<br /> });</code></pre> <p><strong>Result</strong></p> <pre><code class="language-php">[3, 4, 5]</code></pre><h2>Changelog</h2><ul><li><p><code>0.2.3</code> - added to Bottomline</p></li></ul><h2>Returns</h2><p>An array containing a subset of the input array with front items matching the condition removed. If the input was not an array, then a \Generator will be returned.</p>
* @method static array|\Generator flatten(iterable $iterable, bool $shallow = false) <p>Flattens a multidimensional array or iterable.</p><br><p>If <code>$shallow</code> is set to TRUE, the array will only be flattened a single level.</p> <p><strong>Usage</strong></p> <pre><code class="language-php">__::flatten([1, 2, [3, [4]]], false);</code></pre> <p><strong>Result</strong></p> <pre><code>[1, 2, 3, 4]</code></pre><h2>Changelog</h2><ul><li><p><code>0.2.0</code> - iterable objects are now supported</p></li></ul>
* @method static array patch(array $array, array $patches, string $parent = '') <p>Patches array by xpath.</p><br><p><strong>Usage</strong></p> <pre><code class="language-php">__::patch(<br /> [<br /> 'addr' =&gt; [<br /> 'country' =&gt; 'US',<br /> 'zip' =&gt; 12345<br /> ]<br /> ],<br /> [<br /> '/addr/country' =&gt; 'CA',<br /> '/addr/zip' =&gt; 54321<br /> ]<br /> );</code></pre> <p><strong>Result</strong></p> <pre><code>['addr' =&gt; ['country' =&gt; 'CA', 'zip' =&gt; 54321]]</code></pre><h2>Returns</h2><p>Returns patched array</p>
* @method static array prepend(array $array, mixed $value = null) <p>Prepend item or value to an array.</p><br><p><strong>Usage</strong></p> <pre><code class="language-php">__::prepend([1, 2, 3], 4);</code></pre> <p><strong>Result</strong></p> <pre><code>[4, 1, 2, 3]</code></pre>
Expand Down
2 changes: 2 additions & 0 deletions src/__/arrays/dropRight.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ function dropRightArray($input, $number)
* @see dropWhile
* @see dropRightWhile
*
* @since 0.2.3 added to Bottomline
*
* @return array|\Generator An array containing a subset of the input array with front items matching the condition
* removed. If the provided iterable is not an array, then a Generator will be returned.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/__/arrays/dropRightWhile.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ function dropArrayRightWhile($input, $comparison)
* @see dropRight
* @see dropRightWhile
*
* @since 0.2.3 added to Bottomline
*
* @return array|\Generator An array containing a subset of the input array with front items matching the condition
* removed. If the provided iterable is not an array, then a Generator will be returned.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/__/arrays/dropWhile.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ function dropArrayWhile($input, $comparison)
* @see dropRight
* @see dropRightWhile
*
* @since 0.2.3 added to Bottomline
*
* @return array|\Generator An array containing a subset of the input array with front
* items matching the condition removed. If the input was not an array, then a \Generator
* will be returned.
Expand Down
Loading

0 comments on commit 9d37428

Please sign in to comment.