-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmangler.api.html
43 lines (43 loc) · 17.9 KB
/
smangler.api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>smangler.api documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Smangler</span> <span class="project-version">1.0.4</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="splitting.html"><div class="inner"><span>Splitting</span></div></a></li><li class="depth-1 "><a href="trimming.html"><div class="inner"><span>Trimming</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>smangler</span></div></div></li><li class="depth-2 branch current"><a href="smangler.api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>api</span></div></a></li><li class="depth-2"><a href="smangler.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="smangler.api.html#var-all-prefixes"><div class="inner"><span>all-prefixes</span></div></a></li><li class="depth-1"><a href="smangler.api.html#var-all-subs"><div class="inner"><span>all-subs</span></div></a></li><li class="depth-1"><a href="smangler.api.html#var-all-suffixes"><div class="inner"><span>all-suffixes</span></div></a></li><li class="depth-1"><a href="smangler.api.html#var-trim-both"><div class="inner"><span>trim-both</span></div></a></li><li class="depth-1"><a href="smangler.api.html#var-trim-both-once"><div class="inner"><span>trim-both-once</span></div></a></li><li class="depth-1"><a href="smangler.api.html#var-trim-both-once-with-orig"><div class="inner"><span>trim-both-once-with-orig</span></div></a></li><li class="depth-1"><a href="smangler.api.html#var-trim-both-seq"><div class="inner"><span>trim-both-seq</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">smangler.api</h1><h4 class="added">added in 1.0.0</h4><div class="doc"><div class="markdown"><p>smangler library, API.</p>
</div></div><div class="public anchor" id="var-all-prefixes"><h3>all-prefixes</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(all-prefixes w)</code><code>(all-prefixes pred w)</code></div><div class="doc"><div class="markdown"><p>Generates a lazy sequence of all possible prefixes of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.</p>
<p>Objects of the following types which are passed as a last argument are coerced to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.</p>
<p>The resulting sequence will contain the original string on its last position.</p>
<p>If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return a new value. That way the prefixes will be generated for parts of the string instead of separate characters.</p>
<p>Objects of the following types which are passed as a first argument of 2-arity version are coerced to a slicing predicate: characters, numbers, strings, sequences of characters, collections of strings, collections of characters, collections of numbers. It splits them into single-character elements and creates a sets to be used as functions. In case of a single character it creates a small predicate function. For nil it will create a function that won’t match anything. Same for empty collections or strings.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/api.clj#L90">view source</a></div></div><div class="public anchor" id="var-all-subs"><h3>all-subs</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(all-subs w)</code><code>(all-subs pred w)</code></div><div class="doc"><div class="markdown"><p>Generates a lazy sequence of all possible substrings (prefixes, suffixes and infixes) of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.</p>
<p>Objects of the following types which are passed as a last argument are coerced to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.</p>
<p>The resulting sequence will contain the original string in its middle. Moreover, the substrings will not be unique across the sequence if the characters are repeating in the input.</p>
<p>If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return a new value. That way the substrings will be generated for parts of the string instead of separate characters.</p>
<p>Objects of the following types which are passed as a first argument of 2-arity variant are coerced to a slicing predicate: characters, numbers, strings, sequences of characters, collections of strings, collections of characters, collections of numbers. It splits them into single-character elements and creates a sets to be used as functions. In case of a single character it creates a small predicate function. For nil it will create a function that won’t match anything. Same for empty collections or strings.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/api.clj#L112">view source</a></div></div><div class="public anchor" id="var-all-suffixes"><h3>all-suffixes</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(all-suffixes w)</code><code>(all-suffixes pred w)</code></div><div class="doc"><div class="markdown"><p>Generates a lazy sequence of all possible suffixes of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.</p>
<p>Objects of the following types which are passed as a last argument are coerced to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.</p>
<p>The resulting sequence will contain the original string on its first position.</p>
<p>If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return a new value. That way the suffixes will be generated for parts of the string instead of separate characters.</p>
<p>Objects of the following types which are passed as a first argument of 2-arity variant are coerced to a slicing predicate: characters, numbers, strings, sequences of characters, collections of strings, collections of characters, collections of numbers. It splits them into single-character elements and creates a sets to be used as functions. In case of a single character it creates a small predicate function. For nil it will create a function that won’t match anything. Same for empty collections or strings.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/api.clj#L101">view source</a></div></div><div class="public anchor" id="var-trim-both"><h3>trim-both</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(trim-both w)</code><code>(trim-both matcher w)</code><code>(trim-both start end w)</code></div><div class="doc"><div class="markdown"><p>Takes a string and recursively trims its first and last character if they are equal. Returns a new string or nil (when nil was passed as an argument instead of a string). For an empty string it returns an empty string.</p>
<p>Objects of the following types that are passed as a last argument are coerced to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.</p>
<p>When 2 arguments are given the first one should be a character matching function used to decide whether to trim first and last character. It should take a single character and make a lookup to decide whether this character should be trimmed from the beginning of a string. Additionally, the returned value is used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It’s common to use a set (to match the same characters on both ends) or a map (to match different characters).</p>
<p>Objects of the following types that are passed as a first argument of 2-arity variant are coerced to a matching function: characters, numbers, strings, sequences of characters, collections of strings, collections of characters, collections of numbers. It splits them into single-character elements and creates a sets to be used as functions. In case of single characters it creates a small predicate function. For nil it will create a function that won’t match anything. Same for empty collections or strings.</p>
<p>When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument).</p>
<p>When the string consist of 2 matching letters the result will be an empty string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/api.clj#L15">view source</a></div></div><div class="public anchor" id="var-trim-both-once"><h3>trim-both-once</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(trim-both-once w)</code><code>(trim-both-once matcher w)</code><code>(trim-both-once start end w)</code></div><div class="doc"><div class="markdown"><p>Takes a string and trims its first and last character if they are equal. Returns a new string or original string if there is nothing to trim. For nil it returns nil.</p>
<p>Objects of the following types that are passed as a last argument are coerced to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.</p>
<p>When 2 arguments are given the first one should be a character matching function used to decide whether to trim first and last character. It should take a single character and make a lookup to decide whether this character should be trimmed from the beginning of a string. Additionally, the returned value is used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It’s common to use a set (to match the same characters on both ends) or a map (to match different characters).</p>
<p>Objects of the following types that are passed as a first argument of 2-arity variant are coerced to a matching function: characters, numbers, strings, sequences of characters, collections of strings, collections of characters, collections of numbers. It splits them into single-character elements and creates a sets to be used as functions. In case of single characters it creates a small predicate function. For nil it will create a function that won’t match anything. Same for empty collections or strings.</p>
<p>When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument).</p>
<p>When the string consist of 2 matching letters the result will be an empty string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/api.clj#L33">view source</a></div></div><div class="public anchor" id="var-trim-both-once-with-orig"><h3>trim-both-once-with-orig</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(trim-both-once-with-orig w)</code><code>(trim-both-once-with-orig matcher w)</code><code>(trim-both-once-with-orig start end w)</code></div><div class="doc"><div class="markdown"><p>Takes a string and trims its first and last character if they are equal. Returns a 2-element sequence containing a new string and the original one. If there is nothing to trim it returns a sequence with just 1 element. For nil it returns nil.</p>
<p>Objects of the following types that are passed as a last argument are coerced to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.</p>
<p>When 2 arguments are given the first one should be a character matching function used to decide whether to trim first and last character. It should take a single character and make a lookup to decide whether this character should be trimmed from the beginning of a string. Additionally, the returned value is used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It’s common to use a set (to match the same characters on both ends) or a map (to match different characters).</p>
<p>Objects of the following types that are passed as a first argument of 2-arity variant are coerced to a matching function: characters, numbers, strings, sequences of characters, collections of strings, collections of characters, collections of numbers. It splits them into single-character elements and creates a sets to be used as functions. In case of single characters it creates a small predicate function. For nil it will create a function that won’t match anything. Same for empty collections or strings.</p>
<p>When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument).</p>
<p>When the last of the processed strings consist of 2 matching letters the resulting sequence will contain an empty string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/api.clj#L67">view source</a></div></div><div class="public anchor" id="var-trim-both-seq"><h3>trim-both-seq</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(trim-both-seq w)</code><code>(trim-both-seq matcher w)</code><code>(trim-both-seq start end w)</code></div><div class="doc"><div class="markdown"><p>Takes a string and recursively trims its first and last character if they are equal. Returns a lazy sequence of strings for each iteration. For nil it returns nil.</p>
<p>Objects of the following types that are passed as a last argument are coerced to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.</p>
<p>When 2 arguments are given the first one should be a character matching function used to decide whether to trim first and last character. It should take a single character and make a lookup to decide whether this character should be trimmed from the beginning of a string. Additionally, the returned value is used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It’s common to use a set (to match the same characters on both ends) or a map (to match different characters).</p>
<p>Objects of the following types that are passed as a first argument of 2-arity variant are coerced to a matching function: characters, numbers, strings, sequences of characters, collections of strings, collections of characters, collections of numbers. It splits them into single-character elements and creates a sets to be used as functions. In case of single characters it creates a small predicate function. For nil it will create a function that won’t match anything. Same for empty collections or strings.</p>
<p>When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument).</p>
<p>When the last of the processed strings consist of 2 matching letters the resulting sequence will contain an empty string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/api.clj#L50">view source</a></div></div></div></body></html>