@mangos/filepath 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +24 -25
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -61,11 +61,11 @@ There are 4 exported functions:
61
61
  import { allPath, firstPath, resolve, resolvePathObject } from '@mangos/filepath';
62
62
  ```
63
63
 
64
- Most of the time you will be using `resolve`, `firstPath`.
64
+ Most of the time you will be using <a href="#fn-resolve"><code>resolve</code></a>, <a href="#fn-first-path"><code>firstPath</code></a>.
65
65
 
66
66
  <h3 id="infer-path-options">Type <code>InferPathOptions</code></h3>
67
67
 
68
- The functions `allPath` and `firstPath` will try to tokenize a path string based on options object specified as the second argument.
68
+ The functions <a href="fn-all-path"><code>allPath</code></a> and <a href="fn-first-path"><code>firstPath</code></a> will try to tokenize a path string based on options object specified as the second argument.
69
69
 
70
70
  ```typescript
71
71
  type InferPathOptions = {
@@ -76,17 +76,17 @@ type InferPathOptions = {
76
76
  }
77
77
  ```
78
78
 
79
- Multiple path types _can_ be tokenized from the same path string.
79
+ Multiple path types <i>can</i> be tokenized from the same path string.
80
80
 
81
- The response of `allPath` will be an **array** of `ParsedPath` **or/and** `ParsedPathError` class instance, representing parsing for multiple OS path types.
81
+ The response of <a href="#fn-all-path"><code>allPath</code></a> will be an <b>array</b> of `ParsedPath` <b>or/and</b> <a href="#parsed-path-error"><code>ParsedPathError</code></a> class instance, representing parsing for multiple OS path types.
82
82
 
83
83
  <h4 id="infer-path-options-defaults">defaults:</h4>
84
84
 
85
- If <code><a href="#infer-path-options">InferpathOptions</code></a></code> argument is left empty in <a href="#fn-all-path"><code>allPath</code></a> and <a href="#fn-first-path"><code>firstPath</code></a> the default will be used based on OS:
85
+ If <code><a href="#infer-path-options">InferpathOptions</a></code> argument is left empty in <a href="#fn-all-path"><code>allPath</code></a> and <a href="#fn-first-path"><code>firstPath</code></a> the default will be used based on OS:
86
86
 
87
87
 
88
- - The default for windos: `{ dos: true, devicePath: true, unc: true, posix: false }`
89
- - The default for unix: `{ posix: true }`
88
+ - The default for windos: <code>{ dos: true, devicePath: true, unc: true, posix: false }</code>
89
+ - The default for unix: <code>{ posix: true }</code>
90
90
 
91
91
  <h3 id="parsed-path"><code>ParsedPath</code> object</h3>
92
92
 
@@ -95,21 +95,21 @@ The response of a successfull path tokenization will be an ADT: `ParsedPath`.
95
95
  An instance of `ParsedPath` has the following fields/members
96
96
 
97
97
  - members:
98
- - `toString(): <string>`: return the original path string
99
- - `isRelative(): <boolean>`: is the a path a relative one?
98
+ - <code>toString(): <i>string</i></code>: return the original path string
99
+ - <code>isRelative(): <i>boolean</i></codes>: is the a path a relative one?
100
100
  - fields:
101
- - `type: <string>`, one of the value `devicePath`, `unc`, `dos`, `posix`.
102
- - `path: <Token[]>`, the path tokenized.
101
+ - <code>type: <i>string</i></code>: one of the value `devicePath`, `unc`, `dos`, `posix`.
102
+ - <code>path: <i>Token[]</i></code>: the path tokenized (see source).
103
103
 
104
104
  <h3 id="parsed-path-error"><code>ParsedPathError</code> object</h3>
105
105
 
106
- If a path has illigal characters or is invalid the result of a tokenization will be an ADT: `ParsedPathError`
106
+ If a path has illigal characters or is invalid the result of a tokenization will be an ADT: <code>ParsedPathError</code>
107
107
 
108
108
  - members:
109
- - `toString(): <string>`: algamation of all errors found during parsing.
109
+ - <code>toString(): <i>string</i></code>: algamation of all errors found during parsing.
110
110
  - attributes:
111
- - `type: <string>`, one of the values `devicePath`, `unc`, `dos`, `posix`.
112
- - `path: <Token[]>`, the path tokenized.
111
+ - <code>type: <i>string</i></code>: one of the values `devicePath`, `unc`, `dos`, `posix`.
112
+ - <code>path: <i>Token[]</i></code>: the path tokenized.
113
113
 
114
114
 
115
115
  <h3 id="path-type-order-of-evaluation">Path type order of evaluation</h4>
@@ -131,8 +131,8 @@ function allPath(path = '', options: InferPathOptions = {}): (ParsedPath | Parse
131
131
 
132
132
  <h5 id="fn-all-path-arguments">Arguments:</h5>
133
133
 
134
- - <code>path: <i>string</i> optional</code>: (<b>Default</b> is current working directory). Relative or absolute <code>path</code> conforming to one of the <a href="#supported-path">supported path types</a>. Parsed according to <a href="#infer-path-options">options</a>.
135
- - <code>options: <a href="infer-path-options">InferPathOptions</a> optional</code>: Parsing limited to flags set to <code>true</code> in <a href="#infer-path-options">options</a>.
134
+ - <code>path: <i>string</i> optional</code>: (<b>Default</b> is current working directory). Relative or absolute <code>path</code> conforming to one of the <a href="#supported-path">supported path types</a>.
135
+ - <code>options: <i><a href="#infer-path-options">InferPathOptions</a></i> optional</code>: Parsing limited to flags set to <code>true</code> in <a href="#infer-path-options">options</a>.
136
136
 
137
137
  <h5 id="fn-all-path-return">Return:</h5>
138
138
 
@@ -165,7 +165,7 @@ function firstPath(path = '', options: InferPathOptions = {}): ParsedPath | Pars
165
165
 
166
166
  <h5 id="fn-first-path-arguments">Arguments:</h5>
167
167
 
168
- - <code>path: <i>string</i> optional</code>: (<b>Default</b> is current working directory). Relative or absolute <code>path</code> conforming to one of the <a href="#supported-path">supported path types</a>. Parsed according to <a href="#infer-path-options">options</a>.
168
+ - <code>path: <i>string</i> optional</code>: (<b>Default</b> is current working directory). Relative or absolute <code>path</code> conforming to one of the <a href="#supported-path">supported path types</a>.
169
169
  - <code>options: <a href="infer-path-options">InferPathOptions</a> optional</code>: Parsing limited to flags set to <code>true</code> in <a href="#infer-path-options">options</a>.
170
170
 
171
171
  <h5 id="fn-all-path-return">Return:</h5>
@@ -177,40 +177,39 @@ function firstPath(path = '', options: InferPathOptions = {}): ParsedPath | Pars
177
177
  - <a href="#parsed-path-error"><code>ParsedPathError</code></a>: In case of legal structure but illegal characters in the path.
178
178
 
179
179
 
180
- <h4 id="fn-resolve-path-objects">function: <code>resolvePathObject</code></h4>
180
+ <h4 id="fn-resolve-path-object">function: <code>resolvePathObject</code></h4>
181
181
 
182
182
  ```typescript
183
183
  function resolvePathObject(from: ParsedPath, ...toFragments: string[]): ParsedPath | ParsedPathError;
184
184
  ```
185
185
 
186
- <h5 id="fn-resolve-path-objects-arguments">Arguments:</h5>
186
+ <h5 id="fn-resolve-path-object-arguments">Arguments:</h5>
187
187
 
188
188
  - <code>from: <a href="#parsed-path">ParsedPath</a></code>: A previously created <code><a href="#parsed-path">ParsedPath</a></code> object via <code><a href="#fn-first-path">firstPath</a></code> function.
189
189
  - <code>toFragments: <i>string[]</i></code>: A sequence of paths or path segments.
190
190
 
191
- <h5 id="fn-resolve-path-objects-return">Return:</h5>
191
+ <h5 id="fn-resolve-path-object-return">Return:</h5>
192
192
 
193
193
  - <a href="#parsed-path"><code>ParsedPath</code></a>: In case of successfull resolve.
194
194
  - <a href="#parsed-path-error"><code>ParsedPathError</code></a>: In case of legal structure but illegal characters in the `from` or `toFragments`.
195
195
 
196
- <h5 id="fn-resolve-path-objects-throws">throws:</h5>
196
+ <h5 id="fn-resolve-path-object-throws">throws:</h5>
197
197
 
198
198
  If <code>from</code> is a <a href="#parsed-path-error"><code>ParsedPathError</code></a> an `Error` will be thrown.
199
199
 
200
200
  <h4 id="fn-resolve">function: <code>resolve</code></h4>
201
201
 
202
202
  ```typescript
203
- function resolve(fromStr = getCWD(), ...toFragments: string[]): ParsedPath | ParsedPathError;
203
+ function resolve(fromStr: string, ...toFragments: string[]): ParsedPath | ParsedPathError;
204
204
  ```
205
205
 
206
206
  <h5 id="fn-resolve-arguments">Arguments:</h5>
207
207
 
208
- - <code>fromStr: <i>string</i></code>: A path according to a <a href="">path type</a>.
208
+ - <code>fromStr: <i>string</i> optional</code>: A path according to a <a href="#supperted-path">path type</a>. Defaults to current working directory if absent/undefined.
209
209
  - <code>toFragments: <i>string[]</i></code>: A sequence of paths or path segments.
210
210
 
211
211
  <h5 id="fn-resolve-return">Return:</h5>
212
212
 
213
-
214
213
  - <a href="#parsed-path"><code>ParsedPath</code></a>: In case of successfull resolve.
215
214
  - <a href="#parsed-path-error"><code>ParsedPathError</code></a>: In case of legal structure but illegal characters in the `from` or `toFragments`.
216
215
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mangos/filepath",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "author": "jacob bogers <jkfbogers@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",