Skip to content

Commit

Permalink
adding deprecated messages to all array functions closes #2709
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren McCarthy committed Apr 28, 2018
1 parent 93aec3c commit 5a88442
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 3 additions & 7 deletions docs/yuidoc-p5-theme-src/scripts/tpl/item.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@ <h4><span id="reference-example">Example</span></h4>


<div class="description">

<h4><span id="reference-description">Description</span></h4>

<% if (item.deprecated) { %>
<p>
<span style="color: #ED225D;">Deprecated:</span>
<code class="language-javascript"><%=item.name%><% if (item.isMethod) { %>()<% } %></code>
is deprecated and will be removed in a future version of p5.

<% if (item.deprecationMessage) { %><%=item.deprecationMessage%><% } %>
Deprecated: <%=item.name%><% if (item.isMethod) { %>()<% } %> is deprecated and will be removed in a future version of p5. <% if (item.deprecationMessage) { %><%=item.deprecationMessage%><% } %>
</p>
<% } %>


<h4><span id="reference-description">Description</span></h4>

<span class='description-text'><%= item.description %></span>

Expand Down
11 changes: 10 additions & 1 deletion src/utilities/array_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var p5 = require('../core/core');
* the array by one. Maps to Array.push().
*
* @method append
* @deprecated Use <code class='language-javascript'>array.push(value)</code> instead.
* @deprecated Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push">array.push(value)</a> instead.
* @param {Array} array Array to append
* @param {any} value to be added to the Array
* @example
Expand Down Expand Up @@ -49,6 +49,7 @@ p5.prototype.append = function(array, value) {
* iterating through a for() loop and copying each element individually.
*
* @method arrayCopy
* @deprecated
* @param {Array} src the source Array
* @param {Integer} srcPosition starting position in the source Array
* @param {Array} dst the destination Array
Expand All @@ -72,6 +73,7 @@ p5.prototype.append = function(array, value) {
*/
/**
* @method arrayCopy
* @deprecated Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin">arr1.copyWithin(arr2)</a> instead.
* @param {Array} src
* @param {Array} dst
* @param {Integer} [length]
Expand Down Expand Up @@ -113,6 +115,7 @@ p5.prototype.arrayCopy = function(src, srcPosition, dst, dstPosition, length) {
* input arrays.
*
* @method concat
* @deprecated Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat">arr1.concat(arr2)</a> instead.
* @param {Array} a first Array to concatenate
* @param {Array} b second Array to concatenate
* @return {Array} concatenated array
Expand Down Expand Up @@ -142,6 +145,7 @@ p5.prototype.concat = function(list0, list1) {
* Reverses the order of an array, maps to Array.reverse()
*
* @method reverse
* @deprecated Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse">array.reverse()</a> instead.
* @param {Array} list Array to reverse
* @example
* <div class='norender'><code>
Expand All @@ -163,6 +167,7 @@ p5.prototype.reverse = function(list) {
* maps to Array.pop().
*
* @method shorten
* @deprecated Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop">array.pop()</a> instead.
* @param {Array} list Array to shorten
* @return {Array} shortened Array
* @example
Expand All @@ -187,6 +192,7 @@ p5.prototype.shorten = function(list) {
* Fisher-Yates Shuffle Algorithm</a>.
*
* @method shuffle
* @deprecated See <a href="https://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array">shuffling an array with JS</a> instead.
* @param {Array} array Array to shuffle
* @param {Boolean} [bool] modify passed array
* @return {Array} shuffled Array
Expand Down Expand Up @@ -231,6 +237,7 @@ p5.prototype.shuffle = function(arr, bool) {
* count is set to 5, only the first 5 elements in the array will be sorted.
*
* @method sort
* @deprecated Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort">array.sort()</a> instead.
* @param {Array} list Array to sort
* @param {Integer} [count] number of elements to sort, starting from 0
*
Expand Down Expand Up @@ -278,6 +285,7 @@ p5.prototype.sort = function(list, count) {
* is 0, the second position is 1, and so on.)
*
* @method splice
* @deprecated Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice">array.splice()</a> instead.
* @param {Array} list Array to splice into
* @param {any} value value to be spliced in
* @param {Integer} position in the array from which to insert data
Expand Down Expand Up @@ -311,6 +319,7 @@ p5.prototype.splice = function(list, value, index) {
* This function does not change the source array.
*
* @method subset
* @deprecated Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice">array.slice()</a> instead.
* @param {Array} list Array to extract from
* @param {Integer} start position to begin
* @param {Integer} [count] number of values to extract
Expand Down

0 comments on commit 5a88442

Please sign in to comment.