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
f2c961dc-850b-4f55-be60-484f54d47f02
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/rgb-hex-hsl-hsb-color-format-conversion.md
unknown
4f7b388c-3f58-4cec-8ffb-e35048c1bfd4
2
SemanticChunker@1.0.0
9cc3776a3dc6c2be23833b8ec689495ba946907580b6b99b7151c2ec79302cc4
[Color formats > RGB to hexadecimal] ## RGB to hexadecimal Converting between RGB and hexadecimal color formats is a matter of **converting the red, green and blue components to their hexadecimal representation**. This can be done using `Number.prototype.toString()` combined with the `<<` (left-shift) operator to con...
unknown
unknown
[Color formats > RGB to hexadecimal] ## RGB to hexadecimal Converting between RGB and hexadecimal color formats is a matter of **converting the red, green and blue components to their hexadecimal representation**. This can be done using `Number.prototype.toString()` combined with the `<<` (left-shift) operator to con...
[Color formats > RGB to hexadecimal] ## RGB to hexadecimal Converting between RGB and hexadecimal color formats is a matter of **converting the red, green and blue components to their hexadecimal representation**. This can be done using `Number.prototype.toString()` combined with the `<<` (left-shift) operator to con...
code_snippets
06a1dcd8-a506-4139-bab2-90a27959f36e
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sort-array-of-objects.md
unknown
ed3af732-0171-43d2-9df9-021f1996c456
3
SemanticChunker@1.0.0
741b6c390f38bbef73ad4fe6bf51dafe2a0af1539d040ceffd6d78f2af7faee1
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by properties and orders] ```js const orderBy = (arr, props, orders) => [...arr].sort((a, b) => props.reduce((acc, prop, i) => { if (acc === 0) { const [p1, p2] = orders && orders[i] <= 0 ? [b[prop], a[prop]] : [a[p...
unknown
unknown
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by properties and orders] ```js const orderBy = (arr, props, orders) => [...arr].sort((a, b) => props.reduce((acc, prop, i) => { if (acc === 0) { const [p1, p2] = orders && orders[i] <= 0 ? [b[prop], a[prop]] : [a[p...
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by properties and orders] ```js const orderBy = (arr, props, orders) => [...arr].sort((a, b) => props.reduce((acc, prop, i) => { if (acc === 0) { const [p1, p2] = orders && orders[i] <= 0 ? [b[prop], a[prop]] : [a[p...
code_snippets
1f897eae-b216-4b98-8d31-771f3a3da3f4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sort-array-of-objects.md
unknown
ed3af732-0171-43d2-9df9-021f1996c456
2
SemanticChunker@1.0.0
1dd62e0fa6cd23d95ede14a839fd30ee477aca44f2ef1fd06e4cab23b1cd893b
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by properties and orders] ## Sort an array of objects, ordered by properties and orders Another classic scenario hints back at SQL queries, where you can order by multiple columns and specify the order for each column. Th...
unknown
unknown
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by properties and orders] ## Sort an array of objects, ordered by properties and orders Another classic scenario hints back at SQL queries, where you can order by multiple columns and specify the order for each column. Th...
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by properties and orders] ## Sort an array of objects, ordered by properties and orders Another classic scenario hints back at SQL queries, where you can order by multiple columns and specify the order for each column. Th...
code_snippets
20a71201-87b6-4ace-8985-e4f02cf10d06
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sort-array-of-objects.md
unknown
ed3af732-0171-43d2-9df9-021f1996c456
1
SemanticChunker@1.0.0
36c544c488f1b52114eadc30816fb93aeebf617e58e62f0433214d69e7fc87ca
[Sort an array of objects alphabetically based on a property] ## Sort an array of objects alphabetically based on a property The simplest use-case is to sort an array of objects **alphabetically** based on a given property. This is a common requirement, and it's a good starting point for our solution. Using `Array.p...
unknown
unknown
[Sort an array of objects alphabetically based on a property] ## Sort an array of objects alphabetically based on a property The simplest use-case is to sort an array of objects **alphabetically** based on a given property. This is a common requirement, and it's a good starting point for our solution. Using `Array.p...
[Sort an array of objects alphabetically based on a property] ## Sort an array of objects alphabetically based on a property The simplest use-case is to sort an array of objects **alphabetically** based on a given property. This is a common requirement, and it's a good starting point for our solution. Using `Array.p...
code_snippets
626d6983-1aa1-48be-a46a-ebd21e5b0763
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sort-array-of-objects.md
unknown
ed3af732-0171-43d2-9df9-021f1996c456
0
SemanticChunker@1.0.0
45cd639e1fe0cab137db248cd857c4fbdd40967947beda22c8195ed38e321e90
--- title: Sort an array of objects in JavaScript shortTitle: Sort array of objects language: javascript tags: [object,array] cover: volcano-sunset excerpt: Ever wanted to sort an array of objects, but felt like it was too complex? Here's a robust solution for just that. listed: true dateModified: 2024-01-15 --- Ever ...
unknown
unknown
--- title: Sort an array of objects in JavaScript shortTitle: Sort array of objects language: javascript tags: [object,array] cover: volcano-sunset excerpt: Ever wanted to sort an array of objects, but felt like it was too complex? Here's a robust solution for just that. listed: true dateModified: 2024-01-15 --- Ever ...
--- title: Sort an array of objects in JavaScript shortTitle: Sort array of objects language: javascript tags: [object,array] cover: volcano-sunset excerpt: Ever wanted to sort an array of objects, but felt like it was too complex? Here's a robust solution for just that. listed: true dateModified: 2024-01-15 --- Ever ...
code_snippets
e8e168e6-b6eb-4513-b735-570b12b99a9f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sort-array-of-objects.md
unknown
ed3af732-0171-43d2-9df9-021f1996c456
4
SemanticChunker@1.0.0
f4e5fe61ed99c18dca4754518078b1f5c7cb8513d1d76f713c9be45363eacb28
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by a property order] ## Sort an array of objects, ordered by a property order Another use-case for an object sorting algorithm is to sort an array of objects based on a **property order**. This could be a priority order, ...
unknown
unknown
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by a property order] ## Sort an array of objects, ordered by a property order Another use-case for an object sorting algorithm is to sort an array of objects based on a **property order**. This could be a priority order, ...
[Sort an array of objects alphabetically based on a property > Sort an array of objects, ordered by a property order] ## Sort an array of objects, ordered by a property order Another use-case for an object sorting algorithm is to sort an array of objects based on a **property order**. This could be a priority order, ...
code_snippets
1be9805f-5126-4988-9a16-1d664300a315
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
6
SemanticChunker@1.0.0
2ad9dbcf5699ff500b5fda01a2dd8c042016c0e4ab30fd3a6d5e04f1cd232688
[Interpreter implementation > Pointer movement] ### Pointer movement The **pointer movement function** is fairly similar, but handles both left and right movements. We won't check if the pointer is within bounds here, as we'll do that in the main interpreter loop, using the `boundCheck` function from earlier. ```js ...
unknown
unknown
[Interpreter implementation > Pointer movement] ### Pointer movement The **pointer movement function** is fairly similar, but handles both left and right movements. We won't check if the pointer is within bounds here, as we'll do that in the main interpreter loop, using the `boundCheck` function from earlier. ```js ...
[Interpreter implementation > Pointer movement] ### Pointer movement The **pointer movement function** is fairly similar, but handles both left and right movements. We won't check if the pointer is within bounds here, as we'll do that in the main interpreter loop, using the `boundCheck` function from earlier. ```js ...
code_snippets
2403eebb-1c44-47bb-ae61-ef2f10612c95
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
16
SemanticChunker@1.0.0
b295f31f9231b16a2d23a44e948ecb9d3cf334bedb09649761c8694d0e001f0c
[Language introduction > Addendum: Code summary] ```js // Termination conditions (curried functions) const boundCheck = length => n => n < 0 || n >= length; const codeCompleteCheck = length => n => n == length; // Input parsing functions (tape and code) const parseTape = tape => tape.split(''); const parseCode = code...
unknown
unknown
[Language introduction > Addendum: Code summary] ```js // Termination conditions (curried functions) const boundCheck = length => n => n < 0 || n >= length; const codeCompleteCheck = length => n => n == length; // Input parsing functions (tape and code) const parseTape = tape => tape.split(''); const parseCode = code...
[Language introduction > Addendum: Code summary] ```js // Termination conditions (curried functions) const boundCheck = length => n => n < 0 || n >= length; const codeCompleteCheck = length => n => n == length; // Input parsing functions (tape and code) const parseTape = tape => tape.split(''); const parseCode = code...
code_snippets
2e44657c-a080-4b3b-856b-770d9139eee2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
11
SemanticChunker@1.0.0
d91c205aa08f741154d411103a34be8d8d6bfa5cf8dfe2cd561cb534cc8846be
[Optimizations > Bit flipping optimization] ### Bit flipping optimization Up until this point we've been interpreting sequences of **consecutive** `*` commands by flipping the bit at the current tape position. However, we can optimize this by counting the number of `*` commands and **flipping the bit only if the coun...
unknown
unknown
[Optimizations > Bit flipping optimization] ### Bit flipping optimization Up until this point we've been interpreting sequences of **consecutive** `*` commands by flipping the bit at the current tape position. However, we can optimize this by counting the number of `*` commands and **flipping the bit only if the coun...
[Optimizations > Bit flipping optimization] ### Bit flipping optimization Up until this point we've been interpreting sequences of **consecutive** `*` commands by flipping the bit at the current tape position. However, we can optimize this by counting the number of `*` commands and **flipping the bit only if the coun...
code_snippets
2fa46c69-4ac8-4ed1-b31a-ba495063a6d3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
9
SemanticChunker@1.0.0
c5b0c3f80f04f13ba851bca3fad0147d146a2b8ae035b7cf2abb796fdafa7a4e
[Interpreter implementation > Revised interpreter loop] ### Revised interpreter loop Now that we have all the pieces in place, we can revise the main interpreter loop to include the loop interpretation function. ```js const smallfuckInterpreter = (code, tape) => { const tapeData = parseTape(tape); const codeData =...
unknown
unknown
[Interpreter implementation > Revised interpreter loop] ### Revised interpreter loop Now that we have all the pieces in place, we can revise the main interpreter loop to include the loop interpretation function. ```js const smallfuckInterpreter = (code, tape) => { const tapeData = parseTape(tape); const codeData =...
[Interpreter implementation > Revised interpreter loop] ### Revised interpreter loop Now that we have all the pieces in place, we can revise the main interpreter loop to include the loop interpretation function. ```js const smallfuckInterpreter = (code, tape) => { const tapeData = parseTape(tape); const codeData =...
code_snippets
5cbd1650-7e80-4f58-919d-47242379181b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
17
SemanticChunker@1.0.0
34d6085b237cd67b8501f65871eb5c3d98e31288562d1d808accac940b957e26
[Language introduction > Addendum: Code summary] ```js // [continued: part 1] // Main interpreter function const smallfuckInterpreter = (code, tape) => { // Parse input data const tapeData = parseTape(tape); const codeData = parseCode(code); // Prepare termination conditions, loop pairs, and loop interpreter con...
unknown
unknown
[Language introduction > Addendum: Code summary] ```js // [continued: part 1] // Main interpreter function const smallfuckInterpreter = (code, tape) => { // Parse input data const tapeData = parseTape(tape); const codeData = parseCode(code); // Prepare termination conditions, loop pairs, and loop interpreter con...
[Language introduction > Addendum: Code summary] ```js // [continued: part 1] // Main interpreter function const smallfuckInterpreter = (code, tape) => { // Parse input data const tapeData = parseTape(tape); const codeData = parseCode(code); // Prepare termination conditions, loop pairs, and loop interpreter con...
code_snippets
76df4cc7-9297-4e8e-a566-e97d29edd3c6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
5
SemanticChunker@1.0.0
b9c8d823969c2614a047d022c037fabf269b0651ea4358fbb738ae549f2356d2
[Interpreter implementation > Bit flipping] ### Bit flipping We'll split the interpreter into smaller, readable blocks. For the **bit flipping function**, we'll need the symbol, pointer and tape as arguments. As the tape is an array and [is passed by reference](/js/s/pass-by-reference-or-pass-by-value), we can direct...
unknown
unknown
[Interpreter implementation > Bit flipping] ### Bit flipping We'll split the interpreter into smaller, readable blocks. For the **bit flipping function**, we'll need the symbol, pointer and tape as arguments. As the tape is an array and [is passed by reference](/js/s/pass-by-reference-or-pass-by-value), we can direct...
[Interpreter implementation > Bit flipping] ### Bit flipping We'll split the interpreter into smaller, readable blocks. For the **bit flipping function**, we'll need the symbol, pointer and tape as arguments. As the tape is an array and [is passed by reference](/js/s/pass-by-reference-or-pass-by-value), we can direct...
code_snippets
7af7e121-1214-4e4a-b571-d1dadc51354f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
2
SemanticChunker@1.0.0
d27debbd6f4f5b5d81f60aa7bf9988590eedbfa2b61bca6e496afe374418eb9c
[Language introduction > Interpreter implementation] ## Interpreter implementation Instead of throwing a solution at you and trying to explain it, I'll start by building **smaller subsets of the interpreter** and explaining them as I go. This way, you'll understand the solution better and be able to follow along more...
unknown
unknown
[Language introduction > Interpreter implementation] ## Interpreter implementation Instead of throwing a solution at you and trying to explain it, I'll start by building **smaller subsets of the interpreter** and explaining them as I go. This way, you'll understand the solution better and be able to follow along more...
[Language introduction > Interpreter implementation] ## Interpreter implementation Instead of throwing a solution at you and trying to explain it, I'll start by building **smaller subsets of the interpreter** and explaining them as I go. This way, you'll understand the solution better and be able to follow along more...
code_snippets
7be8a3e0-3890-4493-99d4-ca19c65d20f8
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
7
SemanticChunker@1.0.0
f42be0b04be28c0037a99a894507e34dddac288da1da464d55fe6d5a5b1764f4
[Interpreter implementation > Interpreter loop] ### Interpreter loop At this point, we have the building blocks needed to solve some simple examples, yet we don't have the **interpreter loop** itself. We'll write a function that takes the **tape and code as arguments** and **returns the final tape state**. ```js con...
unknown
unknown
[Interpreter implementation > Interpreter loop] ### Interpreter loop At this point, we have the building blocks needed to solve some simple examples, yet we don't have the **interpreter loop** itself. We'll write a function that takes the **tape and code as arguments** and **returns the final tape state**. ```js con...
[Interpreter implementation > Interpreter loop] ### Interpreter loop At this point, we have the building blocks needed to solve some simple examples, yet we don't have the **interpreter loop** itself. We'll write a function that takes the **tape and code as arguments** and **returns the final tape state**. ```js con...
code_snippets
8d941eb7-1ee5-414a-9b12-094fa78ffde0
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
15
SemanticChunker@1.0.0
86ba98bdfd4e551fac11327e8d9f128614f8ff857afb1ef39a564e91fbcdd2f4
[Language introduction > Addendum: Code summary] ## Addendum: Code summary The entire interpreter code is summarized below, with comments added for clarity: <details> <summary>View the complete implementation</summary>
unknown
unknown
[Language introduction > Addendum: Code summary] ## Addendum: Code summary The entire interpreter code is summarized below, with comments added for clarity: <details> <summary>View the complete implementation</summary>
[Language introduction > Addendum: Code summary] ## Addendum: Code summary The entire interpreter code is summarized below, with comments added for clarity: <details> <summary>View the complete implementation</summary>
code_snippets
9e5e146d-e418-4f6c-840b-ee1362964cce
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
0
SemanticChunker@1.0.0
139c8e89cc8a55e442da3740b9f60cd1fc9f2fb478d3d93178cbd5400965b739
--- title: Implementing a Smallfuck Interpreter in JavaScript shortTitle: Smallfuck Interpreter language: javascript tags: [algorithm] cover: rustic-cup excerpt: Yet another interpreter article, this time around we'll be building a full-fledged interpreter for the esolang Smallfuck. listed: true dateModified: 2025-02-2...
unknown
unknown
--- title: Implementing a Smallfuck Interpreter in JavaScript shortTitle: Smallfuck Interpreter language: javascript tags: [algorithm] cover: rustic-cup excerpt: Yet another interpreter article, this time around we'll be building a full-fledged interpreter for the esolang Smallfuck. listed: true dateModified: 2025-02-2...
--- title: Implementing a Smallfuck Interpreter in JavaScript shortTitle: Smallfuck Interpreter language: javascript tags: [algorithm] cover: rustic-cup excerpt: Yet another interpreter article, this time around we'll be building a full-fledged interpreter for the esolang Smallfuck. listed: true dateModified: 2025-02-2...
code_snippets
bee924a0-f440-4a15-895f-590e8b557c67
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
3
SemanticChunker@1.0.0
366253b6ef4b5861454e60de3fd818922cd84900ac4ed142c2378e6aaa87203f
[Interpreter implementation > Termination conditions] ### Termination conditions We'll first start by writing two functions for termination conditions. The `boundCheck` function will check if the **pointer is within the bounds of the tape**, and the `codeCompleteCheck` function will check if the **program has reached...
unknown
unknown
[Interpreter implementation > Termination conditions] ### Termination conditions We'll first start by writing two functions for termination conditions. The `boundCheck` function will check if the **pointer is within the bounds of the tape**, and the `codeCompleteCheck` function will check if the **program has reached...
[Interpreter implementation > Termination conditions] ### Termination conditions We'll first start by writing two functions for termination conditions. The `boundCheck` function will check if the **pointer is within the bounds of the tape**, and the `codeCompleteCheck` function will check if the **program has reached...
code_snippets
c20f7e4c-dcd2-4b29-88b5-c9932cfb63d2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
8
SemanticChunker@1.0.0
a1f971fdb280ccd150476b1f30bb067401d46c2f5a99b76184a5ad70ff81c7bf
[Interpreter implementation > Matching brackets] ### Matching brackets The last piece of the puzzle is handling the `[` and `]` commands. This is the most complicated part of the interpreter, but luckily, we've already built the building blocks needed to solve it in the [matching bracket pairs article](/js/s/find-mat...
unknown
unknown
[Interpreter implementation > Matching brackets] ### Matching brackets The last piece of the puzzle is handling the `[` and `]` commands. This is the most complicated part of the interpreter, but luckily, we've already built the building blocks needed to solve it in the [matching bracket pairs article](/js/s/find-mat...
[Interpreter implementation > Matching brackets] ### Matching brackets The last piece of the puzzle is handling the `[` and `]` commands. This is the most complicated part of the interpreter, but luckily, we've already built the building blocks needed to solve it in the [matching bracket pairs article](/js/s/find-mat...
code_snippets
c810a22d-d6a1-4f39-afe1-a4b996ef0bb4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
14
SemanticChunker@1.0.0
aa178f2e6b07055a1146e9a38fed63ee0be27763e7789fbda1e01624c8792c6e
[Language introduction > Conclusion] ## Conclusion In this article, we've built a full-fledged interpreter for the Smallfuck esolang. We've started by building smaller building blocks, then combined them to create the main interpreter loop. We've also looked into optimizations that can be applied to the interpreter t...
unknown
unknown
[Language introduction > Conclusion] ## Conclusion In this article, we've built a full-fledged interpreter for the Smallfuck esolang. We've started by building smaller building blocks, then combined them to create the main interpreter loop. We've also looked into optimizations that can be applied to the interpreter t...
[Language introduction > Conclusion] ## Conclusion In this article, we've built a full-fledged interpreter for the Smallfuck esolang. We've started by building smaller building blocks, then combined them to create the main interpreter loop. We've also looked into optimizations that can be applied to the interpreter t...
code_snippets
c9d85981-20bd-49d6-b5ac-12e151f23e86
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
13
SemanticChunker@1.0.0
ac7c7b4a2b6ed26ce2018a6974d849d0b491c6a2f9619281103e4c468a481529
[Optimizations > Pointer movement optimization] Both of these optimizations should work **inside loops** as well, as they don't change the semantics of the language. They should also improve the performance of the interpreter, especially for programs with long sequences of `*`, `>`, or `<` commands.
unknown
unknown
[Optimizations > Pointer movement optimization] Both of these optimizations should work **inside loops** as well, as they don't change the semantics of the language. They should also improve the performance of the interpreter, especially for programs with long sequences of `*`, `>`, or `<` commands.
[Optimizations > Pointer movement optimization] Both of these optimizations should work **inside loops** as well, as they don't change the semantics of the language. They should also improve the performance of the interpreter, especially for programs with long sequences of `*`, `>`, or `<` commands.
code_snippets
d7f82731-f8f5-4541-bcd3-effd9b29f4f7
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
4
SemanticChunker@1.0.0
924ffc69217ad4eaddc36e4bf9d6edbfabbaf5230b729b7b459ea8c01bc92c20
[Interpreter implementation > Input parsing] ### Input parsing Next up, we want to **parse the input** given to our interpreter function. For the tape, this is a simple matter of splitting the input string into an **array of characters** (we'll see why in a little bit). As it's fairly inefficient to map the character...
unknown
unknown
[Interpreter implementation > Input parsing] ### Input parsing Next up, we want to **parse the input** given to our interpreter function. For the tape, this is a simple matter of splitting the input string into an **array of characters** (we'll see why in a little bit). As it's fairly inefficient to map the character...
[Interpreter implementation > Input parsing] ### Input parsing Next up, we want to **parse the input** given to our interpreter function. For the tape, this is a simple matter of splitting the input string into an **array of characters** (we'll see why in a little bit). As it's fairly inefficient to map the character...
code_snippets
e747eecd-f3bf-4d99-b1b6-5d1106e1dae5
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
1
SemanticChunker@1.0.0
cbba97dfa06b4474877dd0738cb5acdf778c9fa3df4546a5a2a46397d0862eaa
[Language introduction] ## Language introduction The [Smallfuck](https://esolangs.org/wiki/Smallfuck) language is a minimalist, <dfn title="A Turing-complete system can solve any computational problem given enough time and memory">**Turing-complete**</dfn> esolang. It operates on an array of bits, the **tape**, provi...
unknown
unknown
[Language introduction] ## Language introduction The [Smallfuck](https://esolangs.org/wiki/Smallfuck) language is a minimalist, <dfn title="A Turing-complete system can solve any computational problem given enough time and memory">**Turing-complete**</dfn> esolang. It operates on an array of bits, the **tape**, provi...
[Language introduction] ## Language introduction The [Smallfuck](https://esolangs.org/wiki/Smallfuck) language is a minimalist, <dfn title="A Turing-complete system can solve any computational problem given enough time and memory">**Turing-complete**</dfn> esolang. It operates on an array of bits, the **tape**, provi...
code_snippets
e8a3354c-bc9e-496f-a024-002f14c08217
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
10
SemanticChunker@1.0.0
0cb148b9d4d4b5870e05915e85ef42ec78bc912e22c354b1a09e1ccb88b9ad94
[Language introduction > Optimizations] ## Optimizations Now that we have a working interpreter, we can look into **optimizations**. These will make our interpreter faster and more efficient. We'll look into two optimizations: **bit flipping** and **pointer movement**, the most common commands in Smallfuck programs.
unknown
unknown
[Language introduction > Optimizations] ## Optimizations Now that we have a working interpreter, we can look into **optimizations**. These will make our interpreter faster and more efficient. We'll look into two optimizations: **bit flipping** and **pointer movement**, the most common commands in Smallfuck programs.
[Language introduction > Optimizations] ## Optimizations Now that we have a working interpreter, we can look into **optimizations**. These will make our interpreter faster and more efficient. We'll look into two optimizations: **bit flipping** and **pointer movement**, the most common commands in Smallfuck programs.
code_snippets
f032db8d-6c79-461e-b393-5cc50a824411
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/smallfuck-interpreter.md
unknown
b1d9d63c-7d06-4882-8b10-9bd23fc445fc
12
SemanticChunker@1.0.0
cdcb5ec8c61e1a4eeb5df6cab07ac19f034037dc79f2992ad4af6822af0507f2
[Optimizations > Pointer movement optimization] ### Pointer movement optimization Similar to the bit flipping optimization, we can optimize the **pointer movement commands**. We'll be updating the `parseCode` function yet again, only this time we'll convert the `code` to an array. Then, we'll replace sequences of `>`...
unknown
unknown
[Optimizations > Pointer movement optimization] ### Pointer movement optimization Similar to the bit flipping optimization, we can optimize the **pointer movement commands**. We'll be updating the `parseCode` function yet again, only this time we'll convert the `code` to an array. Then, we'll replace sequences of `>`...
[Optimizations > Pointer movement optimization] ### Pointer movement optimization Similar to the bit flipping optimization, we can optimize the **pointer movement commands**. We'll be updating the `parseCode` function yet again, only this time we'll convert the `code` to an array. Then, we'll replace sequences of `>`...
code_snippets
0ef58091-05bb-45b8-9ff9-28c5e57d3a42
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sleep.md
unknown
3b0645c9-fee2-4001-a5cb-d167e99db45d
1
SemanticChunker@1.0.0
14cb0395961eca8fddb74d75370e40b460c545d98eb53e9d7930caa9b916f8fe
[Using `setTimeout()`] ## Using `setTimeout()` JavaScript's `setTimeout()` sets a timer which **executes some code once the timer expires**. Only the code inside the `setTimeout()` callback will execute after the timer expires. This can lead to nesting issues, as well as code executing out of order if you are not car...
unknown
unknown
[Using `setTimeout()`] ## Using `setTimeout()` JavaScript's `setTimeout()` sets a timer which **executes some code once the timer expires**. Only the code inside the `setTimeout()` callback will execute after the timer expires. This can lead to nesting issues, as well as code executing out of order if you are not car...
[Using `setTimeout()`] ## Using `setTimeout()` JavaScript's `setTimeout()` sets a timer which **executes some code once the timer expires**. Only the code inside the `setTimeout()` callback will execute after the timer expires. This can lead to nesting issues, as well as code executing out of order if you are not car...
code_snippets
72a50341-20dd-4d63-a4f1-0163c05565d4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sleep.md
unknown
3b0645c9-fee2-4001-a5cb-d167e99db45d
0
SemanticChunker@1.0.0
ca6dffb5df9ecc9177b40020a63e27a51d1fbf3fa09355e7809a23c25b0cb489
--- title: How can I implement a sleep function in JavaScript? shortTitle: Sleep function language: javascript tags: [date,promises] cover: sleepy-cat excerpt: Learn how you can implement a delay function using `setTimeout()`, promises and `async`/`await`. listed: true dateModified: 2024-01-05 --- JavaScript **doesn't...
unknown
unknown
--- title: How can I implement a sleep function in JavaScript? shortTitle: Sleep function language: javascript tags: [date,promises] cover: sleepy-cat excerpt: Learn how you can implement a delay function using `setTimeout()`, promises and `async`/`await`. listed: true dateModified: 2024-01-05 --- JavaScript **doesn't...
--- title: How can I implement a sleep function in JavaScript? shortTitle: Sleep function language: javascript tags: [date,promises] cover: sleepy-cat excerpt: Learn how you can implement a delay function using `setTimeout()`, promises and `async`/`await`. listed: true dateModified: 2024-01-05 --- JavaScript **doesn't...
code_snippets
d959f1fa-b7ba-4081-a640-515ac034261f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sleep.md
unknown
3b0645c9-fee2-4001-a5cb-d167e99db45d
2
SemanticChunker@1.0.0
ed55a5af1361d2e28489327593a9784d8d76bab3f34744af9bd3b6def298b565
[Using `setTimeout()` > Asynchronous version, using promises] ## Asynchronous version, using promises Another way to go about implementing a `sleep()` function is to utilize the `async` and `await` keywords, a `Promise` and `setTimeout()`. Note that the resulting function is itself asynchronous. @[You might also lik...
unknown
unknown
[Using `setTimeout()` > Asynchronous version, using promises] ## Asynchronous version, using promises Another way to go about implementing a `sleep()` function is to utilize the `async` and `await` keywords, a `Promise` and `setTimeout()`. Note that the resulting function is itself asynchronous. @[You might also lik...
[Using `setTimeout()` > Asynchronous version, using promises] ## Asynchronous version, using promises Another way to go about implementing a `sleep()` function is to utilize the `async` and `await` keywords, a `Promise` and `setTimeout()`. Note that the resulting function is itself asynchronous. @[You might also lik...
code_snippets
5078552f-399c-4398-b92d-523b65e4bf95
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/show-hide-html-elements.md
unknown
631c28e1-4153-41a3-a339-03a0ea4bf932
2
SemanticChunker@1.0.0
1a33b4e87df606d5264f9e4f228558b882ddc29f8de88bd2c176604758a80176
[Hide HTML elements > Show HTML elements] ## Show HTML elements Most HTML elements have a default `display` property value. For example, the default value for `<div>` elements is `block`, while the default value for `<span>` elements is `inline`. In order to show an element, you can set its `display` property to its ...
unknown
unknown
[Hide HTML elements > Show HTML elements] ## Show HTML elements Most HTML elements have a default `display` property value. For example, the default value for `<div>` elements is `block`, while the default value for `<span>` elements is `inline`. In order to show an element, you can set its `display` property to its ...
[Hide HTML elements > Show HTML elements] ## Show HTML elements Most HTML elements have a default `display` property value. For example, the default value for `<div>` elements is `block`, while the default value for `<span>` elements is `inline`. In order to show an element, you can set its `display` property to its ...
code_snippets
52d1bbdb-0c28-4e4f-9667-345c564cca78
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/show-hide-html-elements.md
unknown
631c28e1-4153-41a3-a339-03a0ea4bf932
0
SemanticChunker@1.0.0
179d1323c05b4302e831ab3404da4b379c76ff3686373fd08f502b3dc591d1d9
--- title: Show or hide HTML elements with JavaScript shortTitle: Show or hide HTML elements language: javascript tags: [browser,css] cover: picking-berries excerpt: Ever wanted to show or hide one or more elements in HTML, using JavaScript? Turns out it's very easy to do so. listed: true dateModified: 2023-10-22 --- ...
unknown
unknown
--- title: Show or hide HTML elements with JavaScript shortTitle: Show or hide HTML elements language: javascript tags: [browser,css] cover: picking-berries excerpt: Ever wanted to show or hide one or more elements in HTML, using JavaScript? Turns out it's very easy to do so. listed: true dateModified: 2023-10-22 --- ...
--- title: Show or hide HTML elements with JavaScript shortTitle: Show or hide HTML elements language: javascript tags: [browser,css] cover: picking-berries excerpt: Ever wanted to show or hide one or more elements in HTML, using JavaScript? Turns out it's very easy to do so. listed: true dateModified: 2023-10-22 --- ...
code_snippets
ab28686b-4ab8-41c5-a8e9-961869bcbc05
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/show-hide-html-elements.md
unknown
631c28e1-4153-41a3-a339-03a0ea4bf932
1
SemanticChunker@1.0.0
e824f97defcebfc5a7cc00ffbc623da67a0fd6bbeab6fbd89cab131201f1b99c
[Hide HTML elements] ## Hide HTML elements In order to hide an HTML element, you can use the `display: none` CSS property. This will remove the element from the page layout, but it will still be present in the DOM. ```js const hide = (...el) => [...el].forEach(e => (e.style.display = 'none')); hide(...document.quer...
unknown
unknown
[Hide HTML elements] ## Hide HTML elements In order to hide an HTML element, you can use the `display: none` CSS property. This will remove the element from the page layout, but it will still be present in the DOM. ```js const hide = (...el) => [...el].forEach(e => (e.style.display = 'none')); hide(...document.quer...
[Hide HTML elements] ## Hide HTML elements In order to hide an HTML element, you can use the `display: none` CSS property. This will remove the element from the page layout, but it will still be present in the DOM. ```js const hide = (...el) => [...el].forEach(e => (e.style.display = 'none')); hide(...document.quer...
code_snippets
17a94af9-7e03-4b76-8212-1074aa30b352
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/shallow-deep-clone-object.md
unknown
f9bc82be-d335-47d1-b45a-f995bc4952c1
0
SemanticChunker@1.0.0
363f541eeee4e2d41973802ad055acd3e6deaf876c68f862dc1a880940bdee93
--- title: How can I clone an object in JavaScript? shortTitle: Deep clone object language: javascript tags: [object,recursion] cover: pagodas excerpt: Learn how JavaScript handles mutable data, such as objects and arrays, and understand how shallow cloning and deep cloning work. listed: true dateModified: 2024-01-04 -...
unknown
unknown
--- title: How can I clone an object in JavaScript? shortTitle: Deep clone object language: javascript tags: [object,recursion] cover: pagodas excerpt: Learn how JavaScript handles mutable data, such as objects and arrays, and understand how shallow cloning and deep cloning work. listed: true dateModified: 2024-01-04 -...
--- title: How can I clone an object in JavaScript? shortTitle: Deep clone object language: javascript tags: [object,recursion] cover: pagodas excerpt: Learn how JavaScript handles mutable data, such as objects and arrays, and understand how shallow cloning and deep cloning work. listed: true dateModified: 2024-01-04 -...
code_snippets
3e51099a-863a-4024-beba-085712f4bd1c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/shallow-deep-clone-object.md
unknown
f9bc82be-d335-47d1-b45a-f995bc4952c1
1
SemanticChunker@1.0.0
cdbf00d563ec1b67bb95632ba6d0ec41e0943556ffd03f4c7f899bd8683ad165
[Shallow cloning] ## Shallow cloning Using the spread operator (`...`) or `Object.assign()`, we can clone the object and create a new one from its properties. ```js const shallowClone = obj => Object.assign({}, obj); let obj = { a: 1, b: 2}; let clone = shallowClone(obj); let otherClone = shallowClone(obj); clone....
unknown
unknown
[Shallow cloning] ## Shallow cloning Using the spread operator (`...`) or `Object.assign()`, we can clone the object and create a new one from its properties. ```js const shallowClone = obj => Object.assign({}, obj); let obj = { a: 1, b: 2}; let clone = shallowClone(obj); let otherClone = shallowClone(obj); clone....
[Shallow cloning] ## Shallow cloning Using the spread operator (`...`) or `Object.assign()`, we can clone the object and create a new one from its properties. ```js const shallowClone = obj => Object.assign({}, obj); let obj = { a: 1, b: 2}; let clone = shallowClone(obj); let otherClone = shallowClone(obj); clone....
code_snippets
73218cf7-9f89-456d-96bb-16398cd84308
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/shallow-deep-clone-object.md
unknown
f9bc82be-d335-47d1-b45a-f995bc4952c1
2
SemanticChunker@1.0.0
4d8763cc22956dd28284f9b15f95867ff0a178b48979377a1f4f5e9a20a13626
[Shallow cloning > Deep cloning] ## Deep cloning In order to create a **deep clone** of an object, we need to recursively clone every nested object, cloning nested objects and arrays along the way. > [!IMPORTANT] > > Some solutions around the web use `JSON.stringify()` and `JSON.parse()`. While this approach might w...
unknown
unknown
[Shallow cloning > Deep cloning] ## Deep cloning In order to create a **deep clone** of an object, we need to recursively clone every nested object, cloning nested objects and arrays along the way. > [!IMPORTANT] > > Some solutions around the web use `JSON.stringify()` and `JSON.parse()`. While this approach might w...
[Shallow cloning > Deep cloning] ## Deep cloning In order to create a **deep clone** of an object, we need to recursively clone every nested object, cloning nested objects and arrays along the way. > [!IMPORTANT] > > Some solutions around the web use `JSON.stringify()` and `JSON.parse()`. While this approach might w...
code_snippets
989ae482-915d-45f7-af09-ebfa1ad9294a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/shallow-deep-clone-object.md
unknown
f9bc82be-d335-47d1-b45a-f995bc4952c1
3
SemanticChunker@1.0.0
01fd322a16143cfc0e758b5759932098f5ab6c0433b6c6807377916939380d0d
[Shallow cloning > Deep cloning using `structuredClone()`] ## Deep cloning using `structuredClone()` <baseline-support featureId="structured-clone"> </baseline-support> Apparently, cloning is a fairly common and important problem. So much so that JavaScript introduced the `structuredClone()` global function, which c...
unknown
unknown
[Shallow cloning > Deep cloning using `structuredClone()`] ## Deep cloning using `structuredClone()` <baseline-support featureId="structured-clone"> </baseline-support> Apparently, cloning is a fairly common and important problem. So much so that JavaScript introduced the `structuredClone()` global function, which c...
[Shallow cloning > Deep cloning using `structuredClone()`] ## Deep cloning using `structuredClone()` <baseline-support featureId="structured-clone"> </baseline-support> Apparently, cloning is a fairly common and important problem. So much so that JavaScript introduced the `structuredClone()` global function, which c...
code_snippets
588564cf-970b-456b-8744-eaba30dfa6ad
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/singleton-proxy.md
unknown
06849c0f-093c-4edc-80d5-9d6eca81d84d
1
SemanticChunker@1.0.0
5385fa5c6b484e4a7eaa4c34455511f137b6143d6e593075c596fd3eeca4913b
```js const singletonify = (className) => { return new Proxy(className.prototype.constructor, { instance: null, construct: (target, argumentsList) => { if (!this.instance) this.instance = new target(...argumentsList); return this.instance; } }); } ``` And here is a simple practical example to better understand...
unknown
unknown
```js const singletonify = (className) => { return new Proxy(className.prototype.constructor, { instance: null, construct: (target, argumentsList) => { if (!this.instance) this.instance = new target(...argumentsList); return this.instance; } }); } ``` And here is a simple practical example to better understand...
```js const singletonify = (className) => { return new Proxy(className.prototype.constructor, { instance: null, construct: (target, argumentsList) => { if (!this.instance) this.instance = new target(...argumentsList); return this.instance; } }); } ``` And here is a simple practical example to better understand...
code_snippets
f44ba7b8-3006-4cb9-9230-17c3a998a0d1
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/singleton-proxy.md
unknown
06849c0f-093c-4edc-80d5-9d6eca81d84d
0
SemanticChunker@1.0.0
9494b11da6864cfdfe351128740dd71e43bfec3f5bcf2e907c05539b255f0cd4
--- title: How can I implement a singleton in JavaScript? shortTitle: Singleton implementation language: javascript tags: [proxy,pattern] cover: obelisk excerpt: Learn how to implement the singleton design pattern in JavaScript, using the Proxy object. listed: true dateModified: 2021-09-28 --- A singleton is an **obje...
unknown
unknown
--- title: How can I implement a singleton in JavaScript? shortTitle: Singleton implementation language: javascript tags: [proxy,pattern] cover: obelisk excerpt: Learn how to implement the singleton design pattern in JavaScript, using the Proxy object. listed: true dateModified: 2021-09-28 --- A singleton is an **obje...
--- title: How can I implement a singleton in JavaScript? shortTitle: Singleton implementation language: javascript tags: [proxy,pattern] cover: obelisk excerpt: Learn how to implement the singleton design pattern in JavaScript, using the Proxy object. listed: true dateModified: 2021-09-28 --- A singleton is an **obje...
code_snippets
2b20044b-ba6e-44da-97d4-3e18bb6fe8d3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/semantic-versioning.md
unknown
34cc7577-1edf-457a-8967-4c3236f65721
0
SemanticChunker@1.0.0
506944d88f1cf140f8a10ca42d698842fe689a6a592e3b817a847f74a0c30761
--- title: Introduction to Semantic Versioning (SemVer) shortTitle: Semantic Versioning (SemVer) explained language: javascript tags: [node] cover: wet-lowland-golden-hour excerpt: Learn how semantic versioning works and how to use it to correctly version your software. listed: true dateModified: 2023-07-16 --- **SemV...
unknown
unknown
--- title: Introduction to Semantic Versioning (SemVer) shortTitle: Semantic Versioning (SemVer) explained language: javascript tags: [node] cover: wet-lowland-golden-hour excerpt: Learn how semantic versioning works and how to use it to correctly version your software. listed: true dateModified: 2023-07-16 --- **SemV...
--- title: Introduction to Semantic Versioning (SemVer) shortTitle: Semantic Versioning (SemVer) explained language: javascript tags: [node] cover: wet-lowland-golden-hour excerpt: Learn how semantic versioning works and how to use it to correctly version your software. listed: true dateModified: 2023-07-16 --- **SemV...
code_snippets
2cff3a2c-a2ff-4b06-b348-9545f231eeae
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/semantic-versioning.md
unknown
34cc7577-1edf-457a-8967-4c3236f65721
2
SemanticChunker@1.0.0
0eb8e70d1651e2b12002b1129b920700139a00ed94e9bce408cc62ea8fe504cd
If you don't specify a version, npm will install the **latest version** of the package. You can also use the `^` or `~` symbols to specify a range of versions. For example, `^1.0.0` will install the latest version of the package that is compatible with `1.0.0`. Similarly, `~1.0.0` will install the latest version of the...
unknown
unknown
If you don't specify a version, npm will install the **latest version** of the package. You can also use the `^` or `~` symbols to specify a range of versions. For example, `^1.0.0` will install the latest version of the package that is compatible with `1.0.0`. Similarly, `~1.0.0` will install the latest version of the...
If you don't specify a version, npm will install the **latest version** of the package. You can also use the `^` or `~` symbols to specify a range of versions. For example, `^1.0.0` will install the latest version of the package that is compatible with `1.0.0`. Similarly, `~1.0.0` will install the latest version of the...
code_snippets
be5a5ab5-6e8a-4a94-bf3f-1c7df263b22d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/semantic-versioning.md
unknown
34cc7577-1edf-457a-8967-4c3236f65721
1
SemanticChunker@1.0.0
b5a4f7d3325ec0873b0795f0120cb5127f42a5086e608f9bb2a021c5ab3a3903
``` Each component represents a specific type of change made to the software. - **Major version**: Significant changes that may **break compatibility** with previous versions. Developers should carefully review the documentation and test their code against the new version before upgrading. - **Minor version**: Backwa...
unknown
unknown
``` Each component represents a specific type of change made to the software. - **Major version**: Significant changes that may **break compatibility** with previous versions. Developers should carefully review the documentation and test their code against the new version before upgrading. - **Minor version**: Backwa...
``` Each component represents a specific type of change made to the software. - **Major version**: Significant changes that may **break compatibility** with previous versions. Developers should carefully review the documentation and test their code against the new version before upgrading. - **Minor version**: Backwa...
code_snippets
1acfd8e0-f68f-46dd-9410-ecd50850b583
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
5
SemanticChunker@1.0.0
87d1682b45b9a2698d41c1184693eac85d868d99689d65c14c65f0b948089414
[Token types > Tokenizing the HTML string] ### Tokenizing the HTML string We're now ready to tokenize an HTML string. The structure of the tokenizer is very similar to the previous article, so I won't bother you with all the minute details. The only point I would like to focus on is the actual **character processing ...
unknown
unknown
[Token types > Tokenizing the HTML string] ### Tokenizing the HTML string We're now ready to tokenize an HTML string. The structure of the tokenizer is very similar to the previous article, so I won't bother you with all the minute details. The only point I would like to focus on is the actual **character processing ...
[Token types > Tokenizing the HTML string] ### Tokenizing the HTML string We're now ready to tokenize an HTML string. The structure of the tokenizer is very similar to the previous article, so I won't bother you with all the minute details. The only point I would like to focus on is the actual **character processing ...
code_snippets
39f67de9-0d42-4cca-9120-b86db6bfb7d5
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
3
SemanticChunker@1.0.0
00d7c9a9f5ebd78c3c686cd357f091ea54a14e15cdd9eab4da601a765d9c33de
[Token types > Processing text tokens] ### Processing text tokens Text tokens aren't very interesting. They're just text nodes that **don't contain any HTML tags**. We'll simply add them to a `tokens` array as a simple object with a `type` of `text` and a `value` of the text node. ```js const processTextToken = str ...
unknown
unknown
[Token types > Processing text tokens] ### Processing text tokens Text tokens aren't very interesting. They're just text nodes that **don't contain any HTML tags**. We'll simply add them to a `tokens` array as a simple object with a `type` of `text` and a `value` of the text node. ```js const processTextToken = str ...
[Token types > Processing text tokens] ### Processing text tokens Text tokens aren't very interesting. They're just text nodes that **don't contain any HTML tags**. We'll simply add them to a `tokens` array as a simple object with a `type` of `text` and a `value` of the text node. ```js const processTextToken = str ...
code_snippets
3e038bcd-439b-49dd-9e66-55e5f09fd25a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
0
SemanticChunker@1.0.0
a2b1e802d6ec39b2906e8463d49ea6a3583336d7ed320ffc35665ba73a5624fc
--- title: Simple HTML tokenization & validation in JavaScript shortTitle: HTML tokenization & validation language: javascript tags: [string,algorithm] cover: jars-on-shelf excerpt: Expanding upon previous articles on bracket matching and tokenization, it's time to try a basic HTML tokenization and validation algorithm...
unknown
unknown
--- title: Simple HTML tokenization & validation in JavaScript shortTitle: HTML tokenization & validation language: javascript tags: [string,algorithm] cover: jars-on-shelf excerpt: Expanding upon previous articles on bracket matching and tokenization, it's time to try a basic HTML tokenization and validation algorithm...
--- title: Simple HTML tokenization & validation in JavaScript shortTitle: HTML tokenization & validation language: javascript tags: [string,algorithm] cover: jars-on-shelf excerpt: Expanding upon previous articles on bracket matching and tokenization, it's time to try a basic HTML tokenization and validation algorithm...
code_snippets
87f3427a-5f08-4dce-addd-112a49712b83
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
6
SemanticChunker@1.0.0
8bcf6534d58e98ac7feec05e659e1cba8b6bb0bef3bf24752bc3d1042f700172
[Token types > Tokenizing the HTML string] ```js const SELF_CLOSING_TAGS = new Set([ 'br', 'img', 'input', 'meta', 'hr', 'link' ]); const tokenizeHtml = str => { const tokens = []; let buffer = ''; const processTagToken = str => { if (!str.match(/^<[^<>]+>$/)) throw new Error(`${str} is not a valid HTML tag`);...
unknown
unknown
[Token types > Tokenizing the HTML string] ```js const SELF_CLOSING_TAGS = new Set([ 'br', 'img', 'input', 'meta', 'hr', 'link' ]); const tokenizeHtml = str => { const tokens = []; let buffer = ''; const processTagToken = str => { if (!str.match(/^<[^<>]+>$/)) throw new Error(`${str} is not a valid HTML tag`);...
[Token types > Tokenizing the HTML string] ```js const SELF_CLOSING_TAGS = new Set([ 'br', 'img', 'input', 'meta', 'hr', 'link' ]); const tokenizeHtml = str => { const tokens = []; let buffer = ''; const processTagToken = str => { if (!str.match(/^<[^<>]+>$/)) throw new Error(`${str} is not a valid HTML tag`);...
code_snippets
8a62beb8-ef93-42d8-90ce-7e3c5acf5370
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
2
SemanticChunker@1.0.0
32b17e2c86e8857442ca6686f38d51dfa9a473416e9b722f3b73302716c40e54
[HTML Tokenization > Token types] ### Token types The first problem we'll have to solve is distinguishing between an HTML tag and a text node. An **HTML tag** is a string that starts with `<` and ends with `>`, while a **text node** is everything else. In order to tackle this, we'll have to create a `flushBuffer` fun...
unknown
unknown
[HTML Tokenization > Token types] ### Token types The first problem we'll have to solve is distinguishing between an HTML tag and a text node. An **HTML tag** is a string that starts with `<` and ends with `>`, while a **text node** is everything else. In order to tackle this, we'll have to create a `flushBuffer` fun...
[HTML Tokenization > Token types] ### Token types The first problem we'll have to solve is distinguishing between an HTML tag and a text node. An **HTML tag** is a string that starts with `<` and ends with `>`, while a **text node** is everything else. In order to tackle this, we'll have to create a `flushBuffer` fun...
code_snippets
92317cf6-2928-44fb-9fc2-c6b64f19259a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
4
SemanticChunker@1.0.0
521a6d4bb9252cba22b606929921fdea1eec4240c1e1aa60740dbf7add90288d
[Token types > Processing tag tokens] ### Processing tag tokens Tag tokens are where most of the complexity of this process comes from. As soon as we enter the `processTagToken`, we must check if the buffer's contents are actually **valid**. Luckily, this is doable with a simple **regular expression**. Then, we'll h...
unknown
unknown
[Token types > Processing tag tokens] ### Processing tag tokens Tag tokens are where most of the complexity of this process comes from. As soon as we enter the `processTagToken`, we must check if the buffer's contents are actually **valid**. Luckily, this is doable with a simple **regular expression**. Then, we'll h...
[Token types > Processing tag tokens] ### Processing tag tokens Tag tokens are where most of the complexity of this process comes from. As soon as we enter the `processTagToken`, we must check if the buffer's contents are actually **valid**. Luckily, this is doable with a simple **regular expression**. Then, we'll h...
code_snippets
9a4ae98f-6fbc-4f3d-980c-443bb26fb706
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
1
SemanticChunker@1.0.0
545c53cadc562a0078db4ec654b37a6a53ec5fc2c9e1528e5b88911977e407b6
[HTML Tokenization] ## HTML Tokenization If you've read the previous article on [math expression tokenization](/js/s/math-expression-tokenizer), you'll know that **tokenization** is the process of breaking down a string into smaller, more manageable pieces. In that article, we didn't really delve into **multi-charact...
unknown
unknown
[HTML Tokenization] ## HTML Tokenization If you've read the previous article on [math expression tokenization](/js/s/math-expression-tokenizer), you'll know that **tokenization** is the process of breaking down a string into smaller, more manageable pieces. In that article, we didn't really delve into **multi-charact...
[HTML Tokenization] ## HTML Tokenization If you've read the previous article on [math expression tokenization](/js/s/math-expression-tokenizer), you'll know that **tokenization** is the process of breaking down a string into smaller, more manageable pieces. In that article, we didn't really delve into **multi-charact...
code_snippets
a48dfbb1-f1f0-45e4-baee-cd584a0da948
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
10
SemanticChunker@1.0.0
397be2fae5e283a6a819eaa3e091b6c05616e3abf8e1492eff1a3c94d8cd53bc
[HTML Tokenization > Conclusion] ## Conclusion And that's basically our simple HTML validator done! Of course, there are a ton more things one can and should take care of when parsing HTML, but this is a good starting point for understanding the basics. I hope this article has really driven home the mentality of tok...
unknown
unknown
[HTML Tokenization > Conclusion] ## Conclusion And that's basically our simple HTML validator done! Of course, there are a ton more things one can and should take care of when parsing HTML, but this is a good starting point for understanding the basics. I hope this article has really driven home the mentality of tok...
[HTML Tokenization > Conclusion] ## Conclusion And that's basically our simple HTML validator done! Of course, there are a ton more things one can and should take care of when parsing HTML, but this is a good starting point for understanding the basics. I hope this article has really driven home the mentality of tok...
code_snippets
c4c436ee-572f-45e8-bdc2-1294bd166673
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
7
SemanticChunker@1.0.0
76c01d682d6f0f73af6c3e73e40dff84e59ca7a3a858e11f44e62cdad89e1bb5
[Token types > Tokenizing the HTML string] ```js const tokens = tokenizeHtml( '<div class="container"><p>Hello, <strong>world</strong>!<br/></p></div>' ); // [ // { // type: 'tag', tagName: 'div', // opening: true, closing: false, // tagAttributeString: 'class="container"' // }, // { // type: 'tag', tagName: 'p', // ...
unknown
unknown
[Token types > Tokenizing the HTML string] ```js const tokens = tokenizeHtml( '<div class="container"><p>Hello, <strong>world</strong>!<br/></p></div>' ); // [ // { // type: 'tag', tagName: 'div', // opening: true, closing: false, // tagAttributeString: 'class="container"' // }, // { // type: 'tag', tagName: 'p', // ...
[Token types > Tokenizing the HTML string] ```js const tokens = tokenizeHtml( '<div class="container"><p>Hello, <strong>world</strong>!<br/></p></div>' ); // [ // { // type: 'tag', tagName: 'div', // opening: true, closing: false, // tagAttributeString: 'class="container"' // }, // { // type: 'tag', tagName: 'p', // ...
code_snippets
d5721f6a-b52d-4573-9350-c07b87f55d1c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
8
SemanticChunker@1.0.0
4a005175c5f4ce7be67713c85f8ac5dbbded2d7b64aa4be09633d1bde9fed540
[HTML Tokenization > Matching tag pairs] ## Matching tag pairs In the previous article on [bracket pair matching](/js/s/find-matching-bracket-pairs), we used a simple **stack-based approach** to match bracket pairs. This scenario is no different, only we need to work with **tokens**, instead of a raw string and its c...
unknown
unknown
[HTML Tokenization > Matching tag pairs] ## Matching tag pairs In the previous article on [bracket pair matching](/js/s/find-matching-bracket-pairs), we used a simple **stack-based approach** to match bracket pairs. This scenario is no different, only we need to work with **tokens**, instead of a raw string and its c...
[HTML Tokenization > Matching tag pairs] ## Matching tag pairs In the previous article on [bracket pair matching](/js/s/find-matching-bracket-pairs), we used a simple **stack-based approach** to match bracket pairs. This scenario is no different, only we need to work with **tokens**, instead of a raw string and its c...
code_snippets
f7cbc3a9-d809-4fc6-b83a-8e864c48c560
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/simple-html-tokenization-validation.md
unknown
2ab6b140-991f-489b-a03a-e2b05d86aa03
9
SemanticChunker@1.0.0
2fa1fd96ae0035e5a4d2f8a234e6856604a3217a71bd1e4679bdfc844531020a
[HTML Tokenization > A simple HTML validator] ## A simple HTML validator Putting the previous two pieces together, we can create a **simple HTML validator** that tokenizes the input string, matches the tag pairs and throws an error if the tags are mismatched or unmatched or if the input string is not a valid HTML str...
unknown
unknown
[HTML Tokenization > A simple HTML validator] ## A simple HTML validator Putting the previous two pieces together, we can create a **simple HTML validator** that tokenizes the input string, matches the tag pairs and throws an error if the tags are mismatched or unmatched or if the input string is not a valid HTML str...
[HTML Tokenization > A simple HTML validator] ## A simple HTML validator Putting the previous two pieces together, we can create a **simple HTML validator** that tokenizes the input string, matches the tag pairs and throws an error if the tags are mismatched or unmatched or if the input string is not a valid HTML str...
code_snippets
387610f7-dcde-4633-b02d-6c8c58e205b2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/specify-base-for-math-log.md
unknown
367a70a2-b90e-488e-b083-7faa3c81243d
1
SemanticChunker@1.0.0
c2324532c34b4020c817c0cf79bdd152bea678b540805ef2d765d4223276f6b9
[Calculate the logarithm of a number in a specific base] ## Calculate the logarithm of a number in a specific base The **base change formula** allows you to calculate the logarithm of a number in a specific base by dividing the logarithm of the number by the logarithm of the base. This means that for a given base `b`...
unknown
unknown
[Calculate the logarithm of a number in a specific base] ## Calculate the logarithm of a number in a specific base The **base change formula** allows you to calculate the logarithm of a number in a specific base by dividing the logarithm of the number by the logarithm of the base. This means that for a given base `b`...
[Calculate the logarithm of a number in a specific base] ## Calculate the logarithm of a number in a specific base The **base change formula** allows you to calculate the logarithm of a number in a specific base by dividing the logarithm of the number by the logarithm of the base. This means that for a given base `b`...
code_snippets
8f7be61e-8e00-435e-9e84-ca2166e2e112
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/specify-base-for-math-log.md
unknown
367a70a2-b90e-488e-b083-7faa3c81243d
0
SemanticChunker@1.0.0
6f6aa87be5dbed870ab61a1f5da87d372215b48892153fe739c3415ccece3d25
--- title: How can I specify the base for a logarithm in JavaScript? shortTitle: Specify base for logarithm language: javascript tags: [math] cover: yellow-white-mug-2 excerpt: Calculate the logarithm of a number or check if a number is a power of a specific base. listed: true dateModified: 2024-01-03 --- JavaScript's...
unknown
unknown
--- title: How can I specify the base for a logarithm in JavaScript? shortTitle: Specify base for logarithm language: javascript tags: [math] cover: yellow-white-mug-2 excerpt: Calculate the logarithm of a number or check if a number is a power of a specific base. listed: true dateModified: 2024-01-03 --- JavaScript's...
--- title: How can I specify the base for a logarithm in JavaScript? shortTitle: Specify base for logarithm language: javascript tags: [math] cover: yellow-white-mug-2 excerpt: Calculate the logarithm of a number or check if a number is a power of a specific base. listed: true dateModified: 2024-01-03 --- JavaScript's...
code_snippets
a63f785d-3e7c-4312-9d22-c64fe4a855cf
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/specify-base-for-math-log.md
unknown
367a70a2-b90e-488e-b083-7faa3c81243d
2
SemanticChunker@1.0.0
bd8e40df21abe81b87addc1f157c7bf6ffc869bbc66621b2d72567385bce624f
[Calculate the logarithm of a number in a specific base > Check if a number is a power of a specific base] ## Check if a number is a power of a specific base In order to check if a number is a power of a specific base, you need to calculate its logarithm in that base first. Then, you can use the modulo operator (`%`)...
unknown
unknown
[Calculate the logarithm of a number in a specific base > Check if a number is a power of a specific base] ## Check if a number is a power of a specific base In order to check if a number is a power of a specific base, you need to calculate its logarithm in that base first. Then, you can use the modulo operator (`%`)...
[Calculate the logarithm of a number in a specific base > Check if a number is a power of a specific base] ## Check if a number is a power of a specific base In order to check if a number is a power of a specific base, you need to calculate its logarithm in that base first. Then, you can use the modulo operator (`%`)...
code_snippets
0a668603-e64e-41e9-bc61-632e79032ebd
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/selection-sort.md
unknown
a2e443fc-abc5-46ca-a5fe-6674da68f5ea
1
SemanticChunker@1.0.0
b0b8273a020478ddcba44a26fc993fd80c6163f01abf033daae1b5f78183913b
[Definition] ## Definition [Selection sort](https://en.wikipedia.org/wiki/Selection_sort) is an **in-place comparison sorting algorithm**. It divides the input array into a **sorted** and an **unsorted** subarray. It then repeatedly **finds the minimum element** in the unsorted subarray and **swaps** it with the left...
unknown
unknown
[Definition] ## Definition [Selection sort](https://en.wikipedia.org/wiki/Selection_sort) is an **in-place comparison sorting algorithm**. It divides the input array into a **sorted** and an **unsorted** subarray. It then repeatedly **finds the minimum element** in the unsorted subarray and **swaps** it with the left...
[Definition] ## Definition [Selection sort](https://en.wikipedia.org/wiki/Selection_sort) is an **in-place comparison sorting algorithm**. It divides the input array into a **sorted** and an **unsorted** subarray. It then repeatedly **finds the minimum element** in the unsorted subarray and **swaps** it with the left...
code_snippets
2a2cb7ec-edea-4fc2-9f7b-46f0eded83f7
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/selection-sort.md
unknown
a2e443fc-abc5-46ca-a5fe-6674da68f5ea
2
SemanticChunker@1.0.0
a30065ab4ba0a533f1095f346d043b1edebe89e82088158129715eff74dd4d50
[Definition > Implementation] ## Implementation - Use the spread operator (`...`) to clone the original array, `arr`. - Use a `for` loop to iterate over elements in the array. - Use `Array.prototype.slice()` and `Array.prototype.reduce()` to find the index of the minimum element in the subarray to the right of the cu...
unknown
unknown
[Definition > Implementation] ## Implementation - Use the spread operator (`...`) to clone the original array, `arr`. - Use a `for` loop to iterate over elements in the array. - Use `Array.prototype.slice()` and `Array.prototype.reduce()` to find the index of the minimum element in the subarray to the right of the cu...
[Definition > Implementation] ## Implementation - Use the spread operator (`...`) to clone the original array, `arr`. - Use a `for` loop to iterate over elements in the array. - Use `Array.prototype.slice()` and `Array.prototype.reduce()` to find the index of the minimum element in the subarray to the right of the cu...
code_snippets
d81caf69-78be-4226-a864-2d238b8b11d2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/selection-sort.md
unknown
a2e443fc-abc5-46ca-a5fe-6674da68f5ea
0
SemanticChunker@1.0.0
2b91492e48a77f770dbdc8be99226849b669fae6ac073bec5e37371b23c53853
--- title: Selection sort language: javascript tags: [algorithm,array] cover: yellow-sofa excerpt: Sort an array of numbers, using the selection sort algorithm. listed: true dateModified: 2023-12-16 ---
unknown
unknown
--- title: Selection sort language: javascript tags: [algorithm,array] cover: yellow-sofa excerpt: Sort an array of numbers, using the selection sort algorithm. listed: true dateModified: 2023-12-16 ---
--- title: Selection sort language: javascript tags: [algorithm,array] cover: yellow-sofa excerpt: Sort an array of numbers, using the selection sort algorithm. listed: true dateModified: 2023-12-16 ---
code_snippets
c9822736-e603-4b45-a0d2-804651bff016
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-is-valid-json.md
unknown
ac876610-ab56-4aa3-8be1-ef40554d9028
0
SemanticChunker@1.0.0
53973df489ebd6eff1d8c5ceffdb8b8b28f9fe8bdf8db2681bb603b37f8639f3
--- title: Check if a JavaScript string is a valid JSON shortTitle: Check if string is valid JSON language: javascript tags: [type] cover: italian-horizon excerpt: Use a simple JavaScript trick to validate a serialized JSON object. listed: true dateModified: 2024-03-17 --- When working with serialized data, you might ...
unknown
unknown
--- title: Check if a JavaScript string is a valid JSON shortTitle: Check if string is valid JSON language: javascript tags: [type] cover: italian-horizon excerpt: Use a simple JavaScript trick to validate a serialized JSON object. listed: true dateModified: 2024-03-17 --- When working with serialized data, you might ...
--- title: Check if a JavaScript string is a valid JSON shortTitle: Check if string is valid JSON language: javascript tags: [type] cover: italian-horizon excerpt: Use a simple JavaScript trick to validate a serialized JSON object. listed: true dateModified: 2024-03-17 --- When working with serialized data, you might ...
code_snippets
3724f8f0-307f-4ebd-881a-b94db31d6811
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-immutability.md
unknown
427333b2-42a2-418e-8bb6-510a94871275
0
SemanticChunker@1.0.0
ad179ebc76e40e4cc3d8103b37591b6d93c2aab1506ba30f4a93e348a1bd36a1
--- title: Are JavaScript strings immutable? shortTitle: String immutability language: javascript tags: [string,type] cover: purple-sunset excerpt: When it comes to immutability, JavaScript strings are often a source of confusion. Yet they're not as complicated as you might expect. listed: true dateModified: 2021-10-10...
unknown
unknown
--- title: Are JavaScript strings immutable? shortTitle: String immutability language: javascript tags: [string,type] cover: purple-sunset excerpt: When it comes to immutability, JavaScript strings are often a source of confusion. Yet they're not as complicated as you might expect. listed: true dateModified: 2021-10-10...
--- title: Are JavaScript strings immutable? shortTitle: String immutability language: javascript tags: [string,type] cover: purple-sunset excerpt: When it comes to immutability, JavaScript strings are often a source of confusion. Yet they're not as complicated as you might expect. listed: true dateModified: 2021-10-10...
code_snippets
70e4525d-059b-4fbe-802f-c96fb1888c6b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/spread-rest-syntax.md
unknown
2ca1e338-1470-48d3-88f0-2926b8f157f7
2
SemanticChunker@1.0.0
35c5c752e57ab2bcaa55165e0b61dd1c36ca27f4f33b01a432b0b213faf70f32
[Spread syntax > Rest syntax] ## Rest syntax The rest parameter syntax allows you to collapse any remaining arguments into an array. While it looks very similar to the spread operator, the rest parameter syntax is only used in function declarations (arrow or otherwise). ```js // Rest parameter syntax, not to be conf...
unknown
unknown
[Spread syntax > Rest syntax] ## Rest syntax The rest parameter syntax allows you to collapse any remaining arguments into an array. While it looks very similar to the spread operator, the rest parameter syntax is only used in function declarations (arrow or otherwise). ```js // Rest parameter syntax, not to be conf...
[Spread syntax > Rest syntax] ## Rest syntax The rest parameter syntax allows you to collapse any remaining arguments into an array. While it looks very similar to the spread operator, the rest parameter syntax is only used in function declarations (arrow or otherwise). ```js // Rest parameter syntax, not to be conf...
code_snippets
b54d4ab9-3e8b-4428-976e-bb9833721390
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/spread-rest-syntax.md
unknown
2ca1e338-1470-48d3-88f0-2926b8f157f7
1
SemanticChunker@1.0.0
2106f1a55e74e11a352ed29fc2e6d4756713417b2ed291146a584dce2342027b
[Spread syntax] ## Spread syntax The spread operator (`...`) allows you to expand a single array into its values. Some common use-cases for the spread operator include: - Expanding an array's values to pass them as arguments to a function that does not accept an array. - Cloning an array by spreading its values into...
unknown
unknown
[Spread syntax] ## Spread syntax The spread operator (`...`) allows you to expand a single array into its values. Some common use-cases for the spread operator include: - Expanding an array's values to pass them as arguments to a function that does not accept an array. - Cloning an array by spreading its values into...
[Spread syntax] ## Spread syntax The spread operator (`...`) allows you to expand a single array into its values. Some common use-cases for the spread operator include: - Expanding an array's values to pass them as arguments to a function that does not accept an array. - Cloning an array by spreading its values into...
code_snippets
e955fc89-3f10-44d2-bffc-a512c85ef624
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/spread-rest-syntax.md
unknown
2ca1e338-1470-48d3-88f0-2926b8f157f7
0
SemanticChunker@1.0.0
d90bec60a407c85ced318e967013aacb4dfa8ea3ac912d1cfe6334ba5f3dbc8d
--- title: Understanding the spread and rest syntax in Javascript shortTitle: Spread and rest syntax language: javascript tags: [array,function] cover: antelope excerpt: JavaScript ES6 introduced us to powerful new features, such as the spread and rest syntax. Learn all you need to know in this quick guide. listed: tru...
unknown
unknown
--- title: Understanding the spread and rest syntax in Javascript shortTitle: Spread and rest syntax language: javascript tags: [array,function] cover: antelope excerpt: JavaScript ES6 introduced us to powerful new features, such as the spread and rest syntax. Learn all you need to know in this quick guide. listed: tru...
--- title: Understanding the spread and rest syntax in Javascript shortTitle: Spread and rest syntax language: javascript tags: [array,function] cover: antelope excerpt: JavaScript ES6 introduced us to powerful new features, such as the spread and rest syntax. Learn all you need to know in this quick guide. listed: tru...
code_snippets
8c1b633d-df3b-4a41-8646-f66d66a418a4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/static-instance-methods.md
unknown
5ddd0161-7caa-46f7-9327-9b04e5bf49fc
0
SemanticChunker@1.0.0
e2c261bef1c4815678cb45d63bfac46cbef1cd767074dca25db1abe9718b043b
--- title: What is the difference between static and instance methods? shortTitle: Static Instance Methods language: javascript tags: [object,function,class] cover: lake-runner excerpt: Static and instance methods are pretty easy to distinguish and serve different purposes. Learn all about them in this article. listed:...
unknown
unknown
--- title: What is the difference between static and instance methods? shortTitle: Static Instance Methods language: javascript tags: [object,function,class] cover: lake-runner excerpt: Static and instance methods are pretty easy to distinguish and serve different purposes. Learn all about them in this article. listed:...
--- title: What is the difference between static and instance methods? shortTitle: Static Instance Methods language: javascript tags: [object,function,class] cover: lake-runner excerpt: Static and instance methods are pretty easy to distinguish and serve different purposes. Learn all about them in this article. listed:...
code_snippets
5f5a2287-782a-42e1-8cfa-2c6445dca112
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/store-dom-items.md
unknown
881ad9ff-1307-494e-8b35-4e30fb7d1d80
0
SemanticChunker@1.0.0
4d6890ec1180ae72b8ae591389ebb3d483968fcdb47d778d4d2b3adf727b7731
--- title: Minimize DOM access in JavaScript shortTitle: Minimize DOM access language: javascript tags: [browser] cover: armchair excerpt: Increase your JavaScript code's performance when working with the DOM by leveraging this simple trick. listed: true dateModified: 2021-06-12 --- DOM operations, including accessing...
unknown
unknown
--- title: Minimize DOM access in JavaScript shortTitle: Minimize DOM access language: javascript tags: [browser] cover: armchair excerpt: Increase your JavaScript code's performance when working with the DOM by leveraging this simple trick. listed: true dateModified: 2021-06-12 --- DOM operations, including accessing...
--- title: Minimize DOM access in JavaScript shortTitle: Minimize DOM access language: javascript tags: [browser] cover: armchair excerpt: Increase your JavaScript code's performance when working with the DOM by leveraging this simple trick. listed: true dateModified: 2021-06-12 --- DOM operations, including accessing...
code_snippets
807f1914-6a49-4810-b283-a910e603fbce
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-is-uppercase-or-lowercase.md
unknown
b22a5c0f-e51b-4ffd-b672-5fd2e78f1efc
2
SemanticChunker@1.0.0
af61e5bc69ed90daec5871611bfd31090ee80e749a0ec1d3579e28cb69f8879d
[Check if a string is uppercase > Check if a string is lowercase] ## Check if a string is lowercase Conversely, we can do the same for lowercase strings, comparing the original string with the output of `String.prototype.toLowerCase()`. ```js const isLowerCase = str => str === str.toLowerCase(); isLowerCase('abc');...
unknown
unknown
[Check if a string is uppercase > Check if a string is lowercase] ## Check if a string is lowercase Conversely, we can do the same for lowercase strings, comparing the original string with the output of `String.prototype.toLowerCase()`. ```js const isLowerCase = str => str === str.toLowerCase(); isLowerCase('abc');...
[Check if a string is uppercase > Check if a string is lowercase] ## Check if a string is lowercase Conversely, we can do the same for lowercase strings, comparing the original string with the output of `String.prototype.toLowerCase()`. ```js const isLowerCase = str => str === str.toLowerCase(); isLowerCase('abc');...
code_snippets
8821fa15-c9b4-423a-8082-e6cc8a5577c6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-is-uppercase-or-lowercase.md
unknown
b22a5c0f-e51b-4ffd-b672-5fd2e78f1efc
3
SemanticChunker@1.0.0
d324af5b75a7d312e337f24e7b2e71b29f4c3a9431c9c67af9e0e592c57bf6b7
[Check if a string is uppercase > Dealing with non-alphabetic characters] ## Dealing with non-alphabetic characters The above examples work well for **alphabetic characters**, but what about **non-alphabetic characters**? For example, `'!@#$'` is neither uppercase nor lowercase, but both `isUpperCase('!@#$')` and `is...
unknown
unknown
[Check if a string is uppercase > Dealing with non-alphabetic characters] ## Dealing with non-alphabetic characters The above examples work well for **alphabetic characters**, but what about **non-alphabetic characters**? For example, `'!@#$'` is neither uppercase nor lowercase, but both `isUpperCase('!@#$')` and `is...
[Check if a string is uppercase > Dealing with non-alphabetic characters] ## Dealing with non-alphabetic characters The above examples work well for **alphabetic characters**, but what about **non-alphabetic characters**? For example, `'!@#$'` is neither uppercase nor lowercase, but both `isUpperCase('!@#$')` and `is...
code_snippets
c6388b67-92a5-4592-bcbf-72f354b6cd70
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-is-uppercase-or-lowercase.md
unknown
b22a5c0f-e51b-4ffd-b672-5fd2e78f1efc
0
SemanticChunker@1.0.0
19cc1231482b8c2f8fd95ddf24d2c66207a60df808e52ddba60deaa35b635d96
--- title: Check if a string is uppercase or lowercase in JavaScript short: String is uppercase or lowercase language: javascript tags: [string] cover: flower-portrait-7 excerpt: Use these simple tricks to check if a string is uppercase or lowercase in JavaScript. listed: true dateModified: 2023-12-20 --- It's not unc...
unknown
unknown
--- title: Check if a string is uppercase or lowercase in JavaScript short: String is uppercase or lowercase language: javascript tags: [string] cover: flower-portrait-7 excerpt: Use these simple tricks to check if a string is uppercase or lowercase in JavaScript. listed: true dateModified: 2023-12-20 --- It's not unc...
--- title: Check if a string is uppercase or lowercase in JavaScript short: String is uppercase or lowercase language: javascript tags: [string] cover: flower-portrait-7 excerpt: Use these simple tricks to check if a string is uppercase or lowercase in JavaScript. listed: true dateModified: 2023-12-20 --- It's not unc...
code_snippets
ead8d682-c851-4612-a972-3f44dfb140d4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-is-uppercase-or-lowercase.md
unknown
b22a5c0f-e51b-4ffd-b672-5fd2e78f1efc
1
SemanticChunker@1.0.0
332cc767cf6ef332488e5317d6420e14c436188960bbcd60200f471fef2d31a1
[Check if a string is uppercase] ## Check if a string is uppercase In order to check if a string is uppercase, we can convert the string to uppercase using `String.prototype.toUpperCase()` and compare it to the original string. ```js const isUpperCase = str => str === str.toUpperCase(); isUpperCase('ABC'); // true ...
unknown
unknown
[Check if a string is uppercase] ## Check if a string is uppercase In order to check if a string is uppercase, we can convert the string to uppercase using `String.prototype.toUpperCase()` and compare it to the original string. ```js const isUpperCase = str => str === str.toUpperCase(); isUpperCase('ABC'); // true ...
[Check if a string is uppercase] ## Check if a string is uppercase In order to check if a string is uppercase, we can convert the string to uppercase using `String.prototype.toUpperCase()` and compare it to the original string. ```js const isUpperCase = str => str === str.toUpperCase(); isUpperCase('ABC'); // true ...
code_snippets
000290ab-32af-4ef8-89a2-61bd395683fa
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
4
SemanticChunker@1.0.0
f824ab4e279dd0b89afa2c01a7b701153dba47660d43cd749a42976d65e84043
[Word boundary identification > Convert any case to kebab case] ## Convert any case to kebab case **Kebab case** is most often used in URL slugs, as it's SEO-friendly. Kebab case strings are **all lowercase, with words separated by hyphens**. For example `some-name` is kebab case, but `some-Name` is not. @[You might...
unknown
unknown
[Word boundary identification > Convert any case to kebab case] ## Convert any case to kebab case **Kebab case** is most often used in URL slugs, as it's SEO-friendly. Kebab case strings are **all lowercase, with words separated by hyphens**. For example `some-name` is kebab case, but `some-Name` is not. @[You might...
[Word boundary identification > Convert any case to kebab case] ## Convert any case to kebab case **Kebab case** is most often used in URL slugs, as it's SEO-friendly. Kebab case strings are **all lowercase, with words separated by hyphens**. For example `some-name` is kebab case, but `some-Name` is not. @[You might...
code_snippets
2165d6c8-953d-4880-b5ed-481b8bd3d1c0
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
5
SemanticChunker@1.0.0
f88203c181f2be00a9ec96c3f625e221fd3520eb004e411f4278c2c4f8afa4d3
[Word boundary identification > Convert any case to snake case] ## Convert any case to snake case **Snake case** is most often used in languages such as Python or Ruby. Snake case strings are **all lowercase, with words separated by underscores**. For example `some_name` is snake case, but `some_Name` is not. The pr...
unknown
unknown
[Word boundary identification > Convert any case to snake case] ## Convert any case to snake case **Snake case** is most often used in languages such as Python or Ruby. Snake case strings are **all lowercase, with words separated by underscores**. For example `some_name` is snake case, but `some_Name` is not. The pr...
[Word boundary identification > Convert any case to snake case] ## Convert any case to snake case **Snake case** is most often used in languages such as Python or Ruby. Snake case strings are **all lowercase, with words separated by underscores**. For example `some_name` is snake case, but `some_Name` is not. The pr...
code_snippets
319ef5b2-300c-4ee0-b8af-db6d71cf769f
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
3
SemanticChunker@1.0.0
8ef876adeed60a7d835b288bb3fdfd63b8d131c0c132c8ffe99abb57d91c3369
[Word boundary identification > Convert any case to Pascal case] ## Convert any case to Pascal case **Pascal case** is most often used in object-oriented languages like Java or C#. Pascal case strings have the **first letter of each word capitalized**. For example `SomeName` is Pascal case, but `someName` is not. Th...
unknown
unknown
[Word boundary identification > Convert any case to Pascal case] ## Convert any case to Pascal case **Pascal case** is most often used in object-oriented languages like Java or C#. Pascal case strings have the **first letter of each word capitalized**. For example `SomeName` is Pascal case, but `someName` is not. Th...
[Word boundary identification > Convert any case to Pascal case] ## Convert any case to Pascal case **Pascal case** is most often used in object-oriented languages like Java or C#. Pascal case strings have the **first letter of each word capitalized**. For example `SomeName` is Pascal case, but `someName` is not. Th...
code_snippets
515b55c4-997c-44c7-b5ae-c76e32366885
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
7
SemanticChunker@1.0.0
83edec499f30323ece7e5c67232199217344064cfd5baa49e98c7cb4d1048492
[Word boundary identification > Convert any case to sentence case] ## Convert any case to sentence case Finally, **sentence case** is most often used in sentences. Sentence case strings have their **first letter capitalized, with words separated by spaces**. For example `Some name` is sentence case, but `some Name` i...
unknown
unknown
[Word boundary identification > Convert any case to sentence case] ## Convert any case to sentence case Finally, **sentence case** is most often used in sentences. Sentence case strings have their **first letter capitalized, with words separated by spaces**. For example `Some name` is sentence case, but `some Name` i...
[Word boundary identification > Convert any case to sentence case] ## Convert any case to sentence case Finally, **sentence case** is most often used in sentences. Sentence case strings have their **first letter capitalized, with words separated by spaces**. For example `Some name` is sentence case, but `some Name` i...
code_snippets
57b0abce-8097-498a-a64f-3ff920f82f1c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
9
SemanticChunker@1.0.0
97e30cc1daf38c7af7cd09f983e5cca512fc4d951396fa24fccb95973e26db56
[Word boundary identification > Convert to any case] ```js const convertCase = (str, toCase = 'camel') => { if (!str) return ''; const delimiter = toCase === 'snake' ? '_' : toCase === 'kebab' ? '-' : ['title', 'sentence'].includes(toCase) ? ' ' : ''; const transform = ['camel', 'pascal'].includes(toCase) ...
unknown
unknown
[Word boundary identification > Convert to any case] ```js const convertCase = (str, toCase = 'camel') => { if (!str) return ''; const delimiter = toCase === 'snake' ? '_' : toCase === 'kebab' ? '-' : ['title', 'sentence'].includes(toCase) ? ' ' : ''; const transform = ['camel', 'pascal'].includes(toCase) ...
[Word boundary identification > Convert to any case] ```js const convertCase = (str, toCase = 'camel') => { if (!str) return ''; const delimiter = toCase === 'snake' ? '_' : toCase === 'kebab' ? '-' : ['title', 'sentence'].includes(toCase) ? ' ' : ''; const transform = ['camel', 'pascal'].includes(toCase) ...
code_snippets
658c86ed-e3ab-4707-93d2-815c265011c5
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
10
SemanticChunker@1.0.0
bbfc4f25232271f982e02b47e213df36bee47a39829b862f2d1acd6671b60128
[Word boundary identification > Convert to any case] While this code certainly is complex, it builds on top of all previous snippets, conditionally applying the appropriate transformations based on the desired case. As many of the snippets share similarities, the conditions are condensed as much as possible to avoid r...
unknown
unknown
[Word boundary identification > Convert to any case] While this code certainly is complex, it builds on top of all previous snippets, conditionally applying the appropriate transformations based on the desired case. As many of the snippets share similarities, the conditions are condensed as much as possible to avoid r...
[Word boundary identification > Convert to any case] While this code certainly is complex, it builds on top of all previous snippets, conditionally applying the appropriate transformations based on the desired case. As many of the snippets share similarities, the conditions are condensed as much as possible to avoid r...
code_snippets
71208490-b774-4302-af4e-879baba3bf77
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
1
SemanticChunker@1.0.0
ebf70780ce3913a8fef2826aaedc20e4b36163a3da7970df01806cae9b240577
[Word boundary identification] ## Word boundary identification Before we can convert a string to a different case, we need to be able to identify the **boundaries between words**. While a naive approach could rely on spaces or other delimiters to separate words, this approach is not robust enough to handle all cases....
unknown
unknown
[Word boundary identification] ## Word boundary identification Before we can convert a string to a different case, we need to be able to identify the **boundaries between words**. While a naive approach could rely on spaces or other delimiters to separate words, this approach is not robust enough to handle all cases....
[Word boundary identification] ## Word boundary identification Before we can convert a string to a different case, we need to be able to identify the **boundaries between words**. While a naive approach could rely on spaces or other delimiters to separate words, this approach is not robust enough to handle all cases....
code_snippets
a42594b0-f841-435f-9f27-31acb549fe3c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
8
SemanticChunker@1.0.0
b1ba70f926443b81f6df25391565a2e01ddb26e0effe0c55fdf274372f3f2168
[Word boundary identification > Convert to any case] ## Convert to any case That was a lot of code snippets to go through and you might need more than one in your project. Let's see if we can combine them all into one function that expects a case as an argument and returns the converted string.
unknown
unknown
[Word boundary identification > Convert to any case] ## Convert to any case That was a lot of code snippets to go through and you might need more than one in your project. Let's see if we can combine them all into one function that expects a case as an argument and returns the converted string.
[Word boundary identification > Convert to any case] ## Convert to any case That was a lot of code snippets to go through and you might need more than one in your project. Let's see if we can combine them all into one function that expects a case as an argument and returns the converted string.
code_snippets
bccd530e-bd5d-452d-b9a2-85d2a1fb70d2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
6
SemanticChunker@1.0.0
04c08edcfcfe92066dcc3f917af1fe8cf6f2feb1f0b491e7be8bcef4d7751e19
[Word boundary identification > Convert any case to title case] ## Convert any case to title case **Title case** is most often used in titles or headings. Title case strings have **the first letter of each word capitalized, with words separated by spaces**. For example `Some Name` is title case, but `Some name` is no...
unknown
unknown
[Word boundary identification > Convert any case to title case] ## Convert any case to title case **Title case** is most often used in titles or headings. Title case strings have **the first letter of each word capitalized, with words separated by spaces**. For example `Some Name` is title case, but `Some name` is no...
[Word boundary identification > Convert any case to title case] ## Convert any case to title case **Title case** is most often used in titles or headings. Title case strings have **the first letter of each word capitalized, with words separated by spaces**. For example `Some Name` is title case, but `Some name` is no...
code_snippets
d208e0f7-17b8-4d6d-81f8-2657734d429e
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
2
SemanticChunker@1.0.0
f867652bd2ac03e567f56bb13c7e4a78231b74cfc504c1b335332bc1da00fe63
[Word boundary identification > Convert any case to camel case] ## Convert any case to camel case The **camel case** naming convention requires that the **first letter of each word is capitalized, except for the first word**. For example `someName` is camel case, but `SomeName` is not. This convention is used in Java...
unknown
unknown
[Word boundary identification > Convert any case to camel case] ## Convert any case to camel case The **camel case** naming convention requires that the **first letter of each word is capitalized, except for the first word**. For example `someName` is camel case, but `SomeName` is not. This convention is used in Java...
[Word boundary identification > Convert any case to camel case] ## Convert any case to camel case The **camel case** naming convention requires that the **first letter of each word is capitalized, except for the first word**. For example `someName` is camel case, but `SomeName` is not. This convention is used in Java...
code_snippets
f8e0d532-ab35-4f31-9065-436459871411
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-case-conversion.md
unknown
d1322f47-6a8a-4bfa-be3e-c820432e0874
0
SemanticChunker@1.0.0
4f235e24a677a4ed1c1b6345f44a023f442eb991f42b22de1db0f6253271fa84
--- title: Case conversion in JavaScript shortTitle: Case conversion language: javascript tags: [string,regexp] cover: chubby-squirrel excerpt: A complete guide to case conversion in JavaScript, including camel case, kebab case, snake case, Pascal case, title case and sentence case. listed: true dateModified: 2023-12-3...
unknown
unknown
--- title: Case conversion in JavaScript shortTitle: Case conversion language: javascript tags: [string,regexp] cover: chubby-squirrel excerpt: A complete guide to case conversion in JavaScript, including camel case, kebab case, snake case, Pascal case, title case and sentence case. listed: true dateModified: 2023-12-3...
--- title: Case conversion in JavaScript shortTitle: Case conversion language: javascript tags: [string,regexp] cover: chubby-squirrel excerpt: A complete guide to case conversion in JavaScript, including camel case, kebab case, snake case, Pascal case, title case and sentence case. listed: true dateModified: 2023-12-3...
code_snippets
6178c93a-359d-4aba-b8f4-f26cc18d9d6a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/spread-operator-tricks.md
unknown
577bc967-f079-47d2-901b-6c7027862744
3
SemanticChunker@1.0.0
900ab533a1906e7056ff4fb4977e1a933e72406437062ddb291abff70087d795
[Clone an array > Add items to an array] ## Add items to an array Similarly to previous tricks, it's possible to spread an array into a new one and add individual elements, too. This can also be combined with merging multiple arrays, if desired. ```js const arr = [1, 2, 3]; const arr2 = [0, ...arr, 4]; // [0, 1, 2, ...
unknown
unknown
[Clone an array > Add items to an array] ## Add items to an array Similarly to previous tricks, it's possible to spread an array into a new one and add individual elements, too. This can also be combined with merging multiple arrays, if desired. ```js const arr = [1, 2, 3]; const arr2 = [0, ...arr, 4]; // [0, 1, 2, ...
[Clone an array > Add items to an array] ## Add items to an array Similarly to previous tricks, it's possible to spread an array into a new one and add individual elements, too. This can also be combined with merging multiple arrays, if desired. ```js const arr = [1, 2, 3]; const arr2 = [0, ...arr, 4]; // [0, 1, 2, ...
code_snippets
70bdb5de-4b03-45ef-84f2-eb8e39a1ffcf
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/spread-operator-tricks.md
unknown
577bc967-f079-47d2-901b-6c7027862744
1
SemanticChunker@1.0.0
1c348f0913aeee41d45bec58ee310c9c409840c67ec762d6f2ff1ae340c0f502
[Clone an array] ## Clone an array The spread operator can be used to clone an array into a new array. This trick can come in handy when working with arrays of primitives. However, it only shallow clones the array, meaning nested non-primitive values will not be cloned. ```js const arr = [1, 2, 3]; const arr2 = [......
unknown
unknown
[Clone an array] ## Clone an array The spread operator can be used to clone an array into a new array. This trick can come in handy when working with arrays of primitives. However, it only shallow clones the array, meaning nested non-primitive values will not be cloned. ```js const arr = [1, 2, 3]; const arr2 = [......
[Clone an array] ## Clone an array The spread operator can be used to clone an array into a new array. This trick can come in handy when working with arrays of primitives. However, it only shallow clones the array, meaning nested non-primitive values will not be cloned. ```js const arr = [1, 2, 3]; const arr2 = [......
code_snippets
773cc329-8cd1-491e-99ee-784a24cd9b65
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/spread-operator-tricks.md
unknown
577bc967-f079-47d2-901b-6c7027862744
0
SemanticChunker@1.0.0
17271b74c42cb20408333b00d74532be3395594fa03e6c04dfa785ed9aea4353
--- title: 3 ways to use the JavaScript spread operator with arrays shortTitle: Array tricks using the spread operator language: javascript tags: [array] cover: succulent-crowd excerpt: JavaScript's spread operator is a very versatile tool. Here are some simple ways to use it. listed: true dateModified: 2022-04-17 ---
unknown
unknown
--- title: 3 ways to use the JavaScript spread operator with arrays shortTitle: Array tricks using the spread operator language: javascript tags: [array] cover: succulent-crowd excerpt: JavaScript's spread operator is a very versatile tool. Here are some simple ways to use it. listed: true dateModified: 2022-04-17 ---
--- title: 3 ways to use the JavaScript spread operator with arrays shortTitle: Array tricks using the spread operator language: javascript tags: [array] cover: succulent-crowd excerpt: JavaScript's spread operator is a very versatile tool. Here are some simple ways to use it. listed: true dateModified: 2022-04-17 ---
code_snippets
ac2fe736-b64d-4615-9968-9b2717567062
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/spread-operator-tricks.md
unknown
577bc967-f079-47d2-901b-6c7027862744
2
SemanticChunker@1.0.0
1190972fac1daef5d443dad6e60de8f586796e42a7c0f9cf9e831cb91f4e17d9
[Clone an array > Merge multiple arrays] ## Merge multiple arrays Using the spread operator, it's possible to combine two or more arrays into one. You should think of this trick as cloning two arrays into a new one. Due to that, the shallow cloning limitation mentioned previously applies here, too. ```js const arr1 ...
unknown
unknown
[Clone an array > Merge multiple arrays] ## Merge multiple arrays Using the spread operator, it's possible to combine two or more arrays into one. You should think of this trick as cloning two arrays into a new one. Due to that, the shallow cloning limitation mentioned previously applies here, too. ```js const arr1 ...
[Clone an array > Merge multiple arrays] ## Merge multiple arrays Using the spread operator, it's possible to combine two or more arrays into one. You should think of this trick as cloning two arrays into a new one. Due to that, the shallow cloning limitation mentioned previously applies here, too. ```js const arr1 ...
code_snippets
4abc4294-5381-497f-9896-3b2f39ed1cb4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-contains-substring.md
unknown
3ea9e5d6-24da-467c-8d9f-94bf2857b46e
0
SemanticChunker@1.0.0
ee763787821357bfa1130824713873be734cc1ccabbddce30bef1bf84fb33ed3
--- title: Check if a string contains a substring in JavaScript shortTitle: String contains substring language: javascript tags: [string] cover: cave-explorer excerpt: Let's have a look at how to check if a string contains a substring in JavaScript. listed: true dateModified: 2022-07-27 ---
unknown
unknown
--- title: Check if a string contains a substring in JavaScript shortTitle: String contains substring language: javascript tags: [string] cover: cave-explorer excerpt: Let's have a look at how to check if a string contains a substring in JavaScript. listed: true dateModified: 2022-07-27 ---
--- title: Check if a string contains a substring in JavaScript shortTitle: String contains substring language: javascript tags: [string] cover: cave-explorer excerpt: Let's have a look at how to check if a string contains a substring in JavaScript. listed: true dateModified: 2022-07-27 ---
code_snippets
905f8526-3441-4f38-8cae-d9cedffd2f7b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-contains-substring.md
unknown
3ea9e5d6-24da-467c-8d9f-94bf2857b46e
3
SemanticChunker@1.0.0
e11495643f97a7f79cdabda4fdc5d4cf48029fc794e48a5ddaa3ffa5296f7c5e
[String.prototype.includes() > Case-insensitive substring search] ## Case-insensitive substring search Both methods presented so far are case-sensitive. If you need to search for a substring that is case-insensitive, you can use `String.prototype.toLowerCase()` to convert both strings to lowercase. Then you can compa...
unknown
unknown
[String.prototype.includes() > Case-insensitive substring search] ## Case-insensitive substring search Both methods presented so far are case-sensitive. If you need to search for a substring that is case-insensitive, you can use `String.prototype.toLowerCase()` to convert both strings to lowercase. Then you can compa...
[String.prototype.includes() > Case-insensitive substring search] ## Case-insensitive substring search Both methods presented so far are case-sensitive. If you need to search for a substring that is case-insensitive, you can use `String.prototype.toLowerCase()` to convert both strings to lowercase. Then you can compa...
code_snippets
a8cf9148-0625-480e-afea-26e39c8fed5b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-contains-substring.md
unknown
3ea9e5d6-24da-467c-8d9f-94bf2857b46e
2
SemanticChunker@1.0.0
12db4ac12bd22ff7c8df1f61bef9e1841d708eefe062180a7d84ba592e158425
[String.prototype.includes() > String.prototype.indexOf()] ## String.prototype.indexOf() Another option is `String.prototype.indexOf()`, which can be preferable if you need to support legacy browsers. As this methods returns the index of the first occurrence of the substring, you need to compare it to `-1` to know if...
unknown
unknown
[String.prototype.includes() > String.prototype.indexOf()] ## String.prototype.indexOf() Another option is `String.prototype.indexOf()`, which can be preferable if you need to support legacy browsers. As this methods returns the index of the first occurrence of the substring, you need to compare it to `-1` to know if...
[String.prototype.includes() > String.prototype.indexOf()] ## String.prototype.indexOf() Another option is `String.prototype.indexOf()`, which can be preferable if you need to support legacy browsers. As this methods returns the index of the first occurrence of the substring, you need to compare it to `-1` to know if...
code_snippets
cb25364e-629f-479d-81d5-4cf654bb4c9d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/string-contains-substring.md
unknown
3ea9e5d6-24da-467c-8d9f-94bf2857b46e
1
SemanticChunker@1.0.0
8bb22ccd6d900ff48bec14ce18a88deb73e4c0add853db602b4e9314d3a76adf
[String.prototype.includes()] ## String.prototype.includes() The most straightforward substring search option is `String.prototype.includes()`, introduced in ES6. It's a simple method that returns a boolean value depending on whether the string contains the substring or not. ```js const str = 'Hello world'; str.incl...
unknown
unknown
[String.prototype.includes()] ## String.prototype.includes() The most straightforward substring search option is `String.prototype.includes()`, introduced in ES6. It's a simple method that returns a boolean value depending on whether the string contains the substring or not. ```js const str = 'Hello world'; str.incl...
[String.prototype.includes()] ## String.prototype.includes() The most straightforward substring search option is `String.prototype.includes()`, introduced in ES6. It's a simple method that returns a boolean value depending on whether the string contains the substring or not. ```js const str = 'Hello world'; str.incl...
code_snippets
0de41f61-c65c-4f72-9688-3568bfed4b43
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/split-array-into-chunks.md
unknown
83be3efd-5272-4f01-863b-715c62069711
1
SemanticChunker@1.0.0
0a870cb13104398c5bd9a9fe3e0c1e89d260f76a89eba2da8123d494bf7ec3fa
[Split array into chunks of a given size] ## Split array into chunks of a given size In order to split an array into chunks of a given size, you need to know the **amount of chunks that will be produced**. This can be calculated by dividing the length of the array by the size of each chunk and rounding up to the near...
unknown
unknown
[Split array into chunks of a given size] ## Split array into chunks of a given size In order to split an array into chunks of a given size, you need to know the **amount of chunks that will be produced**. This can be calculated by dividing the length of the array by the size of each chunk and rounding up to the near...
[Split array into chunks of a given size] ## Split array into chunks of a given size In order to split an array into chunks of a given size, you need to know the **amount of chunks that will be produced**. This can be calculated by dividing the length of the array by the size of each chunk and rounding up to the near...
code_snippets
449655ad-6c19-4585-ab39-8a417a7a61ce
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/split-array-into-chunks.md
unknown
83be3efd-5272-4f01-863b-715c62069711
4
SemanticChunker@1.0.0
2998d40b5f890812617694a55bbaf66c1ad3b65ac5cdc1e17118375d57064633
[Split array into chunks of a given size > Split iterable into chunks of a given size] ## Split iterable into chunks of a given size Any iterable can be chunked in a similar fashion, using a **generator function**. The only difference is that the iterable needs to be iterated over using a `for...of` loop, instead of ...
unknown
unknown
[Split array into chunks of a given size > Split iterable into chunks of a given size] ## Split iterable into chunks of a given size Any iterable can be chunked in a similar fashion, using a **generator function**. The only difference is that the iterable needs to be iterated over using a `for...of` loop, instead of ...
[Split array into chunks of a given size > Split iterable into chunks of a given size] ## Split iterable into chunks of a given size Any iterable can be chunked in a similar fashion, using a **generator function**. The only difference is that the iterable needs to be iterated over using a `for...of` loop, instead of ...
code_snippets
676e5b31-a5e3-44c9-8b40-27e57c1ad151
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/split-array-into-chunks.md
unknown
83be3efd-5272-4f01-863b-715c62069711
0
SemanticChunker@1.0.0
1407f7b30f8246b2a2f3f1c7fe4e21aa5ca3c142a4511d9240fd7d0db1459e9d
--- title: Split a JavaScript array into chunks shortTitle: Split array into chunks language: javascript tags: [array,function,generator] cover: filter-coffee-pot excerpt: Chunk an array or iterable into arrays of a specified size or a given number of chunks. listed: true dateModified: 2023-11-07 ---
unknown
unknown
--- title: Split a JavaScript array into chunks shortTitle: Split array into chunks language: javascript tags: [array,function,generator] cover: filter-coffee-pot excerpt: Chunk an array or iterable into arrays of a specified size or a given number of chunks. listed: true dateModified: 2023-11-07 ---
--- title: Split a JavaScript array into chunks shortTitle: Split array into chunks language: javascript tags: [array,function,generator] cover: filter-coffee-pot excerpt: Chunk an array or iterable into arrays of a specified size or a given number of chunks. listed: true dateModified: 2023-11-07 ---
code_snippets
743a9a90-e90e-4d03-bb40-b2f3c5399675
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/split-array-into-chunks.md
unknown
83be3efd-5272-4f01-863b-715c62069711
2
SemanticChunker@1.0.0
56b557f52931ae6de085f88b92ce8525ebad93846be01a37bfcede7ff99c9ed6
[Split array into chunks of a given size > Split array into a given number of chunks] ## Split array into a given number of chunks Similarly, in order to split an array into a given number of chunks, you need to **know the size of each chunk**. This can be calculated by dividing the length of the array by the number ...
unknown
unknown
[Split array into chunks of a given size > Split array into a given number of chunks] ## Split array into a given number of chunks Similarly, in order to split an array into a given number of chunks, you need to **know the size of each chunk**. This can be calculated by dividing the length of the array by the number ...
[Split array into chunks of a given size > Split array into a given number of chunks] ## Split array into a given number of chunks Similarly, in order to split an array into a given number of chunks, you need to **know the size of each chunk**. This can be calculated by dividing the length of the array by the number ...
code_snippets
7838a46c-2c1d-4b05-9111-845cb55ee332
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/split-array-into-chunks.md
unknown
83be3efd-5272-4f01-863b-715c62069711
3
SemanticChunker@1.0.0
859fcce799d4a02b1166db85b976e829883ae06463b3e5e3baff356fadae1e37
[Split array into chunks of a given size > Split array into chunks, without dangling elements] ## Split array into chunks, without dangling elements As mentioned previously, **the final chunk can contain fewer elements** than the specified size, if the original array can't be split evenly. In order to alter this beha...
unknown
unknown
[Split array into chunks of a given size > Split array into chunks, without dangling elements] ## Split array into chunks, without dangling elements As mentioned previously, **the final chunk can contain fewer elements** than the specified size, if the original array can't be split evenly. In order to alter this beha...
[Split array into chunks of a given size > Split array into chunks, without dangling elements] ## Split array into chunks, without dangling elements As mentioned previously, **the final chunk can contain fewer elements** than the specified size, if the original array can't be split evenly. In order to alter this beha...
code_snippets
171376a7-2fd8-4faa-a860-dde660916707
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-solver-wave-function-collapse.md
unknown
111d3ddb-7570-41ae-b477-7109cc3d7616
2
SemanticChunker@1.0.0
93072426ab8d88153ba74f9a25b035998697a3bfe03a922da71267b02f7b7ac3
[Approach > Implementation] ## Implementation Given the previous explanation, the implementation is straightforward. We'll create a function that initializes the board, finds cells with the fewest possibilities, and **recursively** fills in the board using the wave functio ncollapse technique.
unknown
unknown
[Approach > Implementation] ## Implementation Given the previous explanation, the implementation is straightforward. We'll create a function that initializes the board, finds cells with the fewest possibilities, and **recursively** fills in the board using the wave functio ncollapse technique.
[Approach > Implementation] ## Implementation Given the previous explanation, the implementation is straightforward. We'll create a function that initializes the board, finds cells with the fewest possibilities, and **recursively** fills in the board using the wave functio ncollapse technique.
code_snippets
28bf2235-7ffe-4aa0-b0e0-e97bf90f24a3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-solver-wave-function-collapse.md
unknown
111d3ddb-7570-41ae-b477-7109cc3d7616
0
SemanticChunker@1.0.0
0cfb69b894b0f97f5ea579bb2285fd8acb14dc8e4ddb82d554b23288cbc25c34
--- title: Solving Sudoku with wave function collapse in JavaScript shortTitle: Sudoku Solver (Wave Function Collapse) language: javascript tags: [algorithm,array,recursion] cover: snowy-mountains excerpt: Explore how to solve Sudoku puzzles in JavaScript using the wave function collapse algorithm, a constraint-propaga...
unknown
unknown
--- title: Solving Sudoku with wave function collapse in JavaScript shortTitle: Sudoku Solver (Wave Function Collapse) language: javascript tags: [algorithm,array,recursion] cover: snowy-mountains excerpt: Explore how to solve Sudoku puzzles in JavaScript using the wave function collapse algorithm, a constraint-propaga...
--- title: Solving Sudoku with wave function collapse in JavaScript shortTitle: Sudoku Solver (Wave Function Collapse) language: javascript tags: [algorithm,array,recursion] cover: snowy-mountains excerpt: Explore how to solve Sudoku puzzles in JavaScript using the wave function collapse algorithm, a constraint-propaga...
code_snippets
48cd40f2-2e1c-4d7b-9fb0-c7f7ab85cdf1
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-solver-wave-function-collapse.md
unknown
111d3ddb-7570-41ae-b477-7109cc3d7616
1
SemanticChunker@1.0.0
f9933fe7880514547c7c390ef52f199d72924edf94b7ccfe810389a87c208500
[Approach] ## Approach Wave function collapse is about **reducing possibilities**. Each empty cell starts with all possible digits (1-9). As we fill in cells, we **propagate constraints** to neighboring cells, shrinking their options. When a cell has only one possibility, we collapse it (set its value) and repeat the...
unknown
unknown
[Approach] ## Approach Wave function collapse is about **reducing possibilities**. Each empty cell starts with all possible digits (1-9). As we fill in cells, we **propagate constraints** to neighboring cells, shrinking their options. When a cell has only one possibility, we collapse it (set its value) and repeat the...
[Approach] ## Approach Wave function collapse is about **reducing possibilities**. Each empty cell starts with all possible digits (1-9). As we fill in cells, we **propagate constraints** to neighboring cells, shrinking their options. When a cell has only one possibility, we collapse it (set its value) and repeat the...
code_snippets
566e2407-4667-4672-804a-b9ff092f65d7
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-solver-wave-function-collapse.md
unknown
111d3ddb-7570-41ae-b477-7109cc3d7616
3
SemanticChunker@1.0.0
0e3f336740a8dd74897917d5f30dbf56097732117308565265fb92231c53bafe
[Approach > Implementation] ```js // List of all possible values for a Sudoku cell const allValues = ['1', '2', '3', '4', '5', '6', '7', '8', '9']; // Get used values in a row, column, and sub-box const getUsedValues = (row, col, board) => { const usedValues = new Set(); // Row and column checks for (let i = 0; i...
unknown
unknown
[Approach > Implementation] ```js // List of all possible values for a Sudoku cell const allValues = ['1', '2', '3', '4', '5', '6', '7', '8', '9']; // Get used values in a row, column, and sub-box const getUsedValues = (row, col, board) => { const usedValues = new Set(); // Row and column checks for (let i = 0; i...
[Approach > Implementation] ```js // List of all possible values for a Sudoku cell const allValues = ['1', '2', '3', '4', '5', '6', '7', '8', '9']; // Get used values in a row, column, and sub-box const getUsedValues = (row, col, board) => { const usedValues = new Set(); // Row and column checks for (let i = 0; i...
code_snippets
83685d5f-74f9-44e0-bd55-ab698f2e5c09
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-solver-wave-function-collapse.md
unknown
111d3ddb-7570-41ae-b477-7109cc3d7616
5
SemanticChunker@1.0.0
825a73a993800f248c7c2cea6093fd778a3ae828d369e01e61bddc02d8b8f6d5
[Approach > Performance] ## Performance This approach is **efficient for most standard Sudoku puzzles**. The wave function collapse technique prunes the search space aggressively, often solving puzzles in very little time. However, for extremely hard or ambiguous boards, extensive backtracking may still be required, ...
unknown
unknown
[Approach > Performance] ## Performance This approach is **efficient for most standard Sudoku puzzles**. The wave function collapse technique prunes the search space aggressively, often solving puzzles in very little time. However, for extremely hard or ambiguous boards, extensive backtracking may still be required, ...
[Approach > Performance] ## Performance This approach is **efficient for most standard Sudoku puzzles**. The wave function collapse technique prunes the search space aggressively, often solving puzzles in very little time. However, for extremely hard or ambiguous boards, extensive backtracking may still be required, ...
code_snippets
9e7efa92-8a96-4995-9a90-4bb9ddb69ccb
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-solver-wave-function-collapse.md
unknown
111d3ddb-7570-41ae-b477-7109cc3d7616
4
SemanticChunker@1.0.0
9a5bf0ea0ef6a225c6d1a2a484e925a9dcdb12f123b4542d4aed0f1b189c7e7b
[Approach > Implementation] ```js // [continued: part 1] const solveRecursively = board => { const nextCell = findCandidate(board); // If no cell found, the board is solved if (!nextCell) return true; // Get the cell position and possible values const [row, col] = nextCell.cellPosition; // Try each possible va...
unknown
unknown
[Approach > Implementation] ```js // [continued: part 1] const solveRecursively = board => { const nextCell = findCandidate(board); // If no cell found, the board is solved if (!nextCell) return true; // Get the cell position and possible values const [row, col] = nextCell.cellPosition; // Try each possible va...
[Approach > Implementation] ```js // [continued: part 1] const solveRecursively = board => { const nextCell = findCandidate(board); // If no cell found, the board is solved if (!nextCell) return true; // Get the cell position and possible values const [row, col] = nextCell.cellPosition; // Try each possible va...
code_snippets
ad1a4ded-beb1-423a-b6cf-9955a1d49f89
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-solver-wave-function-collapse.md
unknown
111d3ddb-7570-41ae-b477-7109cc3d7616
6
SemanticChunker@1.0.0
491a673d7e65ef46d6d58e27ac783d9642d39a80bbbf66ded2eea08a67ad02fb
[Approach > Conclusion] ## Conclusion The wave function collapse algorithm is a **powerful tool** that can be applied to various **constraint satisfaction problems**, including Sudoku. By leveraging constraint propagation and recursive backtracking, we can efficiently solve puzzles while maintaining clarity in our co...
unknown
unknown
[Approach > Conclusion] ## Conclusion The wave function collapse algorithm is a **powerful tool** that can be applied to various **constraint satisfaction problems**, including Sudoku. By leveraging constraint propagation and recursive backtracking, we can efficiently solve puzzles while maintaining clarity in our co...
[Approach > Conclusion] ## Conclusion The wave function collapse algorithm is a **powerful tool** that can be applied to various **constraint satisfaction problems**, including Sudoku. By leveraging constraint propagation and recursive backtracking, we can efficiently solve puzzles while maintaining clarity in our co...
code_snippets
0fb76de9-d6e2-4308-b768-f3adf2b1a2d7
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-validator.md
unknown
70c493f0-6ae5-4b30-8f6d-58f2f6bd0cb3
4
SemanticChunker@1.0.0
46ca1ea5ca27cf76bc0d1e99735e2aa33e9530a510468cde21a9203b011c87fa
[Optimization > Remove intermediate arrays] ``` ### Return early Another clear optimization is to **return early when we find a duplicate**. Right now, we are processing the entire row, column, or sub-box, before we can check for duplicates. But, our `Set` can be used earlier to **check for duplicates as we iterate*...
unknown
unknown
[Optimization > Remove intermediate arrays] ``` ### Return early Another clear optimization is to **return early when we find a duplicate**. Right now, we are processing the entire row, column, or sub-box, before we can check for duplicates. But, our `Set` can be used earlier to **check for duplicates as we iterate*...
[Optimization > Remove intermediate arrays] ``` ### Return early Another clear optimization is to **return early when we find a duplicate**. Right now, we are processing the entire row, column, or sub-box, before we can check for duplicates. But, our `Set` can be used earlier to **check for duplicates as we iterate*...
code_snippets
6cc8aed3-3eff-44a0-b247-f0b696c9fff9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/sudoku-validator.md
unknown
70c493f0-6ae5-4b30-8f6d-58f2f6bd0cb3
2
SemanticChunker@1.0.0
a7c6e0627bbccacc69d50ae032b9ea0fa9f8b833d773dd76d97f34d42a82fcb5
[Approach > Implementation] ## Implementation Given the previous explanation, the implementation is straightforward. We'll iterate through the rows, columns, and sub-boxes, filtering out empty cells and checking for duplicates using `Set`. If any of these checks fail, we return `false`. If all checks pass, we return ...
unknown
unknown
[Approach > Implementation] ## Implementation Given the previous explanation, the implementation is straightforward. We'll iterate through the rows, columns, and sub-boxes, filtering out empty cells and checking for duplicates using `Set`. If any of these checks fail, we return `false`. If all checks pass, we return ...
[Approach > Implementation] ## Implementation Given the previous explanation, the implementation is straightforward. We'll iterate through the rows, columns, and sub-boxes, filtering out empty cells and checking for duplicates using `Set`. If any of these checks fail, we return `false`. If all checks pass, we return ...
code_snippets