From 00f280bd160e6459e1bb0ae3e76e16fbd9485760 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 18 May 2023 23:29:52 +0300 Subject: [PATCH] Rename articles prefixed with `js-` --- collections/js/array-initialization.yaml | 2 +- collections/js/array-methods.yaml | 6 ++--- collections/js/data-structures.yaml | 20 ++++++++-------- collections/js/dom-manipulation.yaml | 2 +- collections/js/dom-querying.yaml | 2 +- collections/js/interviews.yaml | 8 +++---- collections/js/performance.yaml | 8 +++---- collections/js/proxy.yaml | 14 +++++------ collections/js/url.yaml | 6 ++--- snippets/articles/s/big-o-cheatsheet.md | 24 +++++++++---------- snippets/articles/s/cors-explained.md | 2 +- .../js-abort-fetch.md => js/s/abort-fetch.md} | 0 .../s/append-elements-to-array.md} | 0 .../s/array-filtering-tips.md} | 0 .../s/array-initialization.md} | 0 .../s/array-map-vs-foreach.md} | 0 .../s/array-min-max.md} | 0 .../s/array-sorting-shorthand.md} | 0 .../js-async-defer.md => js/s/async-defer.md} | 0 .../s/js-callbacks.md => js/s/callbacks.md} | 0 .../s/cannot-extend-proxy-object.md} | 0 ...compare-string-case-accent-insensitive.md} | 0 .../s/construct-url.md} | 2 +- .../s/create-html-elements.md} | 0 .../s/data-structures-binary-search-tree.md} | 0 .../s/data-structures-binary-tree.md} | 0 .../s/data-structures-doubly-linked-list.md} | 0 .../s/data-structures-graph.md} | 0 .../s/data-structures-linked-list.md} | 0 .../s/data-structures-queue.md} | 0 .../s/data-structures-stack.md} | 0 .../s/data-structures-tree.md} | 0 .../s/decimal-to-hex.md} | 0 .../s/detect-undefined-object-property.md} | 0 .../s/double-negation-operator.md} | 0 .../s/dynamic-getter-chain-proxy.md} | 2 +- .../s/dynamic-getter-setter-proxy.md} | 0 .../s/dynamic-properties-are-slow.md} | 0 .../s/edit-url-params.md} | 0 .../s/element-from-point.md} | 0 .../s/email-validation.md} | 0 .../s/fast-remove-array-element.md} | 0 .../s/frequency-map-data-structure.md} | 0 .../s/immutable-object-proxy.md} | 0 snippets/js/s/iterators.md | 2 +- .../s/last-element-of-array.md} | 0 .../s/locale-sensitive-string-truncation.md} | 0 .../s/map-vs-object.md} | 0 .../s/native-data-structures.md} | 0 .../s/object-freeze-vs-seal.md} | 0 .../s/proxy-array-negative-index.md} | 0 .../s/proxy-introduction.md} | 0 .../s/remove-array-duplicates.md} | 0 .../s/remove-element-from-array.md} | 2 +- .../s/remove-trailing-zeros.md} | 0 .../s/replace-all-occurences-of-string.md} | 0 .../s/spread-operator-tricks.md} | 0 .../s/static-instance-methods.md} | 0 .../s/textcontent-or-innertext.md} | 0 .../s/timeout-interval-delay.md} | 0 .../s/typecheck-array.md} | 0 .../s/typecheck-proxy.md} | 0 .../s/window-location-cheatsheet.md} | 0 63 files changed, 51 insertions(+), 51 deletions(-) rename snippets/{articles/s/js-abort-fetch.md => js/s/abort-fetch.md} (100%) rename snippets/{articles/s/js-append-elements-to-array.md => js/s/append-elements-to-array.md} (100%) rename snippets/{articles/s/js-array-filtering-tips.md => js/s/array-filtering-tips.md} (100%) rename snippets/{articles/s/js-array-initialization.md => js/s/array-initialization.md} (100%) rename snippets/{articles/s/js-array-map-vs-foreach.md => js/s/array-map-vs-foreach.md} (100%) rename snippets/{articles/s/js-array-min-max.md => js/s/array-min-max.md} (100%) rename snippets/{articles/s/js-array-sorting-shorthand.md => js/s/array-sorting-shorthand.md} (100%) rename snippets/{articles/s/js-async-defer.md => js/s/async-defer.md} (100%) rename snippets/{articles/s/js-callbacks.md => js/s/callbacks.md} (100%) rename snippets/{articles/s/js-cannot-extend-proxy-object.md => js/s/cannot-extend-proxy-object.md} (100%) rename snippets/{articles/s/js-compare-string-case-accent-insensitive.md => js/s/compare-string-case-accent-insensitive.md} (100%) rename snippets/{articles/s/js-construct-url.md => js/s/construct-url.md} (95%) rename snippets/{articles/s/js-create-html-elements.md => js/s/create-html-elements.md} (100%) rename snippets/{articles/s/js-data-structures-binary-search-tree.md => js/s/data-structures-binary-search-tree.md} (100%) rename snippets/{articles/s/js-data-structures-binary-tree.md => js/s/data-structures-binary-tree.md} (100%) rename snippets/{articles/s/js-data-structures-doubly-linked-list.md => js/s/data-structures-doubly-linked-list.md} (100%) rename snippets/{articles/s/js-data-structures-graph.md => js/s/data-structures-graph.md} (100%) rename snippets/{articles/s/js-data-structures-linked-list.md => js/s/data-structures-linked-list.md} (100%) rename snippets/{articles/s/js-data-structures-queue.md => js/s/data-structures-queue.md} (100%) rename snippets/{articles/s/js-data-structures-stack.md => js/s/data-structures-stack.md} (100%) rename snippets/{articles/s/js-data-structures-tree.md => js/s/data-structures-tree.md} (100%) rename snippets/{articles/s/js-decimal-to-hex.md => js/s/decimal-to-hex.md} (100%) rename snippets/{articles/s/js-detect-undefined-object-property.md => js/s/detect-undefined-object-property.md} (100%) rename snippets/{articles/s/js-double-negation-operator.md => js/s/double-negation-operator.md} (100%) rename snippets/{articles/s/js-dynamic-getter-chain-proxy.md => js/s/dynamic-getter-chain-proxy.md} (95%) rename snippets/{articles/s/js-dynamic-getter-setter-proxy.md => js/s/dynamic-getter-setter-proxy.md} (100%) rename snippets/{articles/s/js-dynamic-properties-are-slow.md => js/s/dynamic-properties-are-slow.md} (100%) rename snippets/{articles/s/js-edit-url-params.md => js/s/edit-url-params.md} (100%) rename snippets/{articles/s/js-element-from-point.md => js/s/element-from-point.md} (100%) rename snippets/{articles/s/js-email-validation.md => js/s/email-validation.md} (100%) rename snippets/{articles/s/js-fast-remove-array-element.md => js/s/fast-remove-array-element.md} (100%) rename snippets/{articles/s/js-frequency-map-data-structure.md => js/s/frequency-map-data-structure.md} (100%) rename snippets/{articles/s/js-immutable-object-proxy.md => js/s/immutable-object-proxy.md} (100%) rename snippets/{articles/s/js-last-element-of-array.md => js/s/last-element-of-array.md} (100%) rename snippets/{articles/s/js-locale-sensitive-string-truncation.md => js/s/locale-sensitive-string-truncation.md} (100%) rename snippets/{articles/s/js-map-vs-object.md => js/s/map-vs-object.md} (100%) rename snippets/{articles/s/js-native-data-structures.md => js/s/native-data-structures.md} (100%) rename snippets/{articles/s/js-object-freeze-vs-seal.md => js/s/object-freeze-vs-seal.md} (100%) rename snippets/{articles/s/js-proxy-array-negative-index.md => js/s/proxy-array-negative-index.md} (100%) rename snippets/{articles/s/js-proxy-introduction.md => js/s/proxy-introduction.md} (100%) rename snippets/{articles/s/js-remove-array-duplicates.md => js/s/remove-array-duplicates.md} (100%) rename snippets/{articles/s/js-remove-element-from-array.md => js/s/remove-element-from-array.md} (94%) rename snippets/{articles/s/js-remove-trailing-zeros.md => js/s/remove-trailing-zeros.md} (100%) rename snippets/{articles/s/js-replace-all-occurences-of-string.md => js/s/replace-all-occurences-of-string.md} (100%) rename snippets/{articles/s/js-spread-operator-tricks.md => js/s/spread-operator-tricks.md} (100%) rename snippets/{articles/s/js-static-instance-methods.md => js/s/static-instance-methods.md} (100%) rename snippets/{articles/s/js-textcontent-or-innertext.md => js/s/textcontent-or-innertext.md} (100%) rename snippets/{articles/s/js-timeout-interval-delay.md => js/s/timeout-interval-delay.md} (100%) rename snippets/{articles/s/js-typecheck-array.md => js/s/typecheck-array.md} (100%) rename snippets/{articles/s/js-typecheck-proxy.md => js/s/typecheck-proxy.md} (100%) rename snippets/{articles/s/js-window-location-cheatsheet.md => js/s/window-location-cheatsheet.md} (100%) diff --git a/collections/js/array-initialization.yaml b/collections/js/array-initialization.yaml index ce70236c7..2b941567e 100644 --- a/collections/js/array-initialization.yaml +++ b/collections/js/array-initialization.yaml @@ -2,7 +2,7 @@ slug: js/array-initialization name: JavaScript Array Initialization featured: true snippetIds: - - articles/s/js-array-initialization + - js/s/array-initialization - js/s/initialize-array-with-values - js/s/initialize-array-with-range - js/s/initialize-array-with-range-right diff --git a/collections/js/array-methods.yaml b/collections/js/array-methods.yaml index 3a37e5602..3df13c32b 100644 --- a/collections/js/array-methods.yaml +++ b/collections/js/array-methods.yaml @@ -2,15 +2,15 @@ slug: js/array-methods name: JavaScript Array Methods featured: true snippetIds: - - articles/s/js-array-map-vs-foreach + - js/s/array-map-vs-foreach - articles/s/4-javascript-array-methods - js/s/array-comparison - js/s/index-for-of-loop - js/s/for-loop-early-break - - articles/s/js-array-initialization + - js/s/array-initialization - articles/s/code-anatomy-chaining-reduce-for-loop - js/s/async-array-loops - - articles/s/js-typecheck-array + - js/s/typecheck-array splash: laptop-lamp.png description: >- JavaScript arrays offer a lot of data manipulation and transformation methods. diff --git a/collections/js/data-structures.yaml b/collections/js/data-structures.yaml index 06a67cceb..910dc9ef0 100644 --- a/collections/js/data-structures.yaml +++ b/collections/js/data-structures.yaml @@ -4,16 +4,16 @@ miniName: Data Structures parent: js featured: true snippetIds: - - articles/s/js-native-data-structures - - articles/s/js-data-structures-queue - - articles/s/js-data-structures-stack - - articles/s/js-data-structures-linked-list - - articles/s/js-data-structures-doubly-linked-list - - articles/s/js-data-structures-graph - - articles/s/js-data-structures-tree - - articles/s/js-data-structures-binary-tree - - articles/s/js-data-structures-binary-search-tree - - articles/s/js-frequency-map-data-structure + - js/s/native-data-structures + - js/s/data-structures-queue + - js/s/data-structures-stack + - js/s/data-structures-linked-list + - js/s/data-structures-doubly-linked-list + - js/s/data-structures-graph + - js/s/data-structures-tree + - js/s/data-structures-binary-tree + - js/s/data-structures-binary-search-tree + - js/s/frequency-map-data-structure - articles/s/big-o-cheatsheet splash: purple-flower.png description: >- diff --git a/collections/js/dom-manipulation.yaml b/collections/js/dom-manipulation.yaml index c59d3c4c7..4d47acf6e 100644 --- a/collections/js/dom-manipulation.yaml +++ b/collections/js/dom-manipulation.yaml @@ -2,7 +2,7 @@ slug: js/dom-manipulation name: JavaScript DOM Manipulation featured: true snippetIds: - - articles/s/js-create-html-elements + - js/s/create-html-elements - js/s/create-element - js/s/remove-element - js/s/insert-after diff --git a/collections/js/dom-querying.yaml b/collections/js/dom-querying.yaml index c94407e32..e38bfc216 100644 --- a/collections/js/dom-querying.yaml +++ b/collections/js/dom-querying.yaml @@ -13,7 +13,7 @@ snippetIds: - js/s/element-is-visible-in-viewport - articles/s/select-focused-dom-element - js/s/get-elements-bigger-than-viewport - - articles/s/js-element-from-point + - js/s/element-from-point - js/s/element-is-focused - js/s/get-vertical-offset - js/s/store-dom-items diff --git a/collections/js/interviews.yaml b/collections/js/interviews.yaml index e7f5bcdaf..31365e471 100644 --- a/collections/js/interviews.yaml +++ b/collections/js/interviews.yaml @@ -10,7 +10,7 @@ snippetIds: - js/s/undeclared-undefined-null - js/s/variable-hoisting - js/s/variable-scope - - articles/s/js-callbacks + - js/s/callbacks - js/s/pass-by-reference-or-pass-by-value - js/s/promises - js/s/sync-async @@ -21,17 +21,17 @@ snippetIds: - js/s/object-comparison - js/s/array-comparison - js/s/array-includes-value - - articles/s/js-array-map-vs-foreach + - js/s/array-map-vs-foreach - js/s/event-bubbling-capturing-delegation - js/s/value-not-equal-to-itself - js/s/blank-value - js/s/string-immutability - - articles/s/js-static-instance-methods + - js/s/static-instance-methods - js/s/arrow-functions - js/s/pure-functions - js/s/recursion - js/s/use-strict - - articles/s/js-async-defer + - js/s/async-defer - js/s/closures - js/s/iife - js/s/event-loop-explained diff --git a/collections/js/performance.yaml b/collections/js/performance.yaml index 72795c792..2ef835923 100644 --- a/collections/js/performance.yaml +++ b/collections/js/performance.yaml @@ -4,13 +4,13 @@ featured: true snippetIds: - js/s/store-dom-items - articles/s/passive-scroll-listener-performance - - articles/s/js-textcontent-or-innertext + - js/s/textcontent-or-innertext - js/s/memoization - - articles/s/js-array-filtering-tips - - articles/s/js-fast-remove-array-element + - js/s/array-filtering-tips + - js/s/fast-remove-array-element - articles/s/code-anatomy-optimizing-recursion - js/s/switch-object - - articles/s/js-dynamic-properties-are-slow + - js/s/dynamic-properties-are-slow - articles/s/big-o-cheatsheet splash: do-more-computer.png description: >- diff --git a/collections/js/proxy.yaml b/collections/js/proxy.yaml index 3a0e47ba9..4a5076282 100644 --- a/collections/js/proxy.yaml +++ b/collections/js/proxy.yaml @@ -2,15 +2,15 @@ slug: js/proxy name: JavaScript Proxy featured: true snippetIds: - - articles/s/js-proxy-introduction - - articles/s/js-dynamic-getter-setter-proxy - - articles/s/js-immutable-object-proxy + - js/s/proxy-introduction + - js/s/dynamic-getter-setter-proxy + - js/s/immutable-object-proxy - js/s/singleton-proxy - - articles/s/js-dynamic-getter-chain-proxy + - js/s/dynamic-getter-chain-proxy - js/s/object-array-proxy - - articles/s/js-proxy-array-negative-index - - articles/s/js-cannot-extend-proxy-object - - articles/s/js-typecheck-proxy + - js/s/proxy-array-negative-index + - js/s/cannot-extend-proxy-object + - js/s/typecheck-proxy splash: laptop-coffee.png description: >- The JavaScript Proxy object can be a very powerful tool to extend the diff --git a/collections/js/url.yaml b/collections/js/url.yaml index 595e2d76a..d96724984 100644 --- a/collections/js/url.yaml +++ b/collections/js/url.yaml @@ -3,10 +3,10 @@ name: URLs in JavaScript featured: true snippetIds: - js/s/modify-url-without-reload - - articles/s/js-construct-url - - articles/s/js-edit-url-params + - js/s/construct-url + - js/s/edit-url-params - js/s/reload-page - - articles/s/js-window-location-cheatsheet + - js/s/window-location-cheatsheet - js/s/current-url - js/s/https-redirect - js/s/get-url-parameters diff --git a/snippets/articles/s/big-o-cheatsheet.md b/snippets/articles/s/big-o-cheatsheet.md index efc945464..75a38630d 100644 --- a/snippets/articles/s/big-o-cheatsheet.md +++ b/snippets/articles/s/big-o-cheatsheet.md @@ -27,27 +27,27 @@ Different data structures have different time complexities for the same operatio | Data Structure | Access | Search | Insertion | Deletion | | --- | --- | --- | --- | --- | -| [**Array**](/articles/s/js-native-data-structures) | Θ(1) | Θ(n) | Θ(n) | Θ(n) | -| [**Queue**](/articles/s/js-data-structures-queue) | Θ(n) | Θ(n) | Θ(1) | Θ(1) | -| [**Stack**](/articles/s/js-data-structures-stack) | Θ(n) | Θ(n) | Θ(1) | Θ(1) | -| [**Linked List**](/articles/s/js-data-structures-linked-list) | Θ(n) | Θ(n) | Θ(1) | Θ(1) | -| [**Doubly Linked List**](/articles/s/js-data-structures-doubly-linked-list) | Θ(n) | Θ(n) | Θ(1) | Θ(1) | +| [**Array**](/js/s/native-data-structures) | Θ(1) | Θ(n) | Θ(n) | Θ(n) | +| [**Queue**](/js/s/data-structures-queue) | Θ(n) | Θ(n) | Θ(1) | Θ(1) | +| [**Stack**](/js/s/data-structures-stack) | Θ(n) | Θ(n) | Θ(1) | Θ(1) | +| [**Linked List**](/js/s/data-structures-linked-list) | Θ(n) | Θ(n) | Θ(1) | Θ(1) | +| [**Doubly Linked List**](/js/s/data-structures-doubly-linked-list) | Θ(n) | Θ(n) | Θ(1) | Θ(1) | | **Skip List** | Θ(log n) | Θ(log n) | Θ(log n) | Θ(log n) | | **Hash Table** | N/A | Θ(1) | Θ(1) | Θ(1) | -| [**Binary Search Tree**](/articles/s/js-data-structures-binary-search-tree) | Θ(log n) | Θ(log n) | Θ(log n) | Θ(log n) | +| [**Binary Search Tree**](/js/s/data-structures-binary-search-tree) | Θ(log n) | Θ(log n) | Θ(log n) | Θ(log n) | #### Worst time complexity | Data Structure | Access | Search | Insertion | Deletion | | --- | --- | --- | --- | --- | -| [**Array**](/articles/s/js-native-data-structures) | O(1) | O(n) | O(n) | O(n) | -| [**Queue**](/articles/s/js-data-structures-queue) | O(n) | O(n) | O(1) | O(1) | -| [**Stack**](/articles/s/js-data-structures-stack) | O(n) | O(n) | O(1) | O(1) | -| [**Linked List**](/articles/s/js-data-structures-linked-list) | O(n) | O(n) | O(1) | O(1) | -| [**Doubly Linked List**](/articles/s/js-data-structures-doubly-linked-list) | O(n) | O(n) | O(1) | O(1) | +| [**Array**](/js/s/native-data-structures) | O(1) | O(n) | O(n) | O(n) | +| [**Queue**](/js/s/data-structures-queue) | O(n) | O(n) | O(1) | O(1) | +| [**Stack**](/js/s/data-structures-stack) | O(n) | O(n) | O(1) | O(1) | +| [**Linked List**](/js/s/data-structures-linked-list) | O(n) | O(n) | O(1) | O(1) | +| [**Doubly Linked List**](/js/s/data-structures-doubly-linked-list) | O(n) | O(n) | O(1) | O(1) | | **Skip List** | O(n) | O(n) | O(n) | O(n) | | **Hash Table** | N/A | O(n) | O(n) | O(n) | -| [**Binary Search Tree**](/articles/s/js-data-structures-binary-search-tree) | O(n) | O(n) | O(n) | O(n) | +| [**Binary Search Tree**](/js/s/data-structures-binary-search-tree) | O(n) | O(n) | O(n) | O(n) | ### Array sorting algorithms diff --git a/snippets/articles/s/cors-explained.md b/snippets/articles/s/cors-explained.md index b6df95bbe..7aa1eb630 100644 --- a/snippets/articles/s/cors-explained.md +++ b/snippets/articles/s/cors-explained.md @@ -10,7 +10,7 @@ excerpt: CORS (Cross-Origin Resource Sharing) trips up many developers, but it's dateModified: 2023-05-07T05:00:00-04:00 --- -When it comes to HTTP, an **origin** is defined by several different aspects of a URL. As mentioned in a [previous article](/articles/s/js-window-location-cheatsheet/), the origin is composed of the following: +When it comes to HTTP, an **origin** is defined by several different aspects of a URL. As mentioned in a [previous article](/js/s/window-location-cheatsheet/), the origin is composed of the following: - The **protocol** (e.g. `http` or `https`) - The **hostname** (e.g. `30secondsofcode.org`) diff --git a/snippets/articles/s/js-abort-fetch.md b/snippets/js/s/abort-fetch.md similarity index 100% rename from snippets/articles/s/js-abort-fetch.md rename to snippets/js/s/abort-fetch.md diff --git a/snippets/articles/s/js-append-elements-to-array.md b/snippets/js/s/append-elements-to-array.md similarity index 100% rename from snippets/articles/s/js-append-elements-to-array.md rename to snippets/js/s/append-elements-to-array.md diff --git a/snippets/articles/s/js-array-filtering-tips.md b/snippets/js/s/array-filtering-tips.md similarity index 100% rename from snippets/articles/s/js-array-filtering-tips.md rename to snippets/js/s/array-filtering-tips.md diff --git a/snippets/articles/s/js-array-initialization.md b/snippets/js/s/array-initialization.md similarity index 100% rename from snippets/articles/s/js-array-initialization.md rename to snippets/js/s/array-initialization.md diff --git a/snippets/articles/s/js-array-map-vs-foreach.md b/snippets/js/s/array-map-vs-foreach.md similarity index 100% rename from snippets/articles/s/js-array-map-vs-foreach.md rename to snippets/js/s/array-map-vs-foreach.md diff --git a/snippets/articles/s/js-array-min-max.md b/snippets/js/s/array-min-max.md similarity index 100% rename from snippets/articles/s/js-array-min-max.md rename to snippets/js/s/array-min-max.md diff --git a/snippets/articles/s/js-array-sorting-shorthand.md b/snippets/js/s/array-sorting-shorthand.md similarity index 100% rename from snippets/articles/s/js-array-sorting-shorthand.md rename to snippets/js/s/array-sorting-shorthand.md diff --git a/snippets/articles/s/js-async-defer.md b/snippets/js/s/async-defer.md similarity index 100% rename from snippets/articles/s/js-async-defer.md rename to snippets/js/s/async-defer.md diff --git a/snippets/articles/s/js-callbacks.md b/snippets/js/s/callbacks.md similarity index 100% rename from snippets/articles/s/js-callbacks.md rename to snippets/js/s/callbacks.md diff --git a/snippets/articles/s/js-cannot-extend-proxy-object.md b/snippets/js/s/cannot-extend-proxy-object.md similarity index 100% rename from snippets/articles/s/js-cannot-extend-proxy-object.md rename to snippets/js/s/cannot-extend-proxy-object.md diff --git a/snippets/articles/s/js-compare-string-case-accent-insensitive.md b/snippets/js/s/compare-string-case-accent-insensitive.md similarity index 100% rename from snippets/articles/s/js-compare-string-case-accent-insensitive.md rename to snippets/js/s/compare-string-case-accent-insensitive.md diff --git a/snippets/articles/s/js-construct-url.md b/snippets/js/s/construct-url.md similarity index 95% rename from snippets/articles/s/js-construct-url.md rename to snippets/js/s/construct-url.md index 1ff3793fe..066d69e05 100644 --- a/snippets/articles/s/js-construct-url.md +++ b/snippets/js/s/construct-url.md @@ -63,4 +63,4 @@ url.toString(); Admittedly, using the `URL` object can be a bit more verbose, but it's a worthwhile tradeoff. The code is much more readable and maintainable, and it's less prone to errors. Query parameters are now encoded properly, and delimiters are added automatically. -While query parameters are the most common issue when dealing with URLs, the `URL` object can be useful in many other situations. For example, you can change the protocol, hostname, port, path, hash, etc. of a URL, or even parse an existing URL into its components. If you're interested, you should check out previous articles about how you can [edit URL parameters](/articles/s/js-edit-url-params) and the [`window.location` cheat sheet](/articles/s/js-window-location-cheatsheet). +While query parameters are the most common issue when dealing with URLs, the `URL` object can be useful in many other situations. For example, you can change the protocol, hostname, port, path, hash, etc. of a URL, or even parse an existing URL into its components. If you're interested, you should check out previous articles about how you can [edit URL parameters](/js/s/edit-url-params) and the [`window.location` cheat sheet](/js/s/window-location-cheatsheet). diff --git a/snippets/articles/s/js-create-html-elements.md b/snippets/js/s/create-html-elements.md similarity index 100% rename from snippets/articles/s/js-create-html-elements.md rename to snippets/js/s/create-html-elements.md diff --git a/snippets/articles/s/js-data-structures-binary-search-tree.md b/snippets/js/s/data-structures-binary-search-tree.md similarity index 100% rename from snippets/articles/s/js-data-structures-binary-search-tree.md rename to snippets/js/s/data-structures-binary-search-tree.md diff --git a/snippets/articles/s/js-data-structures-binary-tree.md b/snippets/js/s/data-structures-binary-tree.md similarity index 100% rename from snippets/articles/s/js-data-structures-binary-tree.md rename to snippets/js/s/data-structures-binary-tree.md diff --git a/snippets/articles/s/js-data-structures-doubly-linked-list.md b/snippets/js/s/data-structures-doubly-linked-list.md similarity index 100% rename from snippets/articles/s/js-data-structures-doubly-linked-list.md rename to snippets/js/s/data-structures-doubly-linked-list.md diff --git a/snippets/articles/s/js-data-structures-graph.md b/snippets/js/s/data-structures-graph.md similarity index 100% rename from snippets/articles/s/js-data-structures-graph.md rename to snippets/js/s/data-structures-graph.md diff --git a/snippets/articles/s/js-data-structures-linked-list.md b/snippets/js/s/data-structures-linked-list.md similarity index 100% rename from snippets/articles/s/js-data-structures-linked-list.md rename to snippets/js/s/data-structures-linked-list.md diff --git a/snippets/articles/s/js-data-structures-queue.md b/snippets/js/s/data-structures-queue.md similarity index 100% rename from snippets/articles/s/js-data-structures-queue.md rename to snippets/js/s/data-structures-queue.md diff --git a/snippets/articles/s/js-data-structures-stack.md b/snippets/js/s/data-structures-stack.md similarity index 100% rename from snippets/articles/s/js-data-structures-stack.md rename to snippets/js/s/data-structures-stack.md diff --git a/snippets/articles/s/js-data-structures-tree.md b/snippets/js/s/data-structures-tree.md similarity index 100% rename from snippets/articles/s/js-data-structures-tree.md rename to snippets/js/s/data-structures-tree.md diff --git a/snippets/articles/s/js-decimal-to-hex.md b/snippets/js/s/decimal-to-hex.md similarity index 100% rename from snippets/articles/s/js-decimal-to-hex.md rename to snippets/js/s/decimal-to-hex.md diff --git a/snippets/articles/s/js-detect-undefined-object-property.md b/snippets/js/s/detect-undefined-object-property.md similarity index 100% rename from snippets/articles/s/js-detect-undefined-object-property.md rename to snippets/js/s/detect-undefined-object-property.md diff --git a/snippets/articles/s/js-double-negation-operator.md b/snippets/js/s/double-negation-operator.md similarity index 100% rename from snippets/articles/s/js-double-negation-operator.md rename to snippets/js/s/double-negation-operator.md diff --git a/snippets/articles/s/js-dynamic-getter-chain-proxy.md b/snippets/js/s/dynamic-getter-chain-proxy.md similarity index 95% rename from snippets/articles/s/js-dynamic-getter-chain-proxy.md rename to snippets/js/s/dynamic-getter-chain-proxy.md index a6c8d4eca..f4c202fce 100644 --- a/snippets/articles/s/js-dynamic-getter-chain-proxy.md +++ b/snippets/js/s/dynamic-getter-chain-proxy.md @@ -12,7 +12,7 @@ dateModified: 2023-05-28T05:00:00-04:00 The dawn of ES6 brought about jQuery's fall from grace, as a lot of the conveniences it afforded developers were now available in the language itself. However, jQuery's API design was convenient in many ways that native JavaScript often isn't. One of the most practical things jQuery offered was its ability to chain methods together, minimizing duplication and making code more readable. -Looking at the use case at hand, I thought that I could stitch together a general-purpose solution using JavaScript's `Proxy` object. In fact, I think that the concept of dynamic getters and setters that I described in [my previous post](/articles/s/js-dynamic-getter-setter-proxy) is a great place to start. +Looking at the use case at hand, I thought that I could stitch together a general-purpose solution using JavaScript's `Proxy` object. In fact, I think that the concept of dynamic getters and setters that I described in [my previous post](/js/s/dynamic-getter-setter-proxy) is a great place to start. To recap, intercepting the behavior of the `get` and `set` traps of a `Proxy` object allows us to create dynamic accessors for objects. This is particularly useful when the shape of the data is not known in advance, or when the value of a property needs to be manipulated before it is returned. diff --git a/snippets/articles/s/js-dynamic-getter-setter-proxy.md b/snippets/js/s/dynamic-getter-setter-proxy.md similarity index 100% rename from snippets/articles/s/js-dynamic-getter-setter-proxy.md rename to snippets/js/s/dynamic-getter-setter-proxy.md diff --git a/snippets/articles/s/js-dynamic-properties-are-slow.md b/snippets/js/s/dynamic-properties-are-slow.md similarity index 100% rename from snippets/articles/s/js-dynamic-properties-are-slow.md rename to snippets/js/s/dynamic-properties-are-slow.md diff --git a/snippets/articles/s/js-edit-url-params.md b/snippets/js/s/edit-url-params.md similarity index 100% rename from snippets/articles/s/js-edit-url-params.md rename to snippets/js/s/edit-url-params.md diff --git a/snippets/articles/s/js-element-from-point.md b/snippets/js/s/element-from-point.md similarity index 100% rename from snippets/articles/s/js-element-from-point.md rename to snippets/js/s/element-from-point.md diff --git a/snippets/articles/s/js-email-validation.md b/snippets/js/s/email-validation.md similarity index 100% rename from snippets/articles/s/js-email-validation.md rename to snippets/js/s/email-validation.md diff --git a/snippets/articles/s/js-fast-remove-array-element.md b/snippets/js/s/fast-remove-array-element.md similarity index 100% rename from snippets/articles/s/js-fast-remove-array-element.md rename to snippets/js/s/fast-remove-array-element.md diff --git a/snippets/articles/s/js-frequency-map-data-structure.md b/snippets/js/s/frequency-map-data-structure.md similarity index 100% rename from snippets/articles/s/js-frequency-map-data-structure.md rename to snippets/js/s/frequency-map-data-structure.md diff --git a/snippets/articles/s/js-immutable-object-proxy.md b/snippets/js/s/immutable-object-proxy.md similarity index 100% rename from snippets/articles/s/js-immutable-object-proxy.md rename to snippets/js/s/immutable-object-proxy.md diff --git a/snippets/js/s/iterators.md b/snippets/js/s/iterators.md index b8d5cd7a9..d7ea905c5 100644 --- a/snippets/js/s/iterators.md +++ b/snippets/js/s/iterators.md @@ -54,7 +54,7 @@ for (let item of myList) { } ``` -In the above example, we implement a [`LinkedList` data structure](/articles/s/js-data-structures-linked-list), that internally uses a `data` array. Each item in it has a `value` and some implementation-specific properties used to determine its position in the sequence. Objects constructed from this class are not iterable by default. To define an iterator we use `Symbol.iterator` and set it up so that the returned sequence is in order based on the internal implementation of the class, while the returned items only return their `value`. +In the above example, we implement a [`LinkedList` data structure](/js/s/data-structures-linked-list), that internally uses a `data` array. Each item in it has a `value` and some implementation-specific properties used to determine its position in the sequence. Objects constructed from this class are not iterable by default. To define an iterator we use `Symbol.iterator` and set it up so that the returned sequence is in order based on the internal implementation of the class, while the returned items only return their `value`. On a related note, iterators are just functions, meaning they can be called like any other function (e.g. to delegate the iteration to an existing iterator), while also not being restricted to the `Symbol.iterator` name. This allows us to define multiple iterators for the same object. Here's an example of these concepts at play: diff --git a/snippets/articles/s/js-last-element-of-array.md b/snippets/js/s/last-element-of-array.md similarity index 100% rename from snippets/articles/s/js-last-element-of-array.md rename to snippets/js/s/last-element-of-array.md diff --git a/snippets/articles/s/js-locale-sensitive-string-truncation.md b/snippets/js/s/locale-sensitive-string-truncation.md similarity index 100% rename from snippets/articles/s/js-locale-sensitive-string-truncation.md rename to snippets/js/s/locale-sensitive-string-truncation.md diff --git a/snippets/articles/s/js-map-vs-object.md b/snippets/js/s/map-vs-object.md similarity index 100% rename from snippets/articles/s/js-map-vs-object.md rename to snippets/js/s/map-vs-object.md diff --git a/snippets/articles/s/js-native-data-structures.md b/snippets/js/s/native-data-structures.md similarity index 100% rename from snippets/articles/s/js-native-data-structures.md rename to snippets/js/s/native-data-structures.md diff --git a/snippets/articles/s/js-object-freeze-vs-seal.md b/snippets/js/s/object-freeze-vs-seal.md similarity index 100% rename from snippets/articles/s/js-object-freeze-vs-seal.md rename to snippets/js/s/object-freeze-vs-seal.md diff --git a/snippets/articles/s/js-proxy-array-negative-index.md b/snippets/js/s/proxy-array-negative-index.md similarity index 100% rename from snippets/articles/s/js-proxy-array-negative-index.md rename to snippets/js/s/proxy-array-negative-index.md diff --git a/snippets/articles/s/js-proxy-introduction.md b/snippets/js/s/proxy-introduction.md similarity index 100% rename from snippets/articles/s/js-proxy-introduction.md rename to snippets/js/s/proxy-introduction.md diff --git a/snippets/articles/s/js-remove-array-duplicates.md b/snippets/js/s/remove-array-duplicates.md similarity index 100% rename from snippets/articles/s/js-remove-array-duplicates.md rename to snippets/js/s/remove-array-duplicates.md diff --git a/snippets/articles/s/js-remove-element-from-array.md b/snippets/js/s/remove-element-from-array.md similarity index 94% rename from snippets/articles/s/js-remove-element-from-array.md rename to snippets/js/s/remove-element-from-array.md index adf0c2b7d..d407b82a1 100644 --- a/snippets/articles/s/js-remove-element-from-array.md +++ b/snippets/js/s/remove-element-from-array.md @@ -40,5 +40,5 @@ Most of the time, `Array.prototype.filter()` is the best option for removing ele ### Alternative options -The previous two options should cover the vast majority of use cases. Yet, there are some other options available for removing elements from an array, which might be preferable in certain cases. For example, if you like the interface of `Array.prototype.splice()` but need immutability, the [shank snippet](/js/s/shank) might be the solution for you. Similarly, when working with large unsorted arrays, there's a [fast removal trick](/articles/s/js-fast-remove-array-element) that might be of interest to you. +The previous two options should cover the vast majority of use cases. Yet, there are some other options available for removing elements from an array, which might be preferable in certain cases. For example, if you like the interface of `Array.prototype.splice()` but need immutability, the [shank snippet](/js/s/shank) might be the solution for you. Similarly, when working with large unsorted arrays, there's a [fast removal trick](/js/s/fast-remove-array-element) that might be of interest to you. diff --git a/snippets/articles/s/js-remove-trailing-zeros.md b/snippets/js/s/remove-trailing-zeros.md similarity index 100% rename from snippets/articles/s/js-remove-trailing-zeros.md rename to snippets/js/s/remove-trailing-zeros.md diff --git a/snippets/articles/s/js-replace-all-occurences-of-string.md b/snippets/js/s/replace-all-occurences-of-string.md similarity index 100% rename from snippets/articles/s/js-replace-all-occurences-of-string.md rename to snippets/js/s/replace-all-occurences-of-string.md diff --git a/snippets/articles/s/js-spread-operator-tricks.md b/snippets/js/s/spread-operator-tricks.md similarity index 100% rename from snippets/articles/s/js-spread-operator-tricks.md rename to snippets/js/s/spread-operator-tricks.md diff --git a/snippets/articles/s/js-static-instance-methods.md b/snippets/js/s/static-instance-methods.md similarity index 100% rename from snippets/articles/s/js-static-instance-methods.md rename to snippets/js/s/static-instance-methods.md diff --git a/snippets/articles/s/js-textcontent-or-innertext.md b/snippets/js/s/textcontent-or-innertext.md similarity index 100% rename from snippets/articles/s/js-textcontent-or-innertext.md rename to snippets/js/s/textcontent-or-innertext.md diff --git a/snippets/articles/s/js-timeout-interval-delay.md b/snippets/js/s/timeout-interval-delay.md similarity index 100% rename from snippets/articles/s/js-timeout-interval-delay.md rename to snippets/js/s/timeout-interval-delay.md diff --git a/snippets/articles/s/js-typecheck-array.md b/snippets/js/s/typecheck-array.md similarity index 100% rename from snippets/articles/s/js-typecheck-array.md rename to snippets/js/s/typecheck-array.md diff --git a/snippets/articles/s/js-typecheck-proxy.md b/snippets/js/s/typecheck-proxy.md similarity index 100% rename from snippets/articles/s/js-typecheck-proxy.md rename to snippets/js/s/typecheck-proxy.md diff --git a/snippets/articles/s/js-window-location-cheatsheet.md b/snippets/js/s/window-location-cheatsheet.md similarity index 100% rename from snippets/articles/s/js-window-location-cheatsheet.md rename to snippets/js/s/window-location-cheatsheet.md