Skip to content

Commit

Permalink
New methods
Browse files Browse the repository at this point in the history
Updates documentation to include methods recently added to Japt v2.0a0. Adds version highlighting to shortcuts an regular expressions in documentation. Fixes bug related to manually copying compressor results.
  • Loading branch information
PeterShaggyNoble committed Apr 25, 2019
1 parent 2c3d450 commit 55f534f
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ace/
/build/
/fnt/
index.php
5 changes: 3 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ The following lists are in no particular order other than what was most likely t
- [ ] Replace chat icon & link with Slack.

## INTERPRETER
- [x] Add header & footer fields.
- [x] Collapse non-essential fields by default.
- [ ] Replace code's `textarea` with a `contenteditable` element when broader support for `plaintext-only` is available.
- [ ] Decide whether to continue using `localStorage` for output caching, switch to `sessionStorage` or use neither at all.

Expand All @@ -40,6 +38,7 @@ The following lists are in no particular order other than what was most likely t
- [ ] Add support for arrays of strings of equal length.

## DOCUMENTATION
- [x] Add version highlighting for shortcuts & Regular Expressions.
- [ ] Figure out *exactly* what `F.b()` does(!) and add it to `functions.json`.
- [ ] Deemphasise, in some way, methods that are not supported in the currently selected version of Japt and remove highlighting.
- [ ] Collapse the content below each heading in `.html` docs.
Expand Down Expand Up @@ -88,6 +87,8 @@ The following lists are in no particular order other than what was most likely t
- [x] Move `undo` & `redo` to header.

### INTERPRETER
- [x] Collapse non-essential fields by default.
- [x] Add header & footer fields.
- [x] Return caret to the same position after auto-golfing.
- [x] Ctrl+G runs auto-golf.
- [x] Add `information` icon to open the documentation on flags.
Expand Down
2 changes: 1 addition & 1 deletion css/default.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/array.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/number.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type":"methods","title":"Number Methods","object":"N","intro":[],"methods":{"a(n=0)":{"description":"Returns the absolute difference of `N` and `n`.","returns":"N","version":"1.4.5"},"b(n1,n2=N)":{"description":"Returns `n1` if `N<n1`, `n2` if `N>n2`, or `N` otherwise.","returns":"N","version":"1.4.5"},"c(n=1)":{"description":"Returns `N` rounded up to the nearest multiple of `n`.","returns":"N","version":"1.4.5"},"d(n=0)":{"description":"Returns the character at codepoint `N+n`.","returns":"S","version":"1.4.5"},"e(n)":{"description":"Returns `N*(10**n)` (`N` multiplied by `10` raised to the power of `n`).","returns":"S","version":"1.4.5"},"f(n=1)":{"description":"Returns `N` rounded down to the nearest multiple of `n`.","returns":"N","version":"1.4.5"},"g()":{"description":"Returns the sign of `N`; `-1` if negative, `1` if positive, `0` if `N=0`, or `NaN` if `N=NaN`.","returns":"N","version":"1.4.5"},"g(n=0)":{"description":"Returns the sign of `N-n`; `-1` if negative, `1` if positive, `0` if `N=n`, or `NaN` if `N=NaN` or `n=NaN`.","returns":"N","version":"1.4.6"},"g(a/s)":{"description":"Returns the element or character in `a/s` at index `N`.","returns":"X/S","version":"1.4.6"},"g(f)":{"description":"Returns the result of passing `N` though `f`.","returns":"X","version":"1.4.6"},"h(n=1)":{"description":"Returns `N` rounded `n` significant decimals.","returns":"S","version":"1.4.5"},"i(s)":{"description":"Returns an `intervalID` and evaluates `s` as JavaScript every `N` milliseconds.","returns":"N","version":"1.4.5"},"j(n=1)":{"description":"Returns `true` if `N` and `n` are co-prime, or `false` if not.","returns":"B","version":"1.4.5"},"k()":{"description":"Returns the prime factors of `N`.","returns":"A","version":"1.4.5"},"l()":{"description":"Returns the factorial of `N`.","returns":"N","version":"1.4.5"},"m(n,...,n?)":{"description":"Returns the minimum of `N` and the arguments passed.","returns":"N","version":"1.4.5"},"n(n=0)":{"description":"Returns `n-N`.","returns":"N","version":"1.4.5"},"o(n1=0,n2=1,f?)":{"description":"Returns the result of passing the integers in the sorted range `[n1,N)` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"p(n=2)":{"description":"Returns `N` raised to the power of `n`.","returns":"N","version":"1.4.5"},"q(n=2)":{"description":"Returns the `n`th root of `N`.","returns":"N","version":"1.4.5"},"r(n=1)":{"description":"Returns `N` rounded to the nearest multiple of `n`.","returns":"N","version":"1.4.5"},"s(n=10)":{"description":"Returns `N` converted from to a base-`n` string. `n` is limited to `2-36`, inclusive.","returns":"S","version":"1.4.5"},"s(s/a)":{"description":"Returns the result of converting `N` to a base-`s/a` string. (e.g., `9.s([\"a\",\"b\"])` = `\"baab\"`)","returns":"S","version":"1.4.5"},"s(f)":{"description":"Returns the result of converting `N` to a string, passing it through `f` and then converting it back to a number.","returns":"N","version":"1.4.5"},"t(f)":{"description":"Returns an `timeoutID` and executes `f` after `N` milliseconds.","returns":"N","version":"1.4.5"},"u(n=2)":{"description":"Returns `N` modulo `n`, always positive.","returns":"N","version":"1.4.5"},"v(n=2)":{"description":"Returns `1` if `N` is evenly divisible by `n`, or `0` if not.","returns":"N","version":"1.4.5"},"w(n,...,n?)":{"description":"Returns the maximum of `N` and the arguments passed.","returns":"N","version":"1.4.5"},"x(n=0)":{"description":"Returns `N` rounded to `n` decimal places.","returns":"S","version":"1.4.5"},"y(n=2)":{"description":"Returns the greatest common divisor of `N` and `n`.","returns":"N","version":"1.4.5"},"z(n=2)":{"description":"Returns `N` divided by `n` and rounded down to the nearest whole number.","returns":"N","version":"1.4.5"},"à(n?)":{"description":"Returns the number of combinations of an array of length `N`. If `n` is passed, returns the number of combinations of that array of length `n`.","returns":"N","version":"1.4.5"},"à(n?)":{"description":"Returns the number of permutations of an array of length `N`. If `n` is passed, returns the number of permutations of that array of length `n`.","returns":"N","version":"1.4.5"},"â(x?)":{"description":"Returns the divisors of `N`, excluding `N` if `x` is truthy.","returns":"A","version":"1.4.5"},"ç(s=\" \")":{"description":"Returns `s` repeated `N` times.","returns":"S","version":"1.4.5"},"ì(n/s/a)":{"description":"Returns the base-`n/s/a` digits of `N`. (e.g., `9.ì([\"a\",\"b\"])` = `[\"b\",\"a\",\"a\",\"b\"]`)","returns":"A","version":"1.4.5"},"ì(f)":{"description":"Returns the result of converting `N` to an array of digits, passing it through `f` and then converting it back to a number.","returns":"N","version":"1.4.5"},"î(s=\" \")":{"description":"Returns `s` repeated and sliced to length `N`.","returns":"S","version":"1.4.5"},"ò(n1=0,n2=1,f?)":{"description":"Returns the result of passing the integers in the sorted range `[n1,N]` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"ó(n1=0,n2=1,f?)":{"description":"Returns the result of passing the integers in the sorted range `[N,N+n1)` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"ô(n1=0,n2=1,f?)":{"description":"Returns the result of passing the integers in the sorted range `[N,N+n1]` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"õ(n1=1,n2=1,f?)":{"description":"Returns the result of passing the integers in the unsorted range `[n1,N]` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"ö(n=1)":{"description":"Returns `n` random integers from the range `[0,N)` with `n` rounded up to the nearest whole number, if necessary. If `n=1` then the integer itself is returned.","returns":"A/N","version":"1.4.5"},"ö(x)":{"description":"Returns a random permutation of the range `[0,N)`.","returns":"A","version":"1.4.5"}}}
{"type":"methods","title":"Number Methods","object":"N","intro":[],"methods":{"a(n=0)":{"description":"Returns the absolute difference of `N` and `n`.","returns":"N","version":"1.4.5"},"b(n1,n2=N)":{"description":"Returns `n1` if `N<n1`, `n2` if `N>n2`, or `N` otherwise.","returns":"N","version":"1.4.5"},"c(n=1)":{"description":"Returns `N` rounded up to the nearest multiple of `n`.","returns":"N","version":"1.4.5"},"d(n=0)":{"description":"Returns the character at codepoint `N+n`.","returns":"S","version":"1.4.5"},"e(n)":{"description":"Returns `N*(10**n)` (`N` multiplied by `10` raised to the power of `n`).","returns":"S","version":"1.4.5"},"f(n=1)":{"description":"Returns `N` rounded down to the nearest multiple of `n`.","returns":"N","version":"1.4.5"},"g()":{"description":"Returns the sign of `N`; `-1` if negative, `1` if positive, `0` if `N=0`, or `NaN` if `N=NaN`.","returns":"N","version":"1.4.5"},"g(n=0)":{"description":"Returns the sign of `N-n`; `-1` if negative, `1` if positive, `0` if `N=n`, or `NaN` if `N=NaN` or `n=NaN`.","returns":"N","version":"1.4.6"},"g(a/s)":{"description":"Returns the element or character in `a/s` at index `N`.","returns":"X/S","version":"1.4.6"},"g(f)":{"description":"Returns the result of passing `N` though `f`.","returns":"X","version":"1.4.6"},"h(n=1)":{"description":"Returns `N` rounded `n` significant decimals.","returns":"S","version":"1.4.5"},"i(s)":{"description":"Returns an `intervalID` and evaluates `s` as JavaScript every `N` milliseconds.","returns":"N","version":"1.4.5"},"j(n=1)":{"description":"Returns `true` if `N` and `n` are co-prime, or `false` if not.","returns":"B","version":"1.4.5"},"k()":{"description":"Returns the prime factors of `N`.","returns":"A","version":"1.4.5"},"l()":{"description":"Returns the factorial of `N`.","returns":"N","version":"1.4.5"},"m(n,...,n?)":{"description":"Returns the minimum of `N` and the arguments passed.","returns":"N","version":"1.4.5"},"n(n=0)":{"description":"Returns `n-N`.","returns":"N","version":"1.4.5"},"o(n1=0,n2=1,f?)":{"description":"Returns the result of passing the integers in the sorted range `[n1,N)` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"p(n=2)":{"description":"Returns `N` raised to the power of `n`.","returns":"N","version":"1.4.5"},"q(n=2)":{"description":"Returns the `n`th root of `N`.","returns":"N","version":"1.4.5"},"r(n=1)":{"description":"Returns `N` rounded to the nearest multiple of `n`.","returns":"N","version":"1.4.5"},"s(n=10)":{"description":"Returns `N` converted from to a base-`n` string. `n` is limited to `2-36`, inclusive.","returns":"S","version":"1.4.5"},"s(s/a)":{"description":"Returns the result of converting `N` to a base-`s/a` string. (e.g., `9.s([\"a\",\"b\"])` = `\"baab\"`)","returns":"S","version":"1.4.5"},"s(f)":{"description":"Returns the result of converting `N` to a string, passing it through `f` and then converting it back to a number.","returns":"N","version":"1.4.5"},"s(x,f)":{"description":"Returns the result of converting `N` to a base-`x` string, passing it through `f` and then converting it back to a number.","returns":"N","version":"2.0a0"},"t(f)":{"description":"Returns an `timeoutID` and executes `f` after `N` milliseconds.","returns":"N","version":"1.4.5"},"u(n=2)":{"description":"Returns `N` modulo `n`, always positive.","returns":"N","version":"1.4.5"},"v(n=2)":{"description":"Returns `1` if `N` is evenly divisible by `n`, or `0` if not.","returns":"N","version":"1.4.5"},"w(n,...,n?)":{"description":"Returns the maximum of `N` and the arguments passed.","returns":"N","version":"1.4.5"},"x(n=0)":{"description":"Returns `N` rounded to `n` decimal places.","returns":"S","version":"1.4.5"},"y(n=2)":{"description":"Returns the greatest common divisor of `N` and `n`.","returns":"N","version":"1.4.5"},"z(n=2)":{"description":"Returns `N` divided by `n` and rounded down to the nearest whole number.","returns":"N","version":"1.4.5"},"à(n?)":{"description":"Returns the number of combinations of an array of length `N`. If `n` is passed, returns the number of combinations of that array of length `n`.","returns":"N","version":"1.4.5"},"à(n?)":{"description":"Returns the number of permutations of an array of length `N`. If `n` is passed, returns the number of permutations of that array of length `n`.","returns":"N","version":"1.4.5"},"â(x?)":{"description":"Returns the divisors of `N`, excluding `N` if `x` is truthy.","returns":"A","version":"1.4.5"},"ç(s=\" \")":{"description":"Returns `s` repeated `N` times.","returns":"S","version":"1.4.5"},"ì(n/s/a)":{"description":"Returns the base-`n/s/a` digits of `N`. (e.g., `9.ì([\"a\",\"b\"])` = `[\"b\",\"a\",\"a\",\"b\"]`)","returns":"A","version":"1.4.5"},"ì(f)":{"description":"Returns the result of converting `N` to an array of digits, passing it through `f` and then converting it back to a number.","returns":"N","version":"1.4.5"},"ì(x,f)":{"description":"Returns the result of converting `N` to an array of base-`x` digits, passing it through `f` and then converting it back to a number.","returns":"N","version":"2.0a0"},"î(s=\" \")":{"description":"Returns `s` repeated and sliced to length `N`.","returns":"S","version":"1.4.5"},"ò(n1=0,n2=1,f?)":{"description":"Returns the result of passing the integers in the sorted range `[n1,N]` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"ó(n1=0,n2=1,f?)":{"description":"Returns the result of passing the integers in the sorted range `[N,N+n1)` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"ô(n1=0,n2=1,f?)":{"description":"Returns the result of passing the integers in the sorted range `[N,N+n1]` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"õ(n1=1,n2=1,f?)":{"description":"Returns the result of passing the integers in the unsorted range `[n1,N]` (with step `n2`) through `f`.","returns":"A","version":"1.4.5"},"ö(n=1)":{"description":"Returns `n` random integers from the range `[0,N)` with `n` rounded up to the nearest whole number, if necessary. If `n=1` then the integer itself is returned.","returns":"A/N","version":"1.4.5"},"ö(x)":{"description":"Returns a random permutation of the range `[0,N)`.","returns":"A","version":"1.4.5"}}}
2 changes: 1 addition & 1 deletion docs/regex.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h3 class="ps">Regular Expressions</h3><h4 class="fwm">Before [v:2.0a0]</h4><p>Regular Expressions are strings, with `%` used instead of `\` for character classes and as the escape character.</p><p>Flags must be passed as a separate string argument to methods that support them.</p><p>The `g`lobal flag is enabled by default.</p><h4 class="fwm">From [v:2.0a0] On</h4><p>Regular Expressions use the more familiar `/&lt;exp&gt;/&lt;flags&gt;` syntax, with `\` used for character classes and as the escape character.</p><p>The `g`lobal flag is enabled by default.</p><p>Missing parentheses or square brackets at the beginning or end of an expression are inserted automatically.</p><p>`.` is automatically inserted before any of `+`, `*`, or `?` that would otherwise cause a syntax error.</p><p>The enclosing `/`s can be omitted from an expression containing only a single character class. For example `\w` transpiles to `/\w/g`.</p><p>The `s` (`dotAll`) flag has been implemented for browsers that don't yet support it, which forces `.` to include newlines in matches.</p><p>The `t`R.t(s)`` method is available for testing if `s` contains any matches for `R`, returning `true` if it does, or `false` if not.</p><h4 class="fwm">Character Classes</h4><table><thead class="fwm"><tr><th>Class</th><th>Matches</th><th>Version</th></tr></thead><tbody id="regex"></tbody></table><p>The following shortcut classes are also available in [v:2.0a0] and above.</p><table><thead class="fwm"><tr><th>Class</th><th>Transpiled</th><th>Version</th></tr></thead><tbody><tr><th>`\.`</th><th>`/./g`</th><th>[v:2.0a0]</th></tr><tr><th>`\*`</th><th>`/.*/g`</th><th>[v:2.0a0]</th></tr><tr><th>`\+`</th><th>`/.+/g`</th><th>[v:2.0a0]</th></tr><tr><th>`\?`</th><th>`/.?/g`</th><th>[v:2.0a0]</th></tr><tr><th>`\^`</th><th>`/[^]/g`</th><th>[v:2.0a0]</th></tr></tbody></table>
<h3 class="ps">Regular Expressions</h3><h4 class="fwm">Before [v:2.0a0]</h4><p>Regular Expressions are strings, with `%` used instead of `\` for character classes and as the escape character.</p><p>Flags must be passed as a separate string argument to methods that support them.</p><p>The `g`lobal flag is enabled by default.</p><h4 class="fwm">From [v:2.0a0] On</h4><p>Regular Expressions use the more familiar `/&lt;exp&gt;/&lt;flags&gt;` syntax, with `\` used for character classes and as the escape character.</p><p>The `g`lobal flag is enabled by default.</p><p>Missing parentheses or square brackets at the beginning or end of an expression are inserted automatically.</p><p>`.` is automatically inserted before any of `+`, `*`, or `?` that would otherwise cause a syntax error.</p><p>The enclosing `/`s can be omitted from an expression containing only a single character class. For example `\w` transpiles to `/\w/g`.</p><p>The `s` (`dotAll`) flag has been implemented for browsers that don't yet support it, which forces `.` to include newlines in matches.</p><p>The `t`R.t(s)`` method is available for testing if `s` contains any matches for `R`, returning `true` if it does, or `false` if not.</p><h4 class="fwm">Character Classes</h4><table><thead class="fwm"><tr><th>Class</th><th>Matches</th><th>Version</th></tr></thead><tbody id="regex"></tbody></table><p>The following shortcut classes are also available in [v:2.0a0] and above.</p><table><thead class="fwm"><tr><th>Class</th><th>Transpiled</th></tr></thead><tbody><tr><th>`\.`</th><th>`/./g`</th></tr><tr><th>`\*`</th><th>`/.*/g`</th></tr><tr><th>`\+`</th><th>`/.+/g`</th></tr><tr><th>`\?`</th><th>`/.?/g`</th></tr><tr><th>`\^`</th><th>`/[^]/g`</th></tr></tbody></table>
Loading

0 comments on commit 55f534f

Please sign in to comment.