chunk_id
stringlengths
36
36
source
stringclasses
35 values
source_url
stringlengths
0
290
upstream_license
stringclasses
1 value
document_id
stringlengths
36
36
chunk_index
int64
0
324k
retrieved_at
stringclasses
2 values
chunker_version
stringclasses
4 values
content_hash
stringlengths
15
64
content
stringlengths
50
44.7k
namespace
stringclasses
9 values
source_name
stringclasses
35 values
raw_text
stringlengths
50
44.7k
cleaned_text
stringlengths
50
44.7k
tags
stringclasses
49 values
collection_name
stringclasses
11 values
b241e3d7-8ded-4dbb-9368-cb9e0a49266e
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-2.md
unknown
dda1ab2a-c742-4a3f-bfae-1d45f7c36c29
8
SemanticChunker@1.0.0
aec2f101746bb98f5d7691a3035a719211f209674c10ef7d18b31e53d8f70850
[Running the code > Running the nodes] Object.entries(paramsWithDefaults).forEach(([key, defaultValue]) => { this[key] = params[key] || defaultValue; }); this.instruction = nodeTypes[type].createInstruction(this); } } } export default ASTNode; ``` Not much of a change, except for semantics. The `Runner` can n...
unknown
unknown
[Running the code > Running the nodes] Object.entries(paramsWithDefaults).forEach(([key, defaultValue]) => { this[key] = params[key] || defaultValue; }); this.instruction = nodeTypes[type].createInstruction(this); } } } export default ASTNode; ``` Not much of a change, except for semantics. The `Runner` can n...
[Running the code > Running the nodes] Object.entries(paramsWithDefaults).forEach(([key, defaultValue]) => { this[key] = params[key] || defaultValue; }); this.instruction = nodeTypes[type].createInstruction(this); } } } export default ASTNode; ``` Not much of a change, except for semantics. The `Runner` can n...
code_snippets
bd8a43a5-5883-4a3e-921f-e4c2c06efc3a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-2.md
unknown
dda1ab2a-c742-4a3f-bfae-1d45f7c36c29
6
SemanticChunker@1.0.0
6ad547a6dec581b966fa2539dcb20366a1c3ca924ac5b8d2cc863c23330ec84f
[Running the code > Running instructions] ### Running instructions The `Runner` class will be given **instructions** in the form of functions. These will correspond to the various `ASTNode` types, but we'll make sure to pass the `Runner` instance to them, so they can delegate responsibility to it. The runner will the...
unknown
unknown
[Running the code > Running instructions] ### Running instructions The `Runner` class will be given **instructions** in the form of functions. These will correspond to the various `ASTNode` types, but we'll make sure to pass the `Runner` instance to them, so they can delegate responsibility to it. The runner will the...
[Running the code > Running instructions] ### Running instructions The `Runner` class will be given **instructions** in the form of functions. These will correspond to the various `ASTNode` types, but we'll make sure to pass the `Runner` instance to them, so they can delegate responsibility to it. The runner will the...
code_snippets
cfa181a0-28b1-4160-bdac-59fd22bb2774
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-2.md
unknown
dda1ab2a-c742-4a3f-bfae-1d45f7c36c29
11
SemanticChunker@1.0.0
96093cde57aef15b448c829979b3dfc4c7bb1599edebcea668700b917fe90439
[Running the code > Executer] ``` We can pass a file pointing to an **AST as input** or use some of the **options** for the code parsing and input, instead. The options are as follows: - `--input` or `-i` to provide input for the program - `--memory` or `-m` to provide initial memory - `--debug` or `-d` to enable de...
unknown
unknown
[Running the code > Executer] ``` We can pass a file pointing to an **AST as input** or use some of the **options** for the code parsing and input, instead. The options are as follows: - `--input` or `-i` to provide input for the program - `--memory` or `-m` to provide initial memory - `--debug` or `-d` to enable de...
[Running the code > Executer] ``` We can pass a file pointing to an **AST as input** or use some of the **options** for the code parsing and input, instead. The options are as follows: - `--input` or `-i` to provide input for the program - `--memory` or `-m` to provide initial memory - `--debug` or `-d` to enable de...
code_snippets
d1bd1358-68ba-42a8-a525-c5910f4ef249
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-2.md
unknown
dda1ab2a-c742-4a3f-bfae-1d45f7c36c29
3
SemanticChunker@1.0.0
0b27458a82cba54cf17d8acbdb20f2b4cf8514b0deb2d0d428c240b1ce267676
[The interpreter > Runner responsibilities] get hasExceededInstructionCount() { return this.instructionCounter > this.maxInstructionCount; } stop() { this.#terminate('Stopped'); } #terminate(error = null) { this.#hasTerminated = true; const status = error ? 1 : 0; const message = error ?? 'Success'; if (...
unknown
unknown
[The interpreter > Runner responsibilities] get hasExceededInstructionCount() { return this.instructionCounter > this.maxInstructionCount; } stop() { this.#terminate('Stopped'); } #terminate(error = null) { this.#hasTerminated = true; const status = error ? 1 : 0; const message = error ?? 'Success'; if (...
[The interpreter > Runner responsibilities] get hasExceededInstructionCount() { return this.instructionCounter > this.maxInstructionCount; } stop() { this.#terminate('Stopped'); } #terminate(error = null) { this.#hasTerminated = true; const status = error ? 1 : 0; const message = error ?? 'Success'; if (...
code_snippets
d3f8a11c-be35-452f-97bb-f96812a0c071
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-2.md
unknown
dda1ab2a-c742-4a3f-bfae-1d45f7c36c29
12
SemanticChunker@1.0.0
b78b6f875eaa6d376390e39cd017c6c98701c4a97b29dae9121fab50672f7059
[The interpreter > Conclusion] ## Conclusion Wow! That was quite a long journey, but we've finally reached the end. We've built a **Brainfuck interpreter** from the ground up, using **Abstract Syntax Trees** to represent the program and a simple **virtual machine** to execute it. We've also added some **command-line ...
unknown
unknown
[The interpreter > Conclusion] ## Conclusion Wow! That was quite a long journey, but we've finally reached the end. We've built a **Brainfuck interpreter** from the ground up, using **Abstract Syntax Trees** to represent the program and a simple **virtual machine** to execute it. We've also added some **command-line ...
[The interpreter > Conclusion] ## Conclusion Wow! That was quite a long journey, but we've finally reached the end. We've built a **Brainfuck interpreter** from the ground up, using **Abstract Syntax Trees** to represent the program and a simple **virtual machine** to execute it. We've also added some **command-line ...
code_snippets
5dee2222-0d94-48eb-9efb-540b17352309
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/bubble-sort.md
unknown
2e841417-b6e9-4862-af1d-c9867683a172
0
SemanticChunker@1.0.0
ba9c549a4ba90dbc723ddd0bf2c74b1af17af7fe9ad6862c85471a9b10d70269
[Definition] ## Definition [Bubble sort](https://en.wikipedia.org/wiki/Bubble_sort) is a simple **sorting algorithm** that repeatedly **steps through** the array, **compares** adjacent elements and **swaps** them if they are in the wrong order. The pass through the array is **repeated** until the array is sorted.
unknown
unknown
[Definition] ## Definition [Bubble sort](https://en.wikipedia.org/wiki/Bubble_sort) is a simple **sorting algorithm** that repeatedly **steps through** the array, **compares** adjacent elements and **swaps** them if they are in the wrong order. The pass through the array is **repeated** until the array is sorted.
[Definition] ## Definition [Bubble sort](https://en.wikipedia.org/wiki/Bubble_sort) is a simple **sorting algorithm** that repeatedly **steps through** the array, **compares** adjacent elements and **swaps** them if they are in the wrong order. The pass through the array is **repeated** until the array is sorted.
code_snippets
b93a4af9-d7aa-43e7-81c6-c3fd6953a89e
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/bubble-sort.md
unknown
2e841417-b6e9-4862-af1d-c9867683a172
1
SemanticChunker@1.0.0
a661ca144eaf1ed5eafebe7ef7f5f82b4285a7948c5104bc751cc4aa90652e00
[Definition > Implementation] ## Implementation - Declare a variable, `swapped`, that indicates if any values were swapped during the current iteration. - Use the spread operator (`...`) to clone the original array, `arr`. - Use a `for` loop to iterate over the elements of the cloned array, terminating before the las...
unknown
unknown
[Definition > Implementation] ## Implementation - Declare a variable, `swapped`, that indicates if any values were swapped during the current iteration. - Use the spread operator (`...`) to clone the original array, `arr`. - Use a `for` loop to iterate over the elements of the cloned array, terminating before the las...
[Definition > Implementation] ## Implementation - Declare a variable, `swapped`, that indicates if any values were swapped during the current iteration. - Use the spread operator (`...`) to clone the original array, `arr`. - Use a `for` loop to iterate over the elements of the cloned array, terminating before the las...
code_snippets
eac6f9a6-b61b-464b-bae1-cc4c2e6b83b9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/bucket-sort.md
unknown
6fdeda70-f59d-4c7b-b894-2233a2dd3bd9
1
SemanticChunker@1.0.0
1bec1b789d70edf408f09ad20fd72f39ee6749575f096af629563543b8abf543
[Implementation > Complexity] ## Complexity The algorithm has an [average time complexity](/js/s/big-o-cheatsheet#array-sorting-algorithms) of `O(n + k)`, where `n` is the size of the input array and `k` is the number of buckets.
unknown
unknown
[Implementation > Complexity] ## Complexity The algorithm has an [average time complexity](/js/s/big-o-cheatsheet#array-sorting-algorithms) of `O(n + k)`, where `n` is the size of the input array and `k` is the number of buckets.
[Implementation > Complexity] ## Complexity The algorithm has an [average time complexity](/js/s/big-o-cheatsheet#array-sorting-algorithms) of `O(n + k)`, where `n` is the size of the input array and `k` is the number of buckets.
code_snippets
fcabf952-6195-47e7-9d3d-3a2e645963cc
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/bucket-sort.md
unknown
6fdeda70-f59d-4c7b-b894-2233a2dd3bd9
0
SemanticChunker@1.0.0
ca3c2bbc6faffa8a30ebe49dc086247dddcb963f700df86be26d386c2b257295
[Implementation] ## Implementation - Use `Math.min()`, `Math.max()` and the spread operator (`...`) to find the minimum and maximum values of the given array. - Use `Array.from()` and `Math.floor()` to create the appropriate number of `buckets` (empty arrays). - Use `Array.prototype.forEach()` to populate each bucket...
unknown
unknown
[Implementation] ## Implementation - Use `Math.min()`, `Math.max()` and the spread operator (`...`) to find the minimum and maximum values of the given array. - Use `Array.from()` and `Math.floor()` to create the appropriate number of `buckets` (empty arrays). - Use `Array.prototype.forEach()` to populate each bucket...
[Implementation] ## Implementation - Use `Math.min()`, `Math.max()` and the spread operator (`...`) to find the minimum and maximum values of the given array. - Use `Array.from()` and `Math.floor()` to create the appropriate number of `buckets` (empty arrays). - Use `Array.prototype.forEach()` to populate each bucket...
code_snippets
77025043-cb7b-4d1a-afc9-697d7838fe12
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/boolean-function.md
unknown
b3ff33cc-48ce-476e-b57c-f1e4ba14ca0c
2
SemanticChunker@1.0.0
9cfefdfee517cae22f4d5516ddace83a083336d9cd8bbae0c8a2e89986b70efc
[Using Boolean for truth-checking > Handle Boolean objects with care] ## Handle Boolean objects with care While the `Boolean()` function is pretty useful, you might run into some issues with the `Boolean` object and the `Boolean` constructor. The `Boolean` object is an object wrapper for a boolean value, but the tric...
unknown
unknown
[Using Boolean for truth-checking > Handle Boolean objects with care] ## Handle Boolean objects with care While the `Boolean()` function is pretty useful, you might run into some issues with the `Boolean` object and the `Boolean` constructor. The `Boolean` object is an object wrapper for a boolean value, but the tric...
[Using Boolean for truth-checking > Handle Boolean objects with care] ## Handle Boolean objects with care While the `Boolean()` function is pretty useful, you might run into some issues with the `Boolean` object and the `Boolean` constructor. The `Boolean` object is an object wrapper for a boolean value, but the tric...
code_snippets
b77fa6a1-392b-4141-9798-0dfd1bc2ff7c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/boolean-function.md
unknown
b3ff33cc-48ce-476e-b57c-f1e4ba14ca0c
1
SemanticChunker@1.0.0
6eba9ab672542ba3ee381d3de3c18c5a30a333e7c94e01dce7ae00f413f7c625
[Using Boolean for truth-checking] ## Using Boolean for truth-checking The `Boolean()` function is particularly useful when truth-checking data and probably significantly more readable than the double negation (`!!`) operation: ```js let x = 'some-value'; // This doesn't look too nice if (!!x) { // ... } // This ...
unknown
unknown
[Using Boolean for truth-checking] ## Using Boolean for truth-checking The `Boolean()` function is particularly useful when truth-checking data and probably significantly more readable than the double negation (`!!`) operation: ```js let x = 'some-value'; // This doesn't look too nice if (!!x) { // ... } // This ...
[Using Boolean for truth-checking] ## Using Boolean for truth-checking The `Boolean()` function is particularly useful when truth-checking data and probably significantly more readable than the double negation (`!!`) operation: ```js let x = 'some-value'; // This doesn't look too nice if (!!x) { // ... } // This ...
code_snippets
d7d20d57-4854-40d8-b717-c5ed348cc905
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/boolean-function.md
unknown
b3ff33cc-48ce-476e-b57c-f1e4ba14ca0c
0
SemanticChunker@1.0.0
73b202fbf389c23a9981c56bed0239e7729e2b80531763269ab15cf315cba4dd
--- title: Where and how can I use the Boolean function in JavaScript? shortTitle: Boolean function use-cases language: javascript tags: [function,type] cover: rocky-lake excerpt: JavaScript's Boolean function can be used for truth-checking data among other things. Learn how to use it and level up your code today. list...
unknown
unknown
--- title: Where and how can I use the Boolean function in JavaScript? shortTitle: Boolean function use-cases language: javascript tags: [function,type] cover: rocky-lake excerpt: JavaScript's Boolean function can be used for truth-checking data among other things. Learn how to use it and level up your code today. list...
--- title: Where and how can I use the Boolean function in JavaScript? shortTitle: Boolean function use-cases language: javascript tags: [function,type] cover: rocky-lake excerpt: JavaScript's Boolean function can be used for truth-checking data among other things. Learn how to use it and level up your code today. list...
code_snippets
685db6a4-4ad6-41ba-9441-f635e8ab0c94
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/blank-value.md
unknown
124ac06e-24c1-49c1-8c5e-8feb61d9f280
1
SemanticChunker@1.0.0
424b1ee55f7b73115276e892acb9e2918f8db115e265d6b3f716078de90750b9
```js const isInvalidDate = value => value instanceof Date && Number.isNaN(value.getTime()); const isEmptySet = value => value instanceof Set && value.size === 0; const isEmptyMap = value => value instanceof Map && value.size === 0; isInvalidDate(new Date('hello')); // true isEmptySet(new Set()); // true isEmptyMap(n...
unknown
unknown
```js const isInvalidDate = value => value instanceof Date && Number.isNaN(value.getTime()); const isEmptySet = value => value instanceof Set && value.size === 0; const isEmptyMap = value => value instanceof Map && value.size === 0; isInvalidDate(new Date('hello')); // true isEmptySet(new Set()); // true isEmptyMap(n...
```js const isInvalidDate = value => value instanceof Date && Number.isNaN(value.getTime()); const isEmptySet = value => value instanceof Set && value.size === 0; const isEmptyMap = value => value instanceof Map && value.size === 0; isInvalidDate(new Date('hello')); // true isEmptySet(new Set()); // true isEmptyMap(n...
code_snippets
df860260-615d-47c5-bb8d-514e80051791
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/blank-value.md
unknown
124ac06e-24c1-49c1-8c5e-8feb61d9f280
0
SemanticChunker@1.0.0
704a8e7b909468599364db7e1e451e8e35ddac26c4751ea210953a250471a0c2
--- title: How can I check for a blank value in JavaScript? shortTitle: Value is blank language: javascript tags: [type] cover: workspace-with-speaker excerpt: JavaScript doesn't have a built-in way to check if a value is blank, but it's easy to create one. listed: true dateModified: 2022-09-25 --- JavaScript doesn't ...
unknown
unknown
--- title: How can I check for a blank value in JavaScript? shortTitle: Value is blank language: javascript tags: [type] cover: workspace-with-speaker excerpt: JavaScript doesn't have a built-in way to check if a value is blank, but it's easy to create one. listed: true dateModified: 2022-09-25 --- JavaScript doesn't ...
--- title: How can I check for a blank value in JavaScript? shortTitle: Value is blank language: javascript tags: [type] cover: workspace-with-speaker excerpt: JavaScript doesn't have a built-in way to check if a value is blank, but it's easy to create one. listed: true dateModified: 2022-09-25 --- JavaScript doesn't ...
code_snippets
09083c72-3dbf-4919-8ae1-6c14f94ab803
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
10
SemanticChunker@1.0.0
8419cbe4c39193d5fd3a20d9ba0d4db4b82aed441e066d68df81a8e17c934029
[Abstract Syntax Tree > The AST class] ``` I think the only point worth mentioning here is, as is often the case, the use of a **stack** for loops. It helps us create the nested structure of the AST, but also acts as a way to **validate that all loop brackets are matched**. ## Code execution The AST itself is essen...
unknown
unknown
[Abstract Syntax Tree > The AST class] ``` I think the only point worth mentioning here is, as is often the case, the use of a **stack** for loops. It helps us create the nested structure of the AST, but also acts as a way to **validate that all loop brackets are matched**. ## Code execution The AST itself is essen...
[Abstract Syntax Tree > The AST class] ``` I think the only point worth mentioning here is, as is often the case, the use of a **stack** for loops. It helps us create the nested structure of the AST, but also acts as a way to **validate that all loop brackets are matched**. ## Code execution The AST itself is essen...
code_snippets
17fc30eb-998c-4a98-b8a3-4212f708f1a9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
6
SemanticChunker@1.0.0
51ac612d9ca0daacbb7b1a5a7dfdd8d924de6b10d63ced62ed7245207f0ba304
[Abstract Syntax Tree > The AST class] ### The AST class The `AST` class represents the AST of a Brainfuck program. It has a single property, `nodes`, which is an array of nodes. The class has a single method, `addNode`, which adds a new node to the AST. ```js title="ast.js" class AST { constructor() { this.nodes ...
unknown
unknown
[Abstract Syntax Tree > The AST class] ### The AST class The `AST` class represents the AST of a Brainfuck program. It has a single property, `nodes`, which is an array of nodes. The class has a single method, `addNode`, which adds a new node to the AST. ```js title="ast.js" class AST { constructor() { this.nodes ...
[Abstract Syntax Tree > The AST class] ### The AST class The `AST` class represents the AST of a Brainfuck program. It has a single property, `nodes`, which is an array of nodes. The class has a single method, `addNode`, which adds a new node to the AST. ```js title="ast.js" class AST { constructor() { this.nodes ...
code_snippets
2679214d-d320-4405-8136-4946990ce131
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
5
SemanticChunker@1.0.0
dfd4dcb932c27cd4e8d3fd261346044dbeca9dc1424a761202f8b48877c0ad27
[Language introduction > Abstract Syntax Tree] ## Abstract Syntax Tree An **Abstract Syntax Tree** (AST) is a tree representation of the abstract syntactic structure of source code written in a programming language. It's a way to represent the code in a way that's easier to manipulate and interpret. For Brainfuck, th...
unknown
unknown
[Language introduction > Abstract Syntax Tree] ## Abstract Syntax Tree An **Abstract Syntax Tree** (AST) is a tree representation of the abstract syntactic structure of source code written in a programming language. It's a way to represent the code in a way that's easier to manipulate and interpret. For Brainfuck, th...
[Language introduction > Abstract Syntax Tree] ## Abstract Syntax Tree An **Abstract Syntax Tree** (AST) is a tree representation of the abstract syntactic structure of source code written in a programming language. It's a way to represent the code in a way that's easier to manipulate and interpret. For Brainfuck, th...
code_snippets
3583e7a3-61db-4c17-8a77-5742a2f263ec
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
7
SemanticChunker@1.0.0
1808cb25881eccdc131a84a333a36e39bf0771664747fb8842093c33102b5f73
[Abstract Syntax Tree > The AST class] Object.entries(paramsWithDefaults).forEach(([key, defaultValue]) => { this[key] = params[key] || defaultValue; }); } } } export default ASTNode; ``` ## Code parser We'll use a **regular expression** to first clean up the code by removing any characters that are not part o...
unknown
unknown
[Abstract Syntax Tree > The AST class] Object.entries(paramsWithDefaults).forEach(([key, defaultValue]) => { this[key] = params[key] || defaultValue; }); } } } export default ASTNode; ``` ## Code parser We'll use a **regular expression** to first clean up the code by removing any characters that are not part o...
[Abstract Syntax Tree > The AST class] Object.entries(paramsWithDefaults).forEach(([key, defaultValue]) => { this[key] = params[key] || defaultValue; }); } } } export default ASTNode; ``` ## Code parser We'll use a **regular expression** to first clean up the code by removing any characters that are not part o...
code_snippets
46f801b3-3857-44b9-bf6f-86366b9ac96f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
11
SemanticChunker@1.0.0
00049aa453cd40dc8ef2e9d5a1535ca48bf226090317cf0654d170bae4bc0094
[Abstract Syntax Tree > The AST class] ```js title="astNode.js" const nodeTypes = { movePointer: { params: { offset: 0 }, createExecute({ offset }) { return ({ memory }) => { memory.movePointer(offset); }; } }, updateCell: { params: { diff: 0 }, createExecute({ diff }) { return ({ memory }) => { memory.se...
unknown
unknown
[Abstract Syntax Tree > The AST class] ```js title="astNode.js" const nodeTypes = { movePointer: { params: { offset: 0 }, createExecute({ offset }) { return ({ memory }) => { memory.movePointer(offset); }; } }, updateCell: { params: { diff: 0 }, createExecute({ diff }) { return ({ memory }) => { memory.se...
[Abstract Syntax Tree > The AST class] ```js title="astNode.js" const nodeTypes = { movePointer: { params: { offset: 0 }, createExecute({ offset }) { return ({ memory }) => { memory.movePointer(offset); }; } }, updateCell: { params: { diff: 0 }, createExecute({ diff }) { return ({ memory }) => { memory.se...
code_snippets
5167c9e2-9732-4be8-8be0-a33223552217
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
3
SemanticChunker@1.0.0
f7a5c7100150218b1339f1a388789e4c8250821960f1425451672f34cd169a0e
[Memory representation > Input and output] ### Input and output For **input and output**, we'll use the standard `process.stdin` and `process.stdout` streams. We'll be reading and writing **single bytes** at a time and converting from the byte value to a character and vice versa. This is a trivial task using `String....
unknown
unknown
[Memory representation > Input and output] ### Input and output For **input and output**, we'll use the standard `process.stdin` and `process.stdout` streams. We'll be reading and writing **single bytes** at a time and converting from the byte value to a character and vice versa. This is a trivial task using `String....
[Memory representation > Input and output] ### Input and output For **input and output**, we'll use the standard `process.stdin` and `process.stdout` streams. We'll be reading and writing **single bytes** at a time and converting from the byte value to a character and vice versa. This is a trivial task using `String....
code_snippets
826e72f2-25e4-45d6-a706-dbe1789075d3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
2
SemanticChunker@1.0.0
b8a12af034118ae5d46745b518eaabbbbddb51614ac146e3a1749d688ec0dd24
[Language introduction > Memory representation] ### Memory representation As is often the case, there are a few conflicting definitions of how the internal memory of the language works. In our case, we'll go for a more extensible memory system, using **two arrays**, `left` and `right` and a `pointer`, starting at `0`...
unknown
unknown
[Language introduction > Memory representation] ### Memory representation As is often the case, there are a few conflicting definitions of how the internal memory of the language works. In our case, we'll go for a more extensible memory system, using **two arrays**, `left` and `right` and a `pointer`, starting at `0`...
[Language introduction > Memory representation] ### Memory representation As is often the case, there are a few conflicting definitions of how the internal memory of the language works. In our case, we'll go for a more extensible memory system, using **two arrays**, `left` and `right` and a `pointer`, starting at `0`...
code_snippets
839dffe5-e55d-4a50-a7ad-6d7357dc65c2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
12
SemanticChunker@1.0.0
4a79d6513c750d10ee718d559fbbef74e4b5dea4bbcd7a21067eeca3f5fe527a
[Abstract Syntax Tree > The AST class] ``` And that's it! We now have a fully functional Brainfuck interpreter that uses an AST to represent the code and execute it. Let's put it to the test: ```js import Memory from './memory.js'; import Parser from './parser.js'; const program = '++++++++[>++++[>++<-]>+[<]<-]>>.-...
unknown
unknown
[Abstract Syntax Tree > The AST class] ``` And that's it! We now have a fully functional Brainfuck interpreter that uses an AST to represent the code and execute it. Let's put it to the test: ```js import Memory from './memory.js'; import Parser from './parser.js'; const program = '++++++++[>++++[>++<-]>+[<]<-]>>.-...
[Abstract Syntax Tree > The AST class] ``` And that's it! We now have a fully functional Brainfuck interpreter that uses an AST to represent the code and execute it. Let's put it to the test: ```js import Memory from './memory.js'; import Parser from './parser.js'; const program = '++++++++[>++++[>++<-]>+[<]<-]>>.-...
code_snippets
83cd4efc-dc0c-43f2-bd76-7ffa04ecb19c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
1
SemanticChunker@1.0.0
b8d0233d669d60a6798b44e32fb70a90acf3a4d9d7e9aa6426017b4a6e13d815
[Language introduction] ## Language introduction Brainfuck is a <dfn title="A Turing-complete system can solve any computational problem given enough time and memory">**Turing-complete**</dfn> <dfn title="Short for esoteric programming language; a computer programming language designed to experiment with unconvention...
unknown
unknown
[Language introduction] ## Language introduction Brainfuck is a <dfn title="A Turing-complete system can solve any computational problem given enough time and memory">**Turing-complete**</dfn> <dfn title="Short for esoteric programming language; a computer programming language designed to experiment with unconvention...
[Language introduction] ## Language introduction Brainfuck is a <dfn title="A Turing-complete system can solve any computational problem given enough time and memory">**Turing-complete**</dfn> <dfn title="Short for esoteric programming language; a computer programming language designed to experiment with unconvention...
code_snippets
a102f3fb-91ea-4cb2-9b66-39872fc605c6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
8
SemanticChunker@1.0.0
276d83ff4787d6f3216a19bc1ff34c3513486ee359b4af6b10bdcfe359277fd7
[Abstract Syntax Tree > The AST class] Up until this point, everything should be similar to the Smallfuck interpreter. Notice that we've taken some liberties in the `mergeConsecutiveTokens` method to represent consecutive tokens as **2-element arrays** (type and `offset`/`diff`), as well as handling the `[-]` pattern,...
unknown
unknown
[Abstract Syntax Tree > The AST class] Up until this point, everything should be similar to the Smallfuck interpreter. Notice that we've taken some liberties in the `mergeConsecutiveTokens` method to represent consecutive tokens as **2-element arrays** (type and `offset`/`diff`), as well as handling the `[-]` pattern,...
[Abstract Syntax Tree > The AST class] Up until this point, everything should be similar to the Smallfuck interpreter. Notice that we've taken some liberties in the `mergeConsecutiveTokens` method to represent consecutive tokens as **2-element arrays** (type and `offset`/`diff`), as well as handling the `[-]` pattern,...
code_snippets
bb34b64f-eb2d-4164-9797-f77fc8384541
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
9
SemanticChunker@1.0.0
4d05e22742f414a670805fabacdc99eeeeee61c49142c42af3be11aa39aa2709
[Abstract Syntax Tree > The AST class] for (let token of mergedTokens) { if (Array.isArray(token)) { const [type, count] = token; if (type === '>') ast.addNode(new ASTNode('movePointer', { offset: count })); else if (type === '+') ast.addNode(new ASTNode('updateCell', { diff: count })); } else { switch (token)...
unknown
unknown
[Abstract Syntax Tree > The AST class] for (let token of mergedTokens) { if (Array.isArray(token)) { const [type, count] = token; if (type === '>') ast.addNode(new ASTNode('movePointer', { offset: count })); else if (type === '+') ast.addNode(new ASTNode('updateCell', { diff: count })); } else { switch (token)...
[Abstract Syntax Tree > The AST class] for (let token of mergedTokens) { if (Array.isArray(token)) { const [type, count] = token; if (type === '>') ast.addNode(new ASTNode('movePointer', { offset: count })); else if (type === '+') ast.addNode(new ASTNode('updateCell', { diff: count })); } else { switch (token)...
code_snippets
bd8f9c13-f47d-48a1-86da-efd588608bfe
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
0
SemanticChunker@1.0.0
509a47d712f44658563d100731069bb57ac3eff3ba4904c2394b26f1020f14e9
--- title: Making a Brainfuck interpreter in JavaScript - Part 1 shortTitle: Brainfuck interpreter - Part 1 language: javascript tags: [algorithm] cover: lake-bench excerpt: Continuing on the code interpretation path, I'm attempting to build a Brainfuck interpreter, using an AST to represent and execute the code. liste...
unknown
unknown
--- title: Making a Brainfuck interpreter in JavaScript - Part 1 shortTitle: Brainfuck interpreter - Part 1 language: javascript tags: [algorithm] cover: lake-bench excerpt: Continuing on the code interpretation path, I'm attempting to build a Brainfuck interpreter, using an AST to represent and execute the code. liste...
--- title: Making a Brainfuck interpreter in JavaScript - Part 1 shortTitle: Brainfuck interpreter - Part 1 language: javascript tags: [algorithm] cover: lake-bench excerpt: Continuing on the code interpretation path, I'm attempting to build a Brainfuck interpreter, using an AST to represent and execute the code. liste...
code_snippets
f7601789-60ff-47fb-8abd-630bb58b48be
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
4
SemanticChunker@1.0.0
7ef239f2246b7c6455ec0356fc426feb657284af80f0edb69f1f082e68957423
[Memory representation > Tokenization] ### Tokenization **Tokenization** will be very similar to Smallfuck, except for the set of characters that are allowed. However, we'll make three **optimizations** that will drastically reduce the size and complexity of our AST: 1. We'll **merge consecutive** `+` and `-` comman...
unknown
unknown
[Memory representation > Tokenization] ### Tokenization **Tokenization** will be very similar to Smallfuck, except for the set of characters that are allowed. However, we'll make three **optimizations** that will drastically reduce the size and complexity of our AST: 1. We'll **merge consecutive** `+` and `-` comman...
[Memory representation > Tokenization] ### Tokenization **Tokenization** will be very similar to Smallfuck, except for the set of characters that are allowed. However, we'll make three **optimizations** that will drastically reduce the size and complexity of our AST: 1. We'll **merge consecutive** `+` and `-` comman...
code_snippets
f7db089f-ec0a-4c47-a44e-f52698dd9d9e
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/brainfuck-interpreter-part-1.md
unknown
913192fc-6553-4151-8cca-4a21aa23f35d
13
SemanticChunker@1.0.0
df9b81741b52d05d58818d356412c8433f74b392239f12744b514f9e7045ad2e
[Language introduction > Conclusion] ## Conclusion We've come halfway through the whole project in this first part of the implementation. Next time around, we'll be building a **virtual machine** to run the code in a more controlled environment. This will allow us to add **safety measures** and **timeouts** to the co...
unknown
unknown
[Language introduction > Conclusion] ## Conclusion We've come halfway through the whole project in this first part of the implementation. Next time around, we'll be building a **virtual machine** to run the code in a more controlled environment. This will allow us to add **safety measures** and **timeouts** to the co...
[Language introduction > Conclusion] ## Conclusion We've come halfway through the whole project in this first part of the implementation. Next time around, we'll be building a **virtual machine** to run the code in a more controlled environment. This will allow us to add **safety measures** and **timeouts** to the co...
code_snippets
877d365c-0956-43b1-94c7-584f99c9afba
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/cartesian-product-of-arrays.md
unknown
6a4aefe6-eb3c-4c49-9e1c-21a516a554f8
0
SemanticChunker@1.0.0
0ebe3ee1ed09a92e0efb92681d83f6c8441c122b4faef51fdbc69a35526b4cbd
--- title: Cartesian product of two JavaScript arrays shortTitle: Array cross product language: javascript tags: [math,array] cover: cup-of-orange excerpt: Create a new array out of the two supplied by creating each possible pair from the arrays. listed: true dateModified: 2024-03-20 --- The **Cartesian product** or *...
unknown
unknown
--- title: Cartesian product of two JavaScript arrays shortTitle: Array cross product language: javascript tags: [math,array] cover: cup-of-orange excerpt: Create a new array out of the two supplied by creating each possible pair from the arrays. listed: true dateModified: 2024-03-20 --- The **Cartesian product** or *...
--- title: Cartesian product of two JavaScript arrays shortTitle: Array cross product language: javascript tags: [math,array] cover: cup-of-orange excerpt: Create a new array out of the two supplied by creating each possible pair from the arrays. listed: true dateModified: 2024-03-20 --- The **Cartesian product** or *...
code_snippets
3746d491-7f2e-435e-8dc4-80cc8aaee3a3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/capitalize-first-letter-of-string.md
unknown
88d1cc59-0896-412d-9c09-1973d8dc36d0
0
SemanticChunker@1.0.0
9bf2a380ad904ebbffa28285776551c3c8f8063e8da1a70d13151f6a35db085d
--- title: Capitalize the first letter of a JavaScript string shortTitle: Capitalize string language: javascript tags: [string] cover: digital-nomad-3 excerpt: Learn how to capitalize the first letter of a string in JavaScript using array destructuring and `String.prototype.toUpperCase()`. listed: true dateModified: 20...
unknown
unknown
--- title: Capitalize the first letter of a JavaScript string shortTitle: Capitalize string language: javascript tags: [string] cover: digital-nomad-3 excerpt: Learn how to capitalize the first letter of a string in JavaScript using array destructuring and `String.prototype.toUpperCase()`. listed: true dateModified: 20...
--- title: Capitalize the first letter of a JavaScript string shortTitle: Capitalize string language: javascript tags: [string] cover: digital-nomad-3 excerpt: Learn how to capitalize the first letter of a string in JavaScript using array destructuring and `String.prototype.toUpperCase()`. listed: true dateModified: 20...
code_snippets
a7e5f996-acd1-4e0b-a4ef-71d1fcfa9d60
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/change-lightness.md
unknown
9da187db-eb2e-4e24-96e6-5b7129d88c1a
0
SemanticChunker@1.0.0
4126b8a7761d85607aac1cd8c7d064c12613aaff811306fa564d2a9709bbfb38
--- title: Change color lightness using JavaScript shortTitle: Change color lightness language: javascript tags: [string,regexp] cover: aerial-view-port excerpt: Learn how to change the lightness component of an `hsl()` color string using JavaScript. listed: true dateModified: 2024-02-04 --- One of the most common ope...
unknown
unknown
--- title: Change color lightness using JavaScript shortTitle: Change color lightness language: javascript tags: [string,regexp] cover: aerial-view-port excerpt: Learn how to change the lightness component of an `hsl()` color string using JavaScript. listed: true dateModified: 2024-02-04 --- One of the most common ope...
--- title: Change color lightness using JavaScript shortTitle: Change color lightness language: javascript tags: [string,regexp] cover: aerial-view-port excerpt: Learn how to change the lightness component of an `hsl()` color string using JavaScript. listed: true dateModified: 2024-02-04 --- One of the most common ope...
code_snippets
13d097df-662f-46df-ac39-965305985c06
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/clamp-or-map-number-to-range.md
unknown
42b7e2f4-b758-4aa1-b0ea-00283891a890
2
SemanticChunker@1.0.0
34f46639ee070dccc14610d23b92d8a812e528734129e18d5ab99a23d73abcd1
[Clamp a number > Convert a number to a safe integer] ### Convert a number to a safe integer A special case of clamping a number is converting it to a **safe integer**. You can use the `Number.MAX_SAFE_INTEGER` and `Number.MIN_SAFE_INTEGER` constants to find the closest safe value. Additionally, use `Math.round()` to...
unknown
unknown
[Clamp a number > Convert a number to a safe integer] ### Convert a number to a safe integer A special case of clamping a number is converting it to a **safe integer**. You can use the `Number.MAX_SAFE_INTEGER` and `Number.MIN_SAFE_INTEGER` constants to find the closest safe value. Additionally, use `Math.round()` to...
[Clamp a number > Convert a number to a safe integer] ### Convert a number to a safe integer A special case of clamping a number is converting it to a **safe integer**. You can use the `Number.MAX_SAFE_INTEGER` and `Number.MIN_SAFE_INTEGER` constants to find the closest safe value. Additionally, use `Math.round()` to...
code_snippets
406ff049-e3ae-4048-9c45-d01cddbd46fd
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/clamp-or-map-number-to-range.md
unknown
42b7e2f4-b758-4aa1-b0ea-00283891a890
3
SemanticChunker@1.0.0
2888f556e48a9d43b10355b831d31f359cafd5ef613b278409cc16233584722f
[Clamp a number > Map a number to a range] ## Map a number to a range Mapping a number to a range is a simple **linear transformation**. Provided the original and the target range, you can map between the limits of the two ranges. ```js const mapNumRange = (num, inMin, inMax, outMin, outMax) => ((num - inMin) * (ou...
unknown
unknown
[Clamp a number > Map a number to a range] ## Map a number to a range Mapping a number to a range is a simple **linear transformation**. Provided the original and the target range, you can map between the limits of the two ranges. ```js const mapNumRange = (num, inMin, inMax, outMin, outMax) => ((num - inMin) * (ou...
[Clamp a number > Map a number to a range] ## Map a number to a range Mapping a number to a range is a simple **linear transformation**. Provided the original and the target range, you can map between the limits of the two ranges. ```js const mapNumRange = (num, inMin, inMax, outMin, outMax) => ((num - inMin) * (ou...
code_snippets
6b297066-6312-401b-8fdd-9773bd7d7a54
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/clamp-or-map-number-to-range.md
unknown
42b7e2f4-b758-4aa1-b0ea-00283891a890
1
SemanticChunker@1.0.0
0a047883519e749df4de592252af7673bf4b665d401bc7c22dd227783ae63a74
[Clamp a number] ## Clamp a number In order to clamp a number, you can use `Math.max()` and `Math.min()` to find the **closest value** within the specified range. ```js const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); clampNumber(2, 3, 5); // 3 clampNumber(1, -1, -5); // ...
unknown
unknown
[Clamp a number] ## Clamp a number In order to clamp a number, you can use `Math.max()` and `Math.min()` to find the **closest value** within the specified range. ```js const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); clampNumber(2, 3, 5); // 3 clampNumber(1, -1, -5); // ...
[Clamp a number] ## Clamp a number In order to clamp a number, you can use `Math.max()` and `Math.min()` to find the **closest value** within the specified range. ```js const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); clampNumber(2, 3, 5); // 3 clampNumber(1, -1, -5); // ...
code_snippets
85e9df8c-21aa-4b91-877b-7ca7838b75e3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/clamp-or-map-number-to-range.md
unknown
42b7e2f4-b758-4aa1-b0ea-00283891a890
0
SemanticChunker@1.0.0
c3dd4c8f7573a3e2733f6c5bf08e518ff2e2d7da3c9be8cab5530a120ac84722
--- title: Clamp or map a number to a range in JavaScript shortTitle: Clamp or map to range language: javascript tags: [math] cover: clay-pot-horizon excerpt: Clamping and mapping a number to a range are two common and easily confused operations. Learn how to perform each in JavaScript. listed: true dateModified: 2024-...
unknown
unknown
--- title: Clamp or map a number to a range in JavaScript shortTitle: Clamp or map to range language: javascript tags: [math] cover: clay-pot-horizon excerpt: Clamping and mapping a number to a range are two common and easily confused operations. Learn how to perform each in JavaScript. listed: true dateModified: 2024-...
--- title: Clamp or map a number to a range in JavaScript shortTitle: Clamp or map to range language: javascript tags: [math] cover: clay-pot-horizon excerpt: Clamping and mapping a number to a range are two common and easily confused operations. Learn how to perform each in JavaScript. listed: true dateModified: 2024-...
code_snippets
0b44f2b1-918c-4b78-a641-acdf074cb9ea
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/check-array-values-are-truthy.md
unknown
7d4c1067-46ae-4639-81a3-553066831816
4
SemanticChunker@1.0.0
aa1121117611ecc0d9726e825cd2f29f7b6340f32c743d1ed3c5215d7976c4c8
[Check if all values in an array are truthy > Check if all objects have a given property] ## Check if all objects have a given property Taking this one step further, `Array.prototype.every()` can be used to check if **all objects in an array have a given property**. This is useful for validating data, for example. Si...
unknown
unknown
[Check if all values in an array are truthy > Check if all objects have a given property] ## Check if all objects have a given property Taking this one step further, `Array.prototype.every()` can be used to check if **all objects in an array have a given property**. This is useful for validating data, for example. Si...
[Check if all values in an array are truthy > Check if all objects have a given property] ## Check if all objects have a given property Taking this one step further, `Array.prototype.every()` can be used to check if **all objects in an array have a given property**. This is useful for validating data, for example. Si...
code_snippets
5fc01c72-cce3-4631-9515-9aeb55562ff4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/check-array-values-are-truthy.md
unknown
7d4c1067-46ae-4639-81a3-553066831816
1
SemanticChunker@1.0.0
dde22755725e3c3338f0ab24970f05445e7b081373fa53988e8befa09c5b94ff
[Check if all values in an array are truthy] ## Check if all values in an array are truthy Using `Array.prototype.every()`, we can easily check if all values in an array are truthy. The `Boolean` function can be used as a default callback to check if all values are truthy, but specifying a custom callback function is...
unknown
unknown
[Check if all values in an array are truthy] ## Check if all values in an array are truthy Using `Array.prototype.every()`, we can easily check if all values in an array are truthy. The `Boolean` function can be used as a default callback to check if all values are truthy, but specifying a custom callback function is...
[Check if all values in an array are truthy] ## Check if all values in an array are truthy Using `Array.prototype.every()`, we can easily check if all values in an array are truthy. The `Boolean` function can be used as a default callback to check if all values are truthy, but specifying a custom callback function is...
code_snippets
76964a0a-cbfe-4633-9438-0a1b372c7380
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/check-array-values-are-truthy.md
unknown
7d4c1067-46ae-4639-81a3-553066831816
3
SemanticChunker@1.0.0
e89b722c2ccaa77b4290024bdf026ed8c9f87b97994bc239f2ad8dfd3b5fe7fa
[Check if all values in an array are truthy > Check if all values in an array are falsy] ## Check if all values in an array are falsy Similarly, `Array.prototype.some()` can be used to check if any values in an array are falsy. Again, the `Boolean` function can be used as the default callback, but you can also specif...
unknown
unknown
[Check if all values in an array are truthy > Check if all values in an array are falsy] ## Check if all values in an array are falsy Similarly, `Array.prototype.some()` can be used to check if any values in an array are falsy. Again, the `Boolean` function can be used as the default callback, but you can also specif...
[Check if all values in an array are truthy > Check if all values in an array are falsy] ## Check if all values in an array are falsy Similarly, `Array.prototype.some()` can be used to check if any values in an array are falsy. Again, the `Boolean` function can be used as the default callback, but you can also specif...
code_snippets
976936f8-8c7d-43f5-ba10-7efe49c351af
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/check-array-values-are-truthy.md
unknown
7d4c1067-46ae-4639-81a3-553066831816
2
SemanticChunker@1.0.0
f5768d60543422eba1fb54402b124101a89a9b1993ffb161798e1d4fc24649e3
[Check if all values in an array are truthy > Check if any values in an array are truthy] ## Check if any values in an array are truthy Using `Array.prototype.some()`, we can check if any values in an array are truthy. The `Boolean` function can be used as a default callback to check if any values are truthy, but spe...
unknown
unknown
[Check if all values in an array are truthy > Check if any values in an array are truthy] ## Check if any values in an array are truthy Using `Array.prototype.some()`, we can check if any values in an array are truthy. The `Boolean` function can be used as a default callback to check if any values are truthy, but spe...
[Check if all values in an array are truthy > Check if any values in an array are truthy] ## Check if any values in an array are truthy Using `Array.prototype.some()`, we can check if any values in an array are truthy. The `Boolean` function can be used as a default callback to check if any values are truthy, but spe...
code_snippets
f8aa50b1-5d5a-4f32-a5ee-f778b6552d8b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/check-array-values-are-truthy.md
unknown
7d4c1067-46ae-4639-81a3-553066831816
0
SemanticChunker@1.0.0
2350546b4ba3ebc8124eefe3ab138364f286b55579556e3bdcc2a7e81600236d
--- title: Truth check all values in a JavaScript array shortTitle: Truth check array language: javascript tags: [object,logic,array] cover: digital-nomad-8 excerpt: Learn how to check if all values in an array are true or false. listed: true dateModified: 2023-11-06 --- As mentioned in [a previous article](/js/s/trut...
unknown
unknown
--- title: Truth check all values in a JavaScript array shortTitle: Truth check array language: javascript tags: [object,logic,array] cover: digital-nomad-8 excerpt: Learn how to check if all values in an array are true or false. listed: true dateModified: 2023-11-06 --- As mentioned in [a previous article](/js/s/trut...
--- title: Truth check all values in a JavaScript array shortTitle: Truth check array language: javascript tags: [object,logic,array] cover: digital-nomad-8 excerpt: Learn how to check if all values in an array are true or false. listed: true dateModified: 2023-11-06 --- As mentioned in [a previous article](/js/s/trut...
code_snippets
50877b79-b2f3-47d0-ac8e-f97bdc7b76b9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/cannot-extend-proxy-object.md
unknown
52b0f5f1-7662-4b67-8de9-56cf71a6d2c3
0
SemanticChunker@1.0.0
012c4e613830a01ec2ab1b8fa86feb51eb8b26db922fe403a6f2a2b8f6602384
--- title: You can't extend JavaScript's Proxy object shortTitle: Extending the Proxy object language: javascript tags: [proxy] cover: icebreaker excerpt: Turns out the Proxy object is not extensible, but there's a way around its limitations. listed: true dateModified: 2023-04-17 --- While the [`Proxy`](https://develo...
unknown
unknown
--- title: You can't extend JavaScript's Proxy object shortTitle: Extending the Proxy object language: javascript tags: [proxy] cover: icebreaker excerpt: Turns out the Proxy object is not extensible, but there's a way around its limitations. listed: true dateModified: 2023-04-17 --- While the [`Proxy`](https://develo...
--- title: You can't extend JavaScript's Proxy object shortTitle: Extending the Proxy object language: javascript tags: [proxy] cover: icebreaker excerpt: Turns out the Proxy object is not extensible, but there's a way around its limitations. listed: true dateModified: 2023-04-17 --- While the [`Proxy`](https://develo...
code_snippets
a3c7147e-febc-4eb9-bb46-15850d3ae5f9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/callbacks.md
unknown
9cd688b4-a7c6-4c52-8a22-b72332a5b4f5
2
SemanticChunker@1.0.0
875c25ff638f58a9018e92dfa7427ac0222c7b25bc629de9a297b9e7142c932b
[Synchronous callbacks > Asynchronous callbacks] ## Asynchronous callbacks An asynchronous callback is a callback function that is used to execute code after an asynchronous operation has completed. The function executed inside `Promise.prototype.then()` is a great example of an asynchronous callback: ```js const nu...
unknown
unknown
[Synchronous callbacks > Asynchronous callbacks] ## Asynchronous callbacks An asynchronous callback is a callback function that is used to execute code after an asynchronous operation has completed. The function executed inside `Promise.prototype.then()` is a great example of an asynchronous callback: ```js const nu...
[Synchronous callbacks > Asynchronous callbacks] ## Asynchronous callbacks An asynchronous callback is a callback function that is used to execute code after an asynchronous operation has completed. The function executed inside `Promise.prototype.then()` is a great example of an asynchronous callback: ```js const nu...
code_snippets
a46343e9-6507-49dc-8575-6b1e6ab37741
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/callbacks.md
unknown
9cd688b4-a7c6-4c52-8a22-b72332a5b4f5
1
SemanticChunker@1.0.0
0a8889186f2643fd31ae7238871384ff4ec8ee49b155a2315affab7de87d9e9e
[Synchronous callbacks] ## Synchronous callbacks A synchronous callback is a callback function that is executed immediately. The function passed as the first argument to `Array.prototype.map()` is a great example of a synchronous callback: ```js const nums = [1, 2, 3]; const printDoublePlusOne = n => console.log(2 *...
unknown
unknown
[Synchronous callbacks] ## Synchronous callbacks A synchronous callback is a callback function that is executed immediately. The function passed as the first argument to `Array.prototype.map()` is a great example of a synchronous callback: ```js const nums = [1, 2, 3]; const printDoublePlusOne = n => console.log(2 *...
[Synchronous callbacks] ## Synchronous callbacks A synchronous callback is a callback function that is executed immediately. The function passed as the first argument to `Array.prototype.map()` is a great example of a synchronous callback: ```js const nums = [1, 2, 3]; const printDoublePlusOne = n => console.log(2 *...
code_snippets
d81924dc-cc24-4dde-92a8-e8045100f6a0
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/callbacks.md
unknown
9cd688b4-a7c6-4c52-8a22-b72332a5b4f5
0
SemanticChunker@1.0.0
bad138e785fafba311efcfa75e1b40df75d28c12e9980f3b5b3f6c5f551e9e87
--- title: What is a callback function? shortTitle: Callback functions language: javascript tags: [function] cover: rabbit-call excerpt: JavaScript uses callback functions quite a lot. From event listeners to asynchronous code, they're an invaluable tool you need to master. listed: true dateModified: 2021-10-03 --- A ...
unknown
unknown
--- title: What is a callback function? shortTitle: Callback functions language: javascript tags: [function] cover: rabbit-call excerpt: JavaScript uses callback functions quite a lot. From event listeners to asynchronous code, they're an invaluable tool you need to master. listed: true dateModified: 2021-10-03 --- A ...
--- title: What is a callback function? shortTitle: Callback functions language: javascript tags: [function] cover: rabbit-call excerpt: JavaScript uses callback functions quite a lot. From event listeners to asynchronous code, they're an invaluable tool you need to master. listed: true dateModified: 2021-10-03 --- A ...
code_snippets
29e4a24b-1f28-4779-9f3e-4116cea75238
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/callback-pitfalls.md
unknown
9ca10860-c608-4152-8575-073d496430b2
1
SemanticChunker@1.0.0
68d09cc6dcd3668fc65036e85773738840ae0f437fd6ba149346c3d7699a73df
A corollary to this is that when working with third-party libraries and APIs, it's always best to create a function to pass the data to whatever part of said API is being used rather than using it directly as a callback. The reason for this is that, even though the library or API might not expect any additional argumen...
unknown
unknown
A corollary to this is that when working with third-party libraries and APIs, it's always best to create a function to pass the data to whatever part of said API is being used rather than using it directly as a callback. The reason for this is that, even though the library or API might not expect any additional argumen...
A corollary to this is that when working with third-party libraries and APIs, it's always best to create a function to pass the data to whatever part of said API is being used rather than using it directly as a callback. The reason for this is that, even though the library or API might not expect any additional argumen...
code_snippets
de4f4b28-cb9d-4287-a3ad-9ca48c85f678
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/callback-pitfalls.md
unknown
9ca10860-c608-4152-8575-073d496430b2
0
SemanticChunker@1.0.0
184f3e8e8b958200a6ab067f59edb2f4f40b3f0b0d6bccce20d119cadb6946ff
--- title: A cautionary tale about JavaScript callbacks shortTitle: Callback pitfalls language: javascript tags: [function] cover: rabbit-call excerpt: JavaScript callbacks are especially tricky when you're not careful. Take a deeper dive into potential issues and how to avoid them. listed: true dateModified: 2021-07-0...
unknown
unknown
--- title: A cautionary tale about JavaScript callbacks shortTitle: Callback pitfalls language: javascript tags: [function] cover: rabbit-call excerpt: JavaScript callbacks are especially tricky when you're not careful. Take a deeper dive into potential issues and how to avoid them. listed: true dateModified: 2021-07-0...
--- title: A cautionary tale about JavaScript callbacks shortTitle: Callback pitfalls language: javascript tags: [function] cover: rabbit-call excerpt: JavaScript callbacks are especially tricky when you're not careful. Take a deeper dive into potential issues and how to avoid them. listed: true dateModified: 2021-07-0...
code_snippets
0e377d5b-9476-4a2e-8a63-02cbccde34e4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/caesar-cipher.md
unknown
d1405044-2e07-4ecf-b705-ad5c60463fa0
0
SemanticChunker@1.0.0
6daac1b3a82c8d4b94e99370fc2d7dbddec1470e42816785f5df639345ce3cfd
--- title: Implement the Caesar cipher in JavaScript shortTitle: Caesar cipher language: javascript tags: [algorithm,string] cover: waves-from-above excerpt: The Caesar cipher is a simple substitution cipher, which can be easily implemented with a few lines of JavaScript code. listed: true dateModified: 2023-12-17 ---
unknown
unknown
--- title: Implement the Caesar cipher in JavaScript shortTitle: Caesar cipher language: javascript tags: [algorithm,string] cover: waves-from-above excerpt: The Caesar cipher is a simple substitution cipher, which can be easily implemented with a few lines of JavaScript code. listed: true dateModified: 2023-12-17 ---
--- title: Implement the Caesar cipher in JavaScript shortTitle: Caesar cipher language: javascript tags: [algorithm,string] cover: waves-from-above excerpt: The Caesar cipher is a simple substitution cipher, which can be easily implemented with a few lines of JavaScript code. listed: true dateModified: 2023-12-17 ---
code_snippets
b3cd4bbe-690d-40c7-960f-243dc8e283ba
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/caesar-cipher.md
unknown
d1405044-2e07-4ecf-b705-ad5c60463fa0
1
SemanticChunker@1.0.0
113dc886d8587d060483ba27bae9b9a5813e0af9d6afe4ecc7bf8e44d3471020
[Definition] ## Definition The [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher) is a simple **substitution cipher**, in which each letter is replaced by another letter a fixed number of positions down the alphabet. For example, with a left shift of `3`, `D` would be replaced by `A`, `E` would become `B`, ...
unknown
unknown
[Definition] ## Definition The [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher) is a simple **substitution cipher**, in which each letter is replaced by another letter a fixed number of positions down the alphabet. For example, with a left shift of `3`, `D` would be replaced by `A`, `E` would become `B`, ...
[Definition] ## Definition The [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher) is a simple **substitution cipher**, in which each letter is replaced by another letter a fixed number of positions down the alphabet. For example, with a left shift of `3`, `D` would be replaced by `A`, `E` would become `B`, ...
code_snippets
b8cad7ad-8063-46f5-9006-091000f16e0b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/caesar-cipher.md
unknown
d1405044-2e07-4ecf-b705-ad5c60463fa0
2
SemanticChunker@1.0.0
ff3e790b952d06b767eb2aae3372964b2750d3dd217f70b48d02977b40cc2d5d
[Definition > Implementation] ## Implementation > [!NOTE] > > The following implementation only works for **Latin letters** (`A` to `Z` and `a` to `z`), ignoring all other characters. Depending on the **mode** (decided by the `decrypt` parameter), the cipher either adds or subtracts the `shift` from the character co...
unknown
unknown
[Definition > Implementation] ## Implementation > [!NOTE] > > The following implementation only works for **Latin letters** (`A` to `Z` and `a` to `z`), ignoring all other characters. Depending on the **mode** (decided by the `decrypt` parameter), the cipher either adds or subtracts the `shift` from the character co...
[Definition > Implementation] ## Implementation > [!NOTE] > > The following implementation only works for **Latin letters** (`A` to `Z` and `a` to `z`), ignoring all other characters. Depending on the **mode** (decided by the `decrypt` parameter), the cipher either adds or subtracts the `shift` from the character co...
code_snippets
9fd64c3c-f07a-4956-b0ba-319e6a949b5f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/call-function-once.md
unknown
4e1b0dee-c16e-4780-81b6-f38cc57bd9ae
0
SemanticChunker@1.0.0
88573e0c94b2e1ab1037f413b5c2d75c9784093906edc2fc0f0957af88c86cd2
--- title: Call a JavaScript function once shortTitle: Call function once language: javascript tags: [function] cover: pink-flower-tree excerpt: Create a function that ensures another function is called only once. listed: true dateModified: 2024-07-26 --- Sometimes, you need to ensure that a function is **called only ...
unknown
unknown
--- title: Call a JavaScript function once shortTitle: Call function once language: javascript tags: [function] cover: pink-flower-tree excerpt: Create a function that ensures another function is called only once. listed: true dateModified: 2024-07-26 --- Sometimes, you need to ensure that a function is **called only ...
--- title: Call a JavaScript function once shortTitle: Call function once language: javascript tags: [function] cover: pink-flower-tree excerpt: Create a function that ensures another function is called only once. listed: true dateModified: 2024-07-26 --- Sometimes, you need to ensure that a function is **called only ...
code_snippets
2ddc7011-e789-449c-8d75-d08f9f0c62c9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/collection-is-empty.md
unknown
8a8aa58f-dfc0-42cd-a8ae-0b23ce63e3f4
0
SemanticChunker@1.0.0
27a4a4eea8130eba3e7572146037a27441a32c774600f8772ca2d5ae6d2867ca
--- title: Check if a JavaScript collection is empty shortTitle: Value is empty language: javascript tags: [type,array,object,string] cover: mountain-lake excerpt: Quickly determine if a collection of values is empty in JavaScript. listed: true dateModified: 2024-06-10 --- When we say a collection of values is _empty_...
unknown
unknown
--- title: Check if a JavaScript collection is empty shortTitle: Value is empty language: javascript tags: [type,array,object,string] cover: mountain-lake excerpt: Quickly determine if a collection of values is empty in JavaScript. listed: true dateModified: 2024-06-10 --- When we say a collection of values is _empty_...
--- title: Check if a JavaScript collection is empty shortTitle: Value is empty language: javascript tags: [type,array,object,string] cover: mountain-lake excerpt: Quickly determine if a collection of values is empty in JavaScript. listed: true dateModified: 2024-06-10 --- When we say a collection of values is _empty_...
code_snippets
09e1b10a-bc80-448e-a836-f4922dfc3a86
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
11
SemanticChunker@1.0.0
c91063deda5c50c8a4719d26657689ee6e6becc01932b59e2b97dfd89685b3c3
[Exact string match > Validate date format (DD/MM/YYYY)] ## Validate date format (DD/MM/YYYY) - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Validate each segment of the date separately using numeric character ranges and quantifiers. - Alter the order of the segments and separ...
unknown
unknown
[Exact string match > Validate date format (DD/MM/YYYY)] ## Validate date format (DD/MM/YYYY) - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Validate each segment of the date separately using numeric character ranges and quantifiers. - Alter the order of the segments and separ...
[Exact string match > Validate date format (DD/MM/YYYY)] ## Validate date format (DD/MM/YYYY) - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Validate each segment of the date separately using numeric character ranges and quantifiers. - Alter the order of the segments and separ...
code_snippets
0bab1c8c-f3c1-4a87-8ffb-76c7136c7e64
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
5
SemanticChunker@1.0.0
81984ede7d6e652117dfce8b8d3300037f63db75f97d20aa0084464f75bf0cfc
[Exact string match > Match non-word characters] ## Match non-word characters - Use negation (`^`) to match any character that is not a word character (`\w`) or a whitespace character (`\s`). - Add the global flag (`g`) to match all occurrences of the pattern in the string. - Add the ignore case flag (`i`) to match b...
unknown
unknown
[Exact string match > Match non-word characters] ## Match non-word characters - Use negation (`^`) to match any character that is not a word character (`\w`) or a whitespace character (`\s`). - Add the global flag (`g`) to match all occurrences of the pattern in the string. - Add the ignore case flag (`i`) to match b...
[Exact string match > Match non-word characters] ## Match non-word characters - Use negation (`^`) to match any character that is not a word character (`\w`) or a whitespace character (`\s`). - Add the global flag (`g`) to match all occurrences of the pattern in the string. - Add the ignore case flag (`i`) to match b...
code_snippets
3610be24-5b4d-4c80-8ff5-c1d17e56be2e
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
0
SemanticChunker@1.0.0
3995209368b769d81053106ec09e85df79a5f53da0c13d93e66db460ff041e8e
--- title: Common regular expressions language: javascript tags: [string,regexp,cheatsheet] cover: rocky-beach excerpt: A collection of regular expressions that can be used to solve common problems. listed: true dateModified: 2022-11-09 ---
unknown
unknown
--- title: Common regular expressions language: javascript tags: [string,regexp,cheatsheet] cover: rocky-beach excerpt: A collection of regular expressions that can be used to solve common problems. listed: true dateModified: 2022-11-09 ---
--- title: Common regular expressions language: javascript tags: [string,regexp,cheatsheet] cover: rocky-beach excerpt: A collection of regular expressions that can be used to solve common problems. listed: true dateModified: 2022-11-09 ---
code_snippets
3b949d5f-0d5f-4ad9-99c4-e4bc8d100f27
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
2
SemanticChunker@1.0.0
82b8c96367afcd90bbe3a3bbb8e504a8e9f8585d38a3dbfc38cfa11c1abf93ec
[Exact string match > Match empty string] ## Match empty string - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Do not add any characters in-between to match an empty string. ```js const regexp = /^$/; ```
unknown
unknown
[Exact string match > Match empty string] ## Match empty string - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Do not add any characters in-between to match an empty string. ```js const regexp = /^$/; ```
[Exact string match > Match empty string] ## Match empty string - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Do not add any characters in-between to match an empty string. ```js const regexp = /^$/; ```
code_snippets
3c1d5cf7-5a05-4dcd-b7f4-c0de83d3eb83
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
1
SemanticChunker@1.0.0
c1550d0c27f1f71eb2557b8cc80dfc52eb5bed1b365e623d7fd7039f4c837e93
[Exact string match] ## Exact string match - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Add the string you want to match in-between the two anchors. ```js const regexp = /^abc$/; // Where 'abc' is the exact string you want to match ```
unknown
unknown
[Exact string match] ## Exact string match - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Add the string you want to match in-between the two anchors. ```js const regexp = /^abc$/; // Where 'abc' is the exact string you want to match ```
[Exact string match] ## Exact string match - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Add the string you want to match in-between the two anchors. ```js const regexp = /^abc$/; // Where 'abc' is the exact string you want to match ```
code_snippets
75a7af02-7dcc-4b12-b185-1221173c38e0
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
10
SemanticChunker@1.0.0
12d28870d38b6d7fa4a82bbb822010fb1eebe6b5b77bd344b933650af43dd9fb
[Exact string match > Validate GUID/UUID] ## Validate GUID/UUID - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Validate each segment of the GUID/UUID separately using numeric character ranges and quantifiers. ```js const regexp = /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[01...
unknown
unknown
[Exact string match > Validate GUID/UUID] ## Validate GUID/UUID - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Validate each segment of the GUID/UUID separately using numeric character ranges and quantifiers. ```js const regexp = /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[01...
[Exact string match > Validate GUID/UUID] ## Validate GUID/UUID - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Validate each segment of the GUID/UUID separately using numeric character ranges and quantifiers. ```js const regexp = /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[01...
code_snippets
7a99078d-9436-4333-ae02-936ba1275b5d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
8
SemanticChunker@1.0.0
fee47a42d5c8b25bc8cafb498baea8efb2e108721174092950e31bf8e75a9962
[Exact string match > Pattern not included] ## Pattern not included - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use a negative lookahead (`?!`) to match any character that is not followed by the pattern you want to exclude. - Add the global flag (`g`) to match all occurrenc...
unknown
unknown
[Exact string match > Pattern not included] ## Pattern not included - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use a negative lookahead (`?!`) to match any character that is not followed by the pattern you want to exclude. - Add the global flag (`g`) to match all occurrenc...
[Exact string match > Pattern not included] ## Pattern not included - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use a negative lookahead (`?!`) to match any character that is not followed by the pattern you want to exclude. - Add the global flag (`g`) to match all occurrenc...
code_snippets
839b05f7-6449-455e-a3ad-3149df3f73db
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
7
SemanticChunker@1.0.0
0efa37a843ca59cc07953646f3e5ea6219adad9fdca2c3da59c311085c8aa6c5
[Exact string match > Match letters and whitespaces] ## Match letters and whitespaces - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use the `a-zA-Z\s` pattern to match any letter and whitespace character. - Use the `+` quantifier to match one or more occurrences of the previo...
unknown
unknown
[Exact string match > Match letters and whitespaces] ## Match letters and whitespaces - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use the `a-zA-Z\s` pattern to match any letter and whitespace character. - Use the `+` quantifier to match one or more occurrences of the previo...
[Exact string match > Match letters and whitespaces] ## Match letters and whitespaces - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use the `a-zA-Z\s` pattern to match any letter and whitespace character. - Use the `+` quantifier to match one or more occurrences of the previo...
code_snippets
85be8332-7e71-450b-b318-82c9114dd225
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
9
SemanticChunker@1.0.0
513bc33242748b3df59c2682328ff5e3979bfc6a75407de60ec3acde64459d30
[Exact string match > Text inside brackets] ## Text inside brackets - Use the `\(` and `\)` characters to match the opening and closing brackets, respectively. - Use a capturing group between the two and exclude the closing parenthesis character. - Use the `+` quantifier to match one or more characters, as needed. - ...
unknown
unknown
[Exact string match > Text inside brackets] ## Text inside brackets - Use the `\(` and `\)` characters to match the opening and closing brackets, respectively. - Use a capturing group between the two and exclude the closing parenthesis character. - Use the `+` quantifier to match one or more characters, as needed. - ...
[Exact string match > Text inside brackets] ## Text inside brackets - Use the `\(` and `\)` characters to match the opening and closing brackets, respectively. - Use a capturing group between the two and exclude the closing parenthesis character. - Use the `+` quantifier to match one or more characters, as needed. - ...
code_snippets
da502351-37dd-4a62-a94d-85307ba51108
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
4
SemanticChunker@1.0.0
ebbc7fe35b2a5f8fd918d00953b690584c9185103aad3b9506277078961b5905
[Exact string match > Match line breaks] ## Match line breaks - Depending on the environment, line breaks can be represented in different ways. - Use the `\r` character to match carriage returns, the `\n` character to match newlines, and the `\r\n` sequence to match carriage returns followed by newlines. - Add the gl...
unknown
unknown
[Exact string match > Match line breaks] ## Match line breaks - Depending on the environment, line breaks can be represented in different ways. - Use the `\r` character to match carriage returns, the `\n` character to match newlines, and the `\r\n` sequence to match carriage returns followed by newlines. - Add the gl...
[Exact string match > Match line breaks] ## Match line breaks - Depending on the environment, line breaks can be represented in different ways. - Use the `\r` character to match carriage returns, the `\n` character to match newlines, and the `\r\n` sequence to match carriage returns followed by newlines. - Add the gl...
code_snippets
e1ba77b1-1715-41f9-a202-97bad4a8073f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
6
SemanticChunker@1.0.0
a4290ab511747b50df7fb122e88ca3e7887d2276bcac29cff7a84916565b6384
[Exact string match > Match alphanumeric, dashes and hyphens] ## Match alphanumeric, dashes and hyphens - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use the `a-zA-Z0-9-` pattern to match any alphanumeric character, dashes and hyphens. - Use the `+` quantifier to match one or...
unknown
unknown
[Exact string match > Match alphanumeric, dashes and hyphens] ## Match alphanumeric, dashes and hyphens - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use the `a-zA-Z0-9-` pattern to match any alphanumeric character, dashes and hyphens. - Use the `+` quantifier to match one or...
[Exact string match > Match alphanumeric, dashes and hyphens] ## Match alphanumeric, dashes and hyphens - Use the `^` and `$` anchors to match the start and end of the string, respectively. - Use the `a-zA-Z0-9-` pattern to match any alphanumeric character, dashes and hyphens. - Use the `+` quantifier to match one or...
code_snippets
e7f041e7-af11-48ed-b283-daee388abefa
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
3
SemanticChunker@1.0.0
7aa9e1031fc187b57282603e6537f23adc3c883385a1c8d2755e2231aba1ef9e
[Exact string match > Match whitespace sequences] ## Match whitespace sequences - Use the `\s` meta-sequence to match any whitespace character, including spaces, tabs, newlines, etc. - Use the `+` quantifier to match one or more occurrences of the previous character. - Add the global flag (`g`) to match all occurrenc...
unknown
unknown
[Exact string match > Match whitespace sequences] ## Match whitespace sequences - Use the `\s` meta-sequence to match any whitespace character, including spaces, tabs, newlines, etc. - Use the `+` quantifier to match one or more occurrences of the previous character. - Add the global flag (`g`) to match all occurrenc...
[Exact string match > Match whitespace sequences] ## Match whitespace sequences - Use the `\s` meta-sequence to match any whitespace character, including spaces, tabs, newlines, etc. - Use the `+` quantifier to match one or more occurrences of the previous character. - Add the global flag (`g`) to match all occurrenc...
code_snippets
e9e27394-4bc5-4530-86e6-5080c0396cb8
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/common-regexp-cheatsheet.md
unknown
5e84d4eb-02ec-4d83-ac73-9e5e289ac0b6
12
SemanticChunker@1.0.0
bd5341eed7d8ba3a0e4eced26f450c2290e4ee3db808d11a51a91532f56f409d
[Exact string match > Chunk string into n-size chunks] ## Chunk string into n-size chunks - Use the `.{1,n}` quantifier to match any character between `1` and `n` times. - Add the global flag (`g`) to match all occurrences of the pattern in the string. ```js const regexp = /.{1,2}/g; // Where '2' is the number of ch...
unknown
unknown
[Exact string match > Chunk string into n-size chunks] ## Chunk string into n-size chunks - Use the `.{1,n}` quantifier to match any character between `1` and `n` times. - Add the global flag (`g`) to match all occurrences of the pattern in the string. ```js const regexp = /.{1,2}/g; // Where '2' is the number of ch...
[Exact string match > Chunk string into n-size chunks] ## Chunk string into n-size chunks - Use the `.{1,n}` quantifier to match any character between `1` and `n` times. - Add the global flag (`g`) to match all occurrences of the pattern in the string. ```js const regexp = /.{1,2}/g; // Where '2' is the number of ch...
code_snippets
010f38d5-a980-46c0-885a-f43e5da67b06
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/code-anatomy-chaining-reduce-for-loop.md
unknown
b9fddfe3-0784-4394-943b-4ef286b1aba3
2
SemanticChunker@1.0.0
053460e7d7cceb9ad6320bdc0d54a9a39d80e60ae26befbf9528e97f26f425b6
[For loops > Array reduce] ## Array reduce ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; const filePaths = files.reduce((acc, file) => { const fileName = file.trim(); if(fileName) { const filePath = `~/cool_app/${fileName}`; acc.push(filePath); } return acc; }, []); // filePaths = [ '~/cool_app/f...
unknown
unknown
[For loops > Array reduce] ## Array reduce ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; const filePaths = files.reduce((acc, file) => { const fileName = file.trim(); if(fileName) { const filePath = `~/cool_app/${fileName}`; acc.push(filePath); } return acc; }, []); // filePaths = [ '~/cool_app/f...
[For loops > Array reduce] ## Array reduce ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; const filePaths = files.reduce((acc, file) => { const fileName = file.trim(); if(fileName) { const filePath = `~/cool_app/${fileName}`; acc.push(filePath); } return acc; }, []); // filePaths = [ '~/cool_app/f...
code_snippets
2af4a9af-9d39-489a-aa24-2c43553af926
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/code-anatomy-chaining-reduce-for-loop.md
unknown
b9fddfe3-0784-4394-943b-4ef286b1aba3
0
SemanticChunker@1.0.0
9d52ca3bf63479fb843730372b712f16f8f174ea52acd170c3f7fcdedd26b772
--- title: Code Anatomy - For loops, array reduce and method chaining shortTitle: For loops, array reduce and method chaining language: javascript tags: [array,iterator] cover: case-study excerpt: There are many ways to iterate and transform array data in JavaScript. Learn how each one works and where you should use th...
unknown
unknown
--- title: Code Anatomy - For loops, array reduce and method chaining shortTitle: For loops, array reduce and method chaining language: javascript tags: [array,iterator] cover: case-study excerpt: There are many ways to iterate and transform array data in JavaScript. Learn how each one works and where you should use th...
--- title: Code Anatomy - For loops, array reduce and method chaining shortTitle: For loops, array reduce and method chaining language: javascript tags: [array,iterator] cover: case-study excerpt: There are many ways to iterate and transform array data in JavaScript. Learn how each one works and where you should use th...
code_snippets
bf3b605d-feff-454e-b732-d26ecedb034b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/code-anatomy-chaining-reduce-for-loop.md
unknown
b9fddfe3-0784-4394-943b-4ef286b1aba3
1
SemanticChunker@1.0.0
06adefe0fc415e8bc69f732a0685006c6196486bf53a3633ea171b4ae2e49c75
[For loops] ## For loops ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; let filePaths = []; for (let file of files) { const fileName = file.trim(); if(fileName) { const filePath = `~/cool_app/${fileName}`; filePaths.push(filePath); } } // filePaths = [ '~/cool_app/foo.txt', '~/cool_app/.bar', '~/c...
unknown
unknown
[For loops] ## For loops ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; let filePaths = []; for (let file of files) { const fileName = file.trim(); if(fileName) { const filePath = `~/cool_app/${fileName}`; filePaths.push(filePath); } } // filePaths = [ '~/cool_app/foo.txt', '~/cool_app/.bar', '~/c...
[For loops] ## For loops ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; let filePaths = []; for (let file of files) { const fileName = file.trim(); if(fileName) { const filePath = `~/cool_app/${fileName}`; filePaths.push(filePath); } } // filePaths = [ '~/cool_app/foo.txt', '~/cool_app/.bar', '~/c...
code_snippets
f10e3934-4fd3-4997-8d01-ed1ccef1821f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/code-anatomy-chaining-reduce-for-loop.md
unknown
b9fddfe3-0784-4394-943b-4ef286b1aba3
3
SemanticChunker@1.0.0
8d0503a0410db83f75791bd773b9cd5e5436865f8bc62da37646636c34475fe9
[For loops > Method chaining] ## Method chaining ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; const filePaths = files .map(file => file.trim()) .filter(Boolean) .map(fileName => `~/cool_app/${fileName}`); // filePaths = [ '~/cool_app/foo.txt', '~/cool_app/.bar', '~/cool_app/baz.foo'] ``` - Uses `A...
unknown
unknown
[For loops > Method chaining] ## Method chaining ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; const filePaths = files .map(file => file.trim()) .filter(Boolean) .map(fileName => `~/cool_app/${fileName}`); // filePaths = [ '~/cool_app/foo.txt', '~/cool_app/.bar', '~/cool_app/baz.foo'] ``` - Uses `A...
[For loops > Method chaining] ## Method chaining ```js const files = [ 'foo.txt ', '.bar', ' ', 'baz.foo' ]; const filePaths = files .map(file => file.trim()) .filter(Boolean) .map(fileName => `~/cool_app/${fileName}`); // filePaths = [ '~/cool_app/foo.txt', '~/cool_app/.bar', '~/cool_app/baz.foo'] ``` - Uses `A...
code_snippets
8c5a3f97-75e3-436c-9d0f-a09e4f1038cc
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/compact-object-or-array.md
unknown
786e46bb-c0c2-425a-b11f-458f3bb74000
3
SemanticChunker@1.0.0
6e73604f95c2f961e5b2d0d7834a9c08a90cbc544d0f705ea537ea04af40321e
[Compact an array > Deep compact an array or object] ## Deep compact an array or object Up until this point, we've only **shallowly compacted arrays and objects**. If you want to **deeply compact** an array or object, you can use **recursion** to compact all nested arrays and objects. First, initialize the iterable ...
unknown
unknown
[Compact an array > Deep compact an array or object] ## Deep compact an array or object Up until this point, we've only **shallowly compacted arrays and objects**. If you want to **deeply compact** an array or object, you can use **recursion** to compact all nested arrays and objects. First, initialize the iterable ...
[Compact an array > Deep compact an array or object] ## Deep compact an array or object Up until this point, we've only **shallowly compacted arrays and objects**. If you want to **deeply compact** an array or object, you can use **recursion** to compact all nested arrays and objects. First, initialize the iterable ...
code_snippets
a79985e6-78a4-4624-a221-056338a4d5e2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/compact-object-or-array.md
unknown
786e46bb-c0c2-425a-b11f-458f3bb74000
1
SemanticChunker@1.0.0
c38384d01eb119e5cedbdabc49a2a3ad1fe793cdf0dfb34cf12a7e43a170295b
[Compact an array] ## Compact an array Compacting an **array** is as simple as using `Array.prototype.filter()` combined with the `Boolean` function. ```js const compact = arr => arr.filter(Boolean); compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34]); // [ 1, 2, 3, 'a', 's', 34 ] ```
unknown
unknown
[Compact an array] ## Compact an array Compacting an **array** is as simple as using `Array.prototype.filter()` combined with the `Boolean` function. ```js const compact = arr => arr.filter(Boolean); compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34]); // [ 1, 2, 3, 'a', 's', 34 ] ```
[Compact an array] ## Compact an array Compacting an **array** is as simple as using `Array.prototype.filter()` combined with the `Boolean` function. ```js const compact = arr => arr.filter(Boolean); compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34]); // [ 1, 2, 3, 'a', 's', 34 ] ```
code_snippets
acf28d1f-aedd-43ac-9c0b-4016e60db69a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/compact-object-or-array.md
unknown
786e46bb-c0c2-425a-b11f-458f3bb74000
0
SemanticChunker@1.0.0
2d6df645727876f320e35cdc1d86504f7e78d18cdd2292a729f7e35218fc9c17
--- title: Compact an array or object in JavaScript shortTitle: Compact array or object language: javascript tags: [array,object,recursion] cover: basket-paper excerpt: Learn how to compact an array or object in JavaScript using the `Boolean` function and recursion. listed: true dateModified: 2024-01-02 --- The term *...
unknown
unknown
--- title: Compact an array or object in JavaScript shortTitle: Compact array or object language: javascript tags: [array,object,recursion] cover: basket-paper excerpt: Learn how to compact an array or object in JavaScript using the `Boolean` function and recursion. listed: true dateModified: 2024-01-02 --- The term *...
--- title: Compact an array or object in JavaScript shortTitle: Compact array or object language: javascript tags: [array,object,recursion] cover: basket-paper excerpt: Learn how to compact an array or object in JavaScript using the `Boolean` function and recursion. listed: true dateModified: 2024-01-02 --- The term *...
code_snippets
fe15552f-547e-45fd-b708-7bc6a4b42b67
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/compact-object-or-array.md
unknown
786e46bb-c0c2-425a-b11f-458f3bb74000
2
SemanticChunker@1.0.0
28779809869c88ba47edfcd837b7dbc2da3b8e0c191fef1485708d3f4f1ae702
[Compact an array > Compact an object] ## Compact an object Compacting an **object** is fairly similar to the array, but you have to use `Object.entries()` to iterate over the object before filtering its key-value pairs. ```js const compact = obj => Object.fromEntries( Object.entries(obj).filter(([key, value]) => ...
unknown
unknown
[Compact an array > Compact an object] ## Compact an object Compacting an **object** is fairly similar to the array, but you have to use `Object.entries()` to iterate over the object before filtering its key-value pairs. ```js const compact = obj => Object.fromEntries( Object.entries(obj).filter(([key, value]) => ...
[Compact an array > Compact an object] ## Compact an object Compacting an **object** is fairly similar to the array, but you have to use `Object.entries()` to iterate over the object before filtering its key-value pairs. ```js const compact = obj => Object.fromEntries( Object.entries(obj).filter(([key, value]) => ...
code_snippets
59ea110d-c7c4-46ee-9ca1-a7961e1b1263
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/command-line-arguments.md
unknown
7d8ea210-d95d-44e3-8b03-562c15297c5d
3
SemanticChunker@1.0.0
3ca0c69842d574b7023facd8eb23390a012c9a672bfce8e24467f62056d71081
[The `process.argv` array > Checking if a flag is present] ## Checking if a flag is present If you need to check if a specific flag is present in the command-line arguments, you can use `Array.prototype.every()` and `Array.prototype.includes()` to check if `process.argv` contains the specified flag. Then, you can use...
unknown
unknown
[The `process.argv` array > Checking if a flag is present] ## Checking if a flag is present If you need to check if a specific flag is present in the command-line arguments, you can use `Array.prototype.every()` and `Array.prototype.includes()` to check if `process.argv` contains the specified flag. Then, you can use...
[The `process.argv` array > Checking if a flag is present] ## Checking if a flag is present If you need to check if a specific flag is present in the command-line arguments, you can use `Array.prototype.every()` and `Array.prototype.includes()` to check if `process.argv` contains the specified flag. Then, you can use...
code_snippets
a72b71dd-74be-4c68-8f16-1010d348a859
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/command-line-arguments.md
unknown
7d8ea210-d95d-44e3-8b03-562c15297c5d
0
SemanticChunker@1.0.0
c9708f500eb5f2cc6bad287e6de2ef3bf3939b1c88f893fbd865985a0e21301d
--- title: Command-line arguments in Node.js shortTitle: Command-line arguments language: javascript tags: [node] cover: hiking-balance excerpt: Learn how to extract command-line arguments passed to a Node.js script. listed: true dateModified: 2024-05-22 --- When working with Node.js scripts, you might need to access ...
unknown
unknown
--- title: Command-line arguments in Node.js shortTitle: Command-line arguments language: javascript tags: [node] cover: hiking-balance excerpt: Learn how to extract command-line arguments passed to a Node.js script. listed: true dateModified: 2024-05-22 --- When working with Node.js scripts, you might need to access ...
--- title: Command-line arguments in Node.js shortTitle: Command-line arguments language: javascript tags: [node] cover: hiking-balance excerpt: Learn how to extract command-line arguments passed to a Node.js script. listed: true dateModified: 2024-05-22 --- When working with Node.js scripts, you might need to access ...
code_snippets
d4df2009-6fb9-43fa-a9ad-f1f776c8518d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/command-line-arguments.md
unknown
7d8ea210-d95d-44e3-8b03-562c15297c5d
1
SemanticChunker@1.0.0
2d732b0c63529656d81fcee0e1281e54c325e41ace231e5efeac7dcf69b29c27
[The `process.argv` array] ## The `process.argv` array Node.js provides the `process.argv` array, which contains the command-line arguments passed to the Node.js process. The first two elements of the array are the **path of the Node.js executable** and the **file being executed**. Let's look at an example to make it...
unknown
unknown
[The `process.argv` array] ## The `process.argv` array Node.js provides the `process.argv` array, which contains the command-line arguments passed to the Node.js process. The first two elements of the array are the **path of the Node.js executable** and the **file being executed**. Let's look at an example to make it...
[The `process.argv` array] ## The `process.argv` array Node.js provides the `process.argv` array, which contains the command-line arguments passed to the Node.js process. The first two elements of the array are the **path of the Node.js executable** and the **file being executed**. Let's look at an example to make it...
code_snippets
dbd5a1c7-f2ca-4417-a0da-eb31c4fa6cd3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/command-line-arguments.md
unknown
7d8ea210-d95d-44e3-8b03-562c15297c5d
2
SemanticChunker@1.0.0
8a4b976992d07be0b56d9aa1f1322831c56197b4206dd3d8696b5601cac8a461
[The `process.argv` array > Extracting command-line arguments] ## Extracting command-line arguments In order to get only the command-line arguments passed to the script, you can use `Array.prototype.slice()` to **remove the first two elements** of the `process.argv` array. Then, you can use them as needed in your scr...
unknown
unknown
[The `process.argv` array > Extracting command-line arguments] ## Extracting command-line arguments In order to get only the command-line arguments passed to the script, you can use `Array.prototype.slice()` to **remove the first two elements** of the `process.argv` array. Then, you can use them as needed in your scr...
[The `process.argv` array > Extracting command-line arguments] ## Extracting command-line arguments In order to get only the command-line arguments passed to the script, you can use `Array.prototype.slice()` to **remove the first two elements** of the `process.argv` array. Then, you can use them as needed in your scr...
code_snippets
8168247d-ddbf-4ff4-81f1-03a2629816df
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/color-console-output.md
unknown
a68f2593-31c5-4d00-9d59-adfa449a4bf1
0
SemanticChunker@1.0.0
dc53650242af874a4764abd487f54563846991e22c418f0e7fd3638a4638bb47
--- title: Colorize text in the Node.js terminal shortTitle: Colorize text language: javascript tags: [node,string] cover: plant-corner excerpt: Use special Unicode characters to print text in color in the console. listed: true dateModified: 2024-03-14 --- You've probably seen colored text in the console before, and y...
unknown
unknown
--- title: Colorize text in the Node.js terminal shortTitle: Colorize text language: javascript tags: [node,string] cover: plant-corner excerpt: Use special Unicode characters to print text in color in the console. listed: true dateModified: 2024-03-14 --- You've probably seen colored text in the console before, and y...
--- title: Colorize text in the Node.js terminal shortTitle: Colorize text language: javascript tags: [node,string] cover: plant-corner excerpt: Use special Unicode characters to print text in color in the console. listed: true dateModified: 2024-03-14 --- You've probably seen colored text in the console before, and y...
code_snippets
a77d6d54-5aa6-4494-81f7-021c7a7f1844
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/color-console-output.md
unknown
a68f2593-31c5-4d00-9d59-adfa449a4bf1
1
SemanticChunker@1.0.0
b407bba08bb622d41348afae7874ec0768e6099273706512f3d9de047c9f3f38
```js const colorize = (...args) => ({ black: `\x1b[30m${args.join(' ')}`, red: `\x1b[31m${args.join(' ')}`, green: `\x1b[32m${args.join(' ')}`, yellow: `\x1b[33m${args.join(' ')}`, blue: `\x1b[34m${args.join(' ')}`, magenta: `\x1b[35m${args.join(' ')}`, cyan: `\x1b[36m${args.join(' ')}`, white: `\x1b[37m${args...
unknown
unknown
```js const colorize = (...args) => ({ black: `\x1b[30m${args.join(' ')}`, red: `\x1b[31m${args.join(' ')}`, green: `\x1b[32m${args.join(' ')}`, yellow: `\x1b[33m${args.join(' ')}`, blue: `\x1b[34m${args.join(' ')}`, magenta: `\x1b[35m${args.join(' ')}`, cyan: `\x1b[36m${args.join(' ')}`, white: `\x1b[37m${args...
```js const colorize = (...args) => ({ black: `\x1b[30m${args.join(' ')}`, red: `\x1b[31m${args.join(' ')}`, green: `\x1b[32m${args.join(' ')}`, yellow: `\x1b[33m${args.join(' ')}`, blue: `\x1b[34m${args.join(' ')}`, magenta: `\x1b[35m${args.join(' ')}`, cyan: `\x1b[36m${args.join(' ')}`, white: `\x1b[37m${args...
code_snippets
f426a854-546c-460b-aa10-e82711171168
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/compare-string-case-accent-insensitive.md
unknown
7f7b0abe-8774-4010-97ed-5963f9a672e7
0
SemanticChunker@1.0.0
fb597609888168b5bb598c49eaa52f805fc605b8acb9bb23da7e56223a1a9906
--- title: Compare strings regardless of case and accent shortTitle: Case and accent-insensitive string comparison language: javascript tags: [string,comparison] cover: memories-of-pineapple-1 excerpt: Here's a quick tip on how to compare and sort arrays of strings, ignoring case and accents. listed: true dateModified:...
unknown
unknown
--- title: Compare strings regardless of case and accent shortTitle: Case and accent-insensitive string comparison language: javascript tags: [string,comparison] cover: memories-of-pineapple-1 excerpt: Here's a quick tip on how to compare and sort arrays of strings, ignoring case and accents. listed: true dateModified:...
--- title: Compare strings regardless of case and accent shortTitle: Case and accent-insensitive string comparison language: javascript tags: [string,comparison] cover: memories-of-pineapple-1 excerpt: Here's a quick tip on how to compare and sort arrays of strings, ignoring case and accents. listed: true dateModified:...
code_snippets
f72650f7-6e7a-41a7-8405-2ecc3ccb679b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/combine-object-arrays.md
unknown
c66a0502-f732-48a3-8299-137a0462a965
0
SemanticChunker@1.0.0
c2ea83b785083450fd77b009e2890523eb139da2d370e55b950778eddaacd9c7
--- title: Combine 2 JavaScript object arrays based on a key shortTitle: Combine object arrays language: javascript tags: [array,object] cover: digital-nomad-6 excerpt: Learn how to merge two arrays of objects, while combining objects based on a specified key. listed: true dateModified: 2024-03-26 --- Have you ever ne...
unknown
unknown
--- title: Combine 2 JavaScript object arrays based on a key shortTitle: Combine object arrays language: javascript tags: [array,object] cover: digital-nomad-6 excerpt: Learn how to merge two arrays of objects, while combining objects based on a specified key. listed: true dateModified: 2024-03-26 --- Have you ever ne...
--- title: Combine 2 JavaScript object arrays based on a key shortTitle: Combine object arrays language: javascript tags: [array,object] cover: digital-nomad-6 excerpt: Learn how to merge two arrays of objects, while combining objects based on a specified key. listed: true dateModified: 2024-03-26 --- Have you ever ne...
code_snippets
bb4b8d6a-df83-4a5b-af88-cad0b49da575
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/closures.md
unknown
da2ab4ef-39f9-4e4b-aaf8-a26c0b52cb20
1
SemanticChunker@1.0.0
1068d99b97cdeac8b6b7b02889c44c17daf6a8eb742968ee342956c04ccab404
In this example, we define a function, `initCounter`, that returns an object, whose properties are functions. All of the returned object's properties use closures to manipulate `initCounter`'s `value` variable in some way. The obvious benefit of this approach is that if you want to define multiple counters via `initCou...
unknown
unknown
In this example, we define a function, `initCounter`, that returns an object, whose properties are functions. All of the returned object's properties use closures to manipulate `initCounter`'s `value` variable in some way. The obvious benefit of this approach is that if you want to define multiple counters via `initCou...
In this example, we define a function, `initCounter`, that returns an object, whose properties are functions. All of the returned object's properties use closures to manipulate `initCounter`'s `value` variable in some way. The obvious benefit of this approach is that if you want to define multiple counters via `initCou...
code_snippets
fec1927b-21af-4398-a28e-fcfe0008c1c1
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/closures.md
unknown
da2ab4ef-39f9-4e4b-aaf8-a26c0b52cb20
0
SemanticChunker@1.0.0
2e6c7ef41f4cbf6805ac004b2d3694e2a9df8dbf64617b6bcff7ff99677e97e2
--- title: What are JavaScript closures? shortTitle: Closures introduction language: javascript tags: [function,closure] cover: cherry-trees excerpt: Learn and understand closures, a core concept in JavaScript programming, and level up your code. listed: true dateModified: 2021-06-12 --- Closures are a JavaScript conc...
unknown
unknown
--- title: What are JavaScript closures? shortTitle: Closures introduction language: javascript tags: [function,closure] cover: cherry-trees excerpt: Learn and understand closures, a core concept in JavaScript programming, and level up your code. listed: true dateModified: 2021-06-12 --- Closures are a JavaScript conc...
--- title: What are JavaScript closures? shortTitle: Closures introduction language: javascript tags: [function,closure] cover: cherry-trees excerpt: Learn and understand closures, a core concept in JavaScript programming, and level up your code. listed: true dateModified: 2021-06-12 --- Closures are a JavaScript conc...
code_snippets
01dab0a6-8ce0-4078-925d-9e345b77eb26
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/classical-vs-prototypal-inheritance.md
unknown
2119d93f-b07b-4761-8084-fe1174d81999
0
SemanticChunker@1.0.0
2ef73d1b0db40284e2886a3a317f30b051999e9e8a27a416e539eb2bd98f56ff
--- title: How does JavaScript's prototypal inheritance differ from classical inheritance? shortTitle: Prototypal vs classical inheritance language: javascript tags: [object,class] cover: last-light excerpt: Understanding the difference between these two object-oriented programming paradigms is key to taking your skill...
unknown
unknown
--- title: How does JavaScript's prototypal inheritance differ from classical inheritance? shortTitle: Prototypal vs classical inheritance language: javascript tags: [object,class] cover: last-light excerpt: Understanding the difference between these two object-oriented programming paradigms is key to taking your skill...
--- title: How does JavaScript's prototypal inheritance differ from classical inheritance? shortTitle: Prototypal vs classical inheritance language: javascript tags: [object,class] cover: last-light excerpt: Understanding the difference between these two object-oriented programming paradigms is key to taking your skill...
code_snippets
039f4ea6-3476-4b0a-ab65-a90173b7d819
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/classical-vs-prototypal-inheritance.md
unknown
2119d93f-b07b-4761-8084-fe1174d81999
1
SemanticChunker@1.0.0
85ddcc42ad2dfa52e5033aca95c885a01cd5b40d9b4b9d08a13dc32ccc95de44
[Object-oriented programming] ## Object-oriented programming Both classical and prototypal inheritance are **object-oriented programming paradigms**. Objects in object-oriented programming are abstractions that encapsulate the properties of an entity. This is known as abstraction. When dealing with multiple levels o...
unknown
unknown
[Object-oriented programming] ## Object-oriented programming Both classical and prototypal inheritance are **object-oriented programming paradigms**. Objects in object-oriented programming are abstractions that encapsulate the properties of an entity. This is known as abstraction. When dealing with multiple levels o...
[Object-oriented programming] ## Object-oriented programming Both classical and prototypal inheritance are **object-oriented programming paradigms**. Objects in object-oriented programming are abstractions that encapsulate the properties of an entity. This is known as abstraction. When dealing with multiple levels o...
code_snippets
beea0507-5fd0-409b-89f9-f9177ab77b1f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/classical-vs-prototypal-inheritance.md
unknown
2119d93f-b07b-4761-8084-fe1174d81999
2
SemanticChunker@1.0.0
7cd243e26c58df66e36c1a3b4a6097b819ef123250fad73a9f7d421337564ea3
[Object-oriented programming > Classical inheritance] ## Classical inheritance In classical object-oriented programming, there are two types of abstractions: objects and classes. An object is an abstractions of an entity, while a class is either an abstraction of an object or another class. If we were to model the p...
unknown
unknown
[Object-oriented programming > Classical inheritance] ## Classical inheritance In classical object-oriented programming, there are two types of abstractions: objects and classes. An object is an abstractions of an entity, while a class is either an abstraction of an object or another class. If we were to model the p...
[Object-oriented programming > Classical inheritance] ## Classical inheritance In classical object-oriented programming, there are two types of abstractions: objects and classes. An object is an abstractions of an entity, while a class is either an abstraction of an object or another class. If we were to model the p...
code_snippets
e004bcb1-4ea3-4922-9567-52568b03a6cb
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/classical-vs-prototypal-inheritance.md
unknown
2119d93f-b07b-4761-8084-fe1174d81999
3
SemanticChunker@1.0.0
1abd808d8b3a39ca9fd6f45ed76b3f827d51c5d413eb9b42e3a4e99137e639d9
[Object-oriented programming > Prototypal inheritance] ## Prototypal inheritance In prototypal object-oriented programming, there's only one type of abstraction: objects. Objects are either abstractions of entities or other objects, in which case they're called prototypes. Hence a prototype is a generalization. Obje...
unknown
unknown
[Object-oriented programming > Prototypal inheritance] ## Prototypal inheritance In prototypal object-oriented programming, there's only one type of abstraction: objects. Objects are either abstractions of entities or other objects, in which case they're called prototypes. Hence a prototype is a generalization. Obje...
[Object-oriented programming > Prototypal inheritance] ## Prototypal inheritance In prototypal object-oriented programming, there's only one type of abstraction: objects. Objects are either abstractions of entities or other objects, in which case they're called prototypes. Hence a prototype is a generalization. Obje...
code_snippets
0a796e93-4527-4fb4-9551-b6c8cee26303
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
1
SemanticChunker@1.0.0
28bb7a733f3d68d7d5346d45b5ea39b788e3c9f351277cad5eeeb4b4980ef9f8
[Computed property names] ## Computed property names ES6 computed property names are particularly useful, as they can help you identify logged variables by adding a pair of curly braces around them. ```js const x = 1, y = 2, z = 3; console.log({x, y, z}); // {x: 1, y: 2, z: 3} ```
unknown
unknown
[Computed property names] ## Computed property names ES6 computed property names are particularly useful, as they can help you identify logged variables by adding a pair of curly braces around them. ```js const x = 1, y = 2, z = 3; console.log({x, y, z}); // {x: 1, y: 2, z: 3} ```
[Computed property names] ## Computed property names ES6 computed property names are particularly useful, as they can help you identify logged variables by adding a pair of curly braces around them. ```js const x = 1, y = 2, z = 3; console.log({x, y, z}); // {x: 1, y: 2, z: 3} ```
code_snippets
30e32800-7799-4f5b-a0b2-0ad13735828a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
4
SemanticChunker@1.0.0
40e30cd3ca964ae56c18ba98f22ea7b26d76bee04c4965999e4594b69f30dc2f
[Computed property names > Logging levels] ## Logging levels There are a few more logging levels apart from `console.log()`, such as [`console.debug()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/debug), [`console.info()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/info), [`console.warn()`...
unknown
unknown
[Computed property names > Logging levels] ## Logging levels There are a few more logging levels apart from `console.log()`, such as [`console.debug()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/debug), [`console.info()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/info), [`console.warn()`...
[Computed property names > Logging levels] ## Logging levels There are a few more logging levels apart from `console.log()`, such as [`console.debug()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/debug), [`console.info()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/info), [`console.warn()`...
code_snippets
4d42edb8-97c5-4a1a-a9c6-171d4009ca1c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
5
SemanticChunker@1.0.0
5d80d34f285d80ff0810cf5bdfc97d5b689ebf2ded599dd38d99782ffdb95712
[Computed property names > console.assert()] ## console.assert() [`console.assert()`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert) provides a handy way to only log something as an error when an assertion fails (i.e. when the first argument is `false`), otherwise skip the log entirely. ```js const...
unknown
unknown
[Computed property names > console.assert()] ## console.assert() [`console.assert()`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert) provides a handy way to only log something as an error when an assertion fails (i.e. when the first argument is `false`), otherwise skip the log entirely. ```js const...
[Computed property names > console.assert()] ## console.assert() [`console.assert()`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert) provides a handy way to only log something as an error when an assertion fails (i.e. when the first argument is `false`), otherwise skip the log entirely. ```js const...
code_snippets
8c9e5002-330e-4332-92de-65428860f6c6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
3
SemanticChunker@1.0.0
3397555561531fef98a3519dfc27ec6914133a975810af241dca55bdd21c311c
[Computed property names > console.group()] ## console.group() [`console.group()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/group) allows you to group logs into collapsable structures and is particularly useful when you have multiple logs. ```js console.group('Outer'); // Create a group labelled 'Out...
unknown
unknown
[Computed property names > console.group()] ## console.group() [`console.group()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/group) allows you to group logs into collapsable structures and is particularly useful when you have multiple logs. ```js console.group('Outer'); // Create a group labelled 'Out...
[Computed property names > console.group()] ## console.group() [`console.group()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/group) allows you to group logs into collapsable structures and is particularly useful when you have multiple logs. ```js console.group('Outer'); // Create a group labelled 'Out...
code_snippets
b9116f0e-334c-486d-96f0-17064eb62a19
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
7
SemanticChunker@1.0.0
18e591dfe1bf29466315b50916c86d355d40e7dc7e100db408895bb01b62c0ef
[Computed property names > console.time()] ## console.time() [`console.time()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/time) gives you a quick way to check the performance of your code, but should not be used for real benchmarking due to its low accuracy. ```js console.time('slow comp'); // Start t...
unknown
unknown
[Computed property names > console.time()] ## console.time() [`console.time()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/time) gives you a quick way to check the performance of your code, but should not be used for real benchmarking due to its low accuracy. ```js console.time('slow comp'); // Start t...
[Computed property names > console.time()] ## console.time() [`console.time()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/time) gives you a quick way to check the performance of your code, but should not be used for real benchmarking due to its low accuracy. ```js console.time('slow comp'); // Start t...
code_snippets
c6e4b3ac-86bb-4f7b-80b0-58c9d48b6cd8
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
2
SemanticChunker@1.0.0
99267918c7990cc55d8fbc9bcd4469e71b4dfd10744c12aa2677d11b0adb76a7
[Computed property names > console.trace()] ## console.trace() [`console.trace()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/trace) works the exact same as `console.log()`, but it also outputs the entire stack trace so you know exactly what's going on. ```js const outer = () => { const inner = () => ...
unknown
unknown
[Computed property names > console.trace()] ## console.trace() [`console.trace()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/trace) works the exact same as `console.log()`, but it also outputs the entire stack trace so you know exactly what's going on. ```js const outer = () => { const inner = () => ...
[Computed property names > console.trace()] ## console.trace() [`console.trace()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/trace) works the exact same as `console.log()`, but it also outputs the entire stack trace so you know exactly what's going on. ```js const outer = () => { const inner = () => ...
code_snippets
d1ca245b-1797-40a5-b1e4-918bbff429b8
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
0
SemanticChunker@1.0.0
cccc43f48b051beb84e3b390e52233b32e8a85428cd935b9eec7db5533e7ed6a
--- title: JavaScript console.log() tips & tricks language: javascript tags: [browser,cheatsheet] cover: terminal excerpt: Level up your JavaScript logging with these `console.log()` tips and tricks. listed: true dateModified: 2021-06-12 --- Everyone uses the JavaScript console for logging or debugging every once in a...
unknown
unknown
--- title: JavaScript console.log() tips & tricks language: javascript tags: [browser,cheatsheet] cover: terminal excerpt: Level up your JavaScript logging with these `console.log()` tips and tricks. listed: true dateModified: 2021-06-12 --- Everyone uses the JavaScript console for logging or debugging every once in a...
--- title: JavaScript console.log() tips & tricks language: javascript tags: [browser,cheatsheet] cover: terminal excerpt: Level up your JavaScript logging with these `console.log()` tips and tricks. listed: true dateModified: 2021-06-12 --- Everyone uses the JavaScript console for logging or debugging every once in a...
code_snippets
d52c1dcc-df1c-49cc-bf13-731b5a7c6bd4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
6
SemanticChunker@1.0.0
9ad63016141ab52196cc29cb8c3dd3a8c61c89757eddc5a64bd34cd79d414542
[Computed property names > console.count()] ## console.count() You can use [`console.count()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/count) to count how many times a piece of code has executed. ```js Array.from({ length: 4 }).forEach( () => console.count('items') // Call the counter labelled 'ite...
unknown
unknown
[Computed property names > console.count()] ## console.count() You can use [`console.count()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/count) to count how many times a piece of code has executed. ```js Array.from({ length: 4 }).forEach( () => console.count('items') // Call the counter labelled 'ite...
[Computed property names > console.count()] ## console.count() You can use [`console.count()`](https://developer.mozilla.org/en-US/docs/Web/API/Console/count) to count how many times a piece of code has executed. ```js Array.from({ length: 4 }).forEach( () => console.count('items') // Call the counter labelled 'ite...
code_snippets
e6cb47b1-4fa1-4f11-9dde-b7d226d4174c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/console-log-cheatsheet.md
unknown
220d8aee-1c9d-400c-9d95-83dd4f97083a
8
SemanticChunker@1.0.0
ccc4c20249116851429ae02ab3f3e4df8e79333fbb4a4f0ce8a60243fe4db62d
[Computed property names > CSS] ## CSS Last but not least, you can use the `%c` string substitution expression in `console.log()` to apply CSS to parts of a log. ```js console.log( 'CSS can make %cyour console logs%c %cawesome%c!', // String to format // Each string is the CSS to apply for each consecutive %c 'co...
unknown
unknown
[Computed property names > CSS] ## CSS Last but not least, you can use the `%c` string substitution expression in `console.log()` to apply CSS to parts of a log. ```js console.log( 'CSS can make %cyour console logs%c %cawesome%c!', // String to format // Each string is the CSS to apply for each consecutive %c 'co...
[Computed property names > CSS] ## CSS Last but not least, you can use the `%c` string substitution expression in `console.log()` to apply CSS to parts of a log. ```js console.log( 'CSS can make %cyour console logs%c %cawesome%c!', // String to format // Each string is the CSS to apply for each consecutive %c 'co...
code_snippets
15590977-7710-4074-95f1-782628fd4542
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-scopes.md
unknown
86af772d-5755-4b58-894c-26f243c26da6
9
SemanticChunker@1.0.0
a40018175b321926871af3f1dda683e81edf58c31656c9e37191d2f1fbd247b6
[Directory structure > Attribute caching] ``` This change is minor and seems like we're optimizing the code, but we're rather making it a little slower, if anything. Why is that? If you remember from the previous article, the `isPublished` attribute is **calculated** from some data that exists on the model. The data ...
unknown
unknown
[Directory structure > Attribute caching] ``` This change is minor and seems like we're optimizing the code, but we're rather making it a little slower, if anything. Why is that? If you remember from the previous article, the `isPublished` attribute is **calculated** from some data that exists on the model. The data ...
[Directory structure > Attribute caching] ``` This change is minor and seems like we're optimizing the code, but we're rather making it a little slower, if anything. Why is that? If you remember from the previous article, the `isPublished` attribute is **calculated** from some data that exists on the model. The data ...
code_snippets
20975788-d076-4851-a86d-0d85c7c68471
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-scopes.md
unknown
86af772d-5755-4b58-894c-26f243c26da6
12
SemanticChunker@1.0.0
6799f4e7858936f4c1f4a47fb49a3472ab230aee8d4e01f19c0da3ba97023b07
[Directory structure > Addendum: Code summary] ## Addendum: Code summary As per tradition, the complete implementation up until this point can be found below. This is a good place to pick up from in future installments. You can also [browse through the Code Reference on GitHub](https://github.com/Chalarangelo/mini-a...
unknown
unknown
[Directory structure > Addendum: Code summary] ## Addendum: Code summary As per tradition, the complete implementation up until this point can be found below. This is a good place to pick up from in future installments. You can also [browse through the Code Reference on GitHub](https://github.com/Chalarangelo/mini-a...
[Directory structure > Addendum: Code summary] ## Addendum: Code summary As per tradition, the complete implementation up until this point can be found below. This is a good place to pick up from in future installments. You can also [browse through the Code Reference on GitHub](https://github.com/Chalarangelo/mini-a...
code_snippets
26e301b5-1f1c-43a2-824a-4d0dda5ceddc
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-scopes.md
unknown
86af772d-5755-4b58-894c-26f243c26da6
14
SemanticChunker@1.0.0
60913e7dbac9ed8122d1869f63098adde4063806f291cedce3643063d8786bf1
[Directory structure > Addendum: Code summary] constructor(data) { super(data); this.id = data.id; this.title = data.title; this.content = data.content; this.publishedAt = data.publishedAt; this.authorId = data.authorId; } static published(records) { return records.where({ isPublished: true }); } static b...
unknown
unknown
[Directory structure > Addendum: Code summary] constructor(data) { super(data); this.id = data.id; this.title = data.title; this.content = data.content; this.publishedAt = data.publishedAt; this.authorId = data.authorId; } static published(records) { return records.where({ isPublished: true }); } static b...
[Directory structure > Addendum: Code summary] constructor(data) { super(data); this.id = data.id; this.title = data.title; this.content = data.content; this.publishedAt = data.publishedAt; this.authorId = data.authorId; } static published(records) { return records.where({ isPublished: true }); } static b...
code_snippets
3a557c76-ac58-4b40-b065-ac5359be178e
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-scopes.md
unknown
86af772d-5755-4b58-894c-26f243c26da6
6
SemanticChunker@1.0.0
1d0d07928e2fb8a7ed80e1e409cef65b71d704b22200a83581504729b12fcc19
[Scope chaining > Basic chaining] ### Basic chaining Chaining two scopes is relatively simple. We need only call the first scope and pass the result to the second scope. Let's chain the `published` and `byNew` scopes together: ```js // Consider the posts from the previous samples and the same current date const publ...
unknown
unknown
[Scope chaining > Basic chaining] ### Basic chaining Chaining two scopes is relatively simple. We need only call the first scope and pass the result to the second scope. Let's chain the `published` and `byNew` scopes together: ```js // Consider the posts from the previous samples and the same current date const publ...
[Scope chaining > Basic chaining] ### Basic chaining Chaining two scopes is relatively simple. We need only call the first scope and pass the result to the second scope. Let's chain the `published` and `byNew` scopes together: ```js // Consider the posts from the previous samples and the same current date const publ...
code_snippets
440ea627-d8c4-48eb-b4bf-b02c61f0cd32
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-scopes.md
unknown
86af772d-5755-4b58-894c-26f243c26da6
8
SemanticChunker@1.0.0
3e5ffd9d1b6342b619c41d032ef29a9122078e7af332f7144c0bde1dde69c80e
[Directory structure > Attribute caching] ## Attribute caching Before we wrap this up, I'd like to make some minor adjustments around the codebase. In the `published` scope, we didn't use the `isPublished` calculated attribute, but relied on the `publishedAt` data attribute. This might be prudent in some cases, as t...
unknown
unknown
[Directory structure > Attribute caching] ## Attribute caching Before we wrap this up, I'd like to make some minor adjustments around the codebase. In the `published` scope, we didn't use the `isPublished` calculated attribute, but relied on the `publishedAt` data attribute. This might be prudent in some cases, as t...
[Directory structure > Attribute caching] ## Attribute caching Before we wrap this up, I'd like to make some minor adjustments around the codebase. In the `published` scope, we didn't use the `isPublished` calculated attribute, but relied on the `publishedAt` data attribute. This might be prudent in some cases, as t...
code_snippets