Skip to content

Commit 6219e07

Browse files
author
xnacly
committed
finished array.html
1 parent 962e265 commit 6219e07

File tree

1 file changed

+389
-0
lines changed

1 file changed

+389
-0
lines changed

github.io/array.html

Lines changed: 389 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,395 @@
101101
>
102102
</div>
103103
</div>
104+
´
105+
<div class="container_right">
106+
<h1 class="doc_headers">
107+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Array.ts">
108+
<svg
109+
xmlns="http://www.w3.org/2000/svg"
110+
width="32"
111+
height="32"
112+
fill="currentColor"
113+
class="bi bi-code-square"
114+
viewBox="0 0 16 16"
115+
>
116+
<path
117+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
118+
/>
119+
<path
120+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
121+
/>
122+
</svg>
123+
</a>
124+
Array
125+
</h1>
126+
<hr />
127+
<h2 class="doc_headers">
128+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
129+
<svg
130+
xmlns="http://www.w3.org/2000/svg"
131+
width="32"
132+
height="32"
133+
fill="currentColor"
134+
class="bi bi-code-square"
135+
viewBox="0 0 16 16"
136+
>
137+
<path
138+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
139+
/>
140+
<path
141+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
142+
/>
143+
</svg>
144+
</a>
145+
remove
146+
</h2>
147+
<p>removes the value of the array (Notice: it modifies the current array)</p>
148+
<div class="code_div">
149+
<p>
150+
<code
151+
><span class="function">remove</span>(<span class="var">value</span>:
152+
<span class="type">T</span>):<span class="key_word"> this</span>;</code
153+
>
154+
</p>
155+
</div>
156+
<h2 class="doc_headers">
157+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
158+
<svg
159+
xmlns="http://www.w3.org/2000/svg"
160+
width="32"
161+
height="32"
162+
fill="currentColor"
163+
class="bi bi-code-square"
164+
viewBox="0 0 16 16"
165+
>
166+
<path
167+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
168+
/>
169+
<path
170+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
171+
/>
172+
</svg>
173+
</a>
174+
flat
175+
</h2>
176+
<p>returns a new flattened array e.g. [[1,2],[3,4]] -> [1,2,3,4]</p>
177+
<div class="code_div">
178+
<p>
179+
<code
180+
><span class="function">flat</span>(<span class="var">depth?</span>:
181+
<span class="type">number</span>):<span class="type"> T</span>;</code
182+
>
183+
</p>
184+
</div>
185+
<h2 class="doc_headers">
186+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
187+
<svg
188+
xmlns="http://www.w3.org/2000/svg"
189+
width="32"
190+
height="32"
191+
fill="currentColor"
192+
class="bi bi-code-square"
193+
viewBox="0 0 16 16"
194+
>
195+
<path
196+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
197+
/>
198+
<path
199+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
200+
/>
201+
</svg>
202+
</a>
203+
first
204+
</h2>
205+
<p>returns the first element of the array</p>
206+
<div class="code_div">
207+
<p>
208+
<code><span class="function">first</span>():<span class="type"> T</span>;</code>
209+
</p>
210+
</div>
211+
<h2 class="doc_headers">
212+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
213+
<svg
214+
xmlns="http://www.w3.org/2000/svg"
215+
width="32"
216+
height="32"
217+
fill="currentColor"
218+
class="bi bi-code-square"
219+
viewBox="0 0 16 16"
220+
>
221+
<path
222+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
223+
/>
224+
<path
225+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
226+
/>
227+
</svg>
228+
</a>
229+
last
230+
</h2>
231+
<p>returns the last element of the array</p>
232+
<div class="code_div">
233+
<p>
234+
<code><span class="function">last</span>():<span class="type"> T</span>;</code>
235+
</p>
236+
</div>
237+
<h2 class="doc_headers">
238+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
239+
<svg
240+
xmlns="http://www.w3.org/2000/svg"
241+
width="32"
242+
height="32"
243+
fill="currentColor"
244+
class="bi bi-code-square"
245+
viewBox="0 0 16 16"
246+
>
247+
<path
248+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
249+
/>
250+
<path
251+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
252+
/>
253+
</svg>
254+
</a>
255+
findMap
256+
</h2>
257+
<p>finds a value in the array and maps it</p>
258+
<div class="code_div">
259+
<p>
260+
<code
261+
><span class="function">findMap</span>(<span class="key_word">predicate</span>: (<span
262+
class="var"
263+
>value</span
264+
>: <span class="type">T</span>, <span class="var">index</span>:
265+
<span class="type">number</span>, <span class="var">obj</span>:
266+
<span class="type">T[]</span>) => <span class="type">any</span>):<span class="type">
267+
any</span
268+
>;</code
269+
>
270+
</p>
271+
</div>
272+
<h2 class="doc_headers">
273+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
274+
<svg
275+
xmlns="http://www.w3.org/2000/svg"
276+
width="32"
277+
height="32"
278+
fill="currentColor"
279+
class="bi bi-code-square"
280+
viewBox="0 0 16 16"
281+
>
282+
<path
283+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
284+
/>
285+
<path
286+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
287+
/>
288+
</svg>
289+
</a>
290+
random
291+
</h2>
292+
<p>returns a random array element</p>
293+
<div class="code_div">
294+
<p>
295+
<code><span class="function">random</span>():<span class="type"> T</span>;</code>
296+
</p>
297+
</div>
298+
<h2 class="doc_headers">
299+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
300+
<svg
301+
xmlns="http://www.w3.org/2000/svg"
302+
width="32"
303+
height="32"
304+
fill="currentColor"
305+
class="bi bi-code-square"
306+
viewBox="0 0 16 16"
307+
>
308+
<path
309+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
310+
/>
311+
<path
312+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
313+
/>
314+
</svg>
315+
</a>
316+
unique
317+
</h2>
318+
<p>returns a unique array element</p>
319+
<div class="code_div">
320+
<p>
321+
<code><span class="function">unique</span>():<span class="type"> T[]</span>;</code>
322+
</p>
323+
</div>
324+
<h2 class="doc_headers">
325+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
326+
<svg
327+
xmlns="http://www.w3.org/2000/svg"
328+
width="32"
329+
height="32"
330+
fill="currentColor"
331+
class="bi bi-code-square"
332+
viewBox="0 0 16 16"
333+
>
334+
<path
335+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
336+
/>
337+
<path
338+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
339+
/>
340+
</svg>
341+
</a>
342+
shuffle
343+
</h2>
344+
<p>returns a shuffle array element</p>
345+
<div class="code_div">
346+
<p>
347+
<code><span class="function">shuffle</span>():<span class="type"> T[]</span>;</code>
348+
</p>
349+
</div>
350+
<h2 class="doc_headers">
351+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
352+
<svg
353+
xmlns="http://www.w3.org/2000/svg"
354+
width="32"
355+
height="32"
356+
fill="currentColor"
357+
class="bi bi-code-square"
358+
viewBox="0 0 16 16"
359+
>
360+
<path
361+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
362+
/>
363+
<path
364+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
365+
/>
366+
</svg>
367+
</a>
368+
insert
369+
</h2>
370+
<p>insert an element at a specified index</p>
371+
<div class="code_div">
372+
<p>
373+
<code
374+
><span class="function">insert</span>(<span class="var">elem</span>:
375+
<span class="type">T</span>, <span class="var">index</span>:
376+
<span class="type">number</span>):<span class="key_word"> this</span>;</code
377+
>
378+
</p>
379+
</div>
380+
<h2 class="doc_headers">
381+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
382+
<svg
383+
xmlns="http://www.w3.org/2000/svg"
384+
width="32"
385+
height="32"
386+
fill="currentColor"
387+
class="bi bi-code-square"
388+
viewBox="0 0 16 16"
389+
>
390+
<path
391+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
392+
/>
393+
<path
394+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
395+
/>
396+
</svg>
397+
</a>
398+
count
399+
</h2>
400+
<p>returns total of found items for specified search</p>
401+
<div class="code_div">
402+
<p>
403+
<code
404+
><span class="function">count</span>(<span class="var">search</span>:
405+
<span class="type">RegExp </span>|<span class="type"> any</span>):<span class="type">
406+
number</span
407+
>;</code
408+
>
409+
</p>
410+
</div>
411+
<h2 class="doc_headers">
412+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
413+
<svg
414+
xmlns="http://www.w3.org/2000/svg"
415+
width="32"
416+
height="32"
417+
fill="currentColor"
418+
class="bi bi-code-square"
419+
viewBox="0 0 16 16"
420+
>
421+
<path
422+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
423+
/>
424+
<path
425+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
426+
/>
427+
</svg>
428+
</a>
429+
similarities
430+
</h2>
431+
<p>returns a new array with elements that are both in this array and in the comparison array</p>
432+
<div class="code_div">
433+
<p>
434+
<code
435+
><span class="function">similarities</span>(<span class="var">arr</span>:
436+
<span class="type"> T[]</span>):<span class="type"> number</span>;</code
437+
>
438+
</p>
439+
</div>
440+
<h2 class="doc_headers">
441+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/src/Object.ts">
442+
<svg
443+
xmlns="http://www.w3.org/2000/svg"
444+
width="32"
445+
height="32"
446+
fill="currentColor"
447+
class="bi bi-code-square"
448+
viewBox="0 0 16 16"
449+
>
450+
<path
451+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
452+
/>
453+
<path
454+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
455+
/>
456+
</svg>
457+
</a>
458+
missing
459+
</h2>
460+
<p>returns a new array with elements that are in this array, but are missing in the comparison array</p>
461+
<div class="code_div">
462+
<p>
463+
<code
464+
><span class="function">missing</span>(<span class="var">arr</span>:
465+
<span class="type"> T[]</span>):<span class="type"> number</span>;</code
466+
>
467+
</p>
468+
</div>
469+
<hr />
470+
<h2 class="doc_headers">
471+
<a href="https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/example/Array.js">
472+
<svg
473+
xmlns="http://www.w3.org/2000/svg"
474+
width="32"
475+
height="32"
476+
fill="currentColor"
477+
class="bi bi-code-square"
478+
viewBox="0 0 16 16"
479+
>
480+
<path
481+
d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"
482+
/>
483+
<path
484+
d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z"
485+
/>
486+
</svg> </a
487+
>Examples
488+
</h2>
489+
<div class="code_div_example">
490+
<script src="http://gist-it.appspot.com/https://github.com/Flam3rboy/missing-native-JS-functions/blob/main/example/Array.js"></script>
491+
</div>
492+
</div>
104493
</div>
105494

106495
<script

0 commit comments

Comments
 (0)