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
2b914e78-ab09-4559-a817-2a841082e106
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
14
SemanticChunker@1.0.0
8d21162d2170f47351e715bc3e0f93c8ea216f56d081aa2e42463683191cf8ca
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
unknown
unknown
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
ai_ref_knowledge
a6765ac7-ed10-46df-bba6-2debf67e3bc6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
11
SemanticChunker@1.0.0
f3b3e5ff4db43ddd5d2879f5996c927f8df4e321497c2cbc43256af3cf4f0636
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
unknown
unknown
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
ai_ref_knowledge
ef80a937-9e5a-48bb-8929-8231130e5a8a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
13
SemanticChunker@1.0.0
d2532103e4aec1bebc4c3cdd3cb271446734a4fcd145a04f45b3634b4e23c2d9
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
unknown
unknown
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
ai_ref_knowledge
0fb820a6-cc76-49cd-b857-dc8eb1daf7d2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
18
SemanticChunker@1.0.0
1c7943fbe945c8422e4f6ac363d1b6f37113df3dba962e9f57c56594c7f14ca9
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
unknown
unknown
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
ai_ref_knowledge
1c31c096-34d9-4da8-917a-c5eb7346f30b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
15
SemanticChunker@1.0.0
229619eff2676e6680e4a0ce9404c2a8741493ae074df52abcbf18b3769d9ddb
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
unknown
unknown
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
ai_ref_knowledge
3bd23590-1982-4f24-bddb-1075be577509
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
26
SemanticChunker@1.0.0
a5fa76d23b73dab24cf7bb2a1bd568e92d571b1425c9028852d7f7d43c956745
[Directory structure > Addendum: Code summary] select(...attributes) { return RecordSet.from(super.map(record => attributes.reduce((acc, attribute) => { acc[attribute] = record[attribute]; return acc; }, {}) )); } get first() { return this[0]; } get last() { return this[this.length - 1]; } } ``` ```js...
unknown
unknown
[Directory structure > Addendum: Code summary] select(...attributes) { return RecordSet.from(super.map(record => attributes.reduce((acc, attribute) => { acc[attribute] = record[attribute]; return acc; }, {}) )); } get first() { return this[0]; } get last() { return this[this.length - 1]; } } ``` ```js...
[Directory structure > Addendum: Code summary] select(...attributes) { return RecordSet.from(super.map(record => attributes.reduce((acc, attribute) => { acc[attribute] = record[attribute]; return acc; }, {}) )); } get first() { return this[0]; } get last() { return this[this.length - 1]; } } ``` ```js...
ai_ref_knowledge
46302623-41d0-41f6-8733-d8f2a3b2c574
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
25
SemanticChunker@1.0.0
7408d77512ddd7910799151cbbf2287f7c3c6926a4d3af0da1ef1dcb452cfea1
[Directory structure > Addendum: Code summary] ``` # [continued: part 3] static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.length !== 1) throw new Error('findBy method must receive a single field/v...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` # [continued: part 3] static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.length !== 1) throw new Error('findBy method must receive a single field/v...
[Directory structure > Addendum: Code summary] ``` # [continued: part 3] static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.length !== 1) throw new Error('findBy method must receive a single field/v...
ai_ref_knowledge
5484f650-b23f-4cf8-ba6f-219ae4125f6c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
28
SemanticChunker@1.0.0
428281eed5fcb709016432ed27b7415a35127e811aa8d76d882a0e21ae0b0855
[Directory structure > Addendum: Code summary] ``` ```js title="src/scripts/autoload.js" import { readdir } from 'node:fs/promises'; import settings from '#src/config/settings.js'; const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1); const autoload = async () => { const moduleMap = new Map(); f...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/scripts/autoload.js" import { readdir } from 'node:fs/promises'; import settings from '#src/config/settings.js'; const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1); const autoload = async () => { const moduleMap = new Map(); f...
[Directory structure > Addendum: Code summary] ``` ```js title="src/scripts/autoload.js" import { readdir } from 'node:fs/promises'; import settings from '#src/config/settings.js'; const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1); const autoload = async () => { const moduleMap = new Map(); f...
ai_ref_knowledge
5ec42ef0-ced9-4926-a7c2-ef0c200eefa8
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
22
SemanticChunker@1.0.0
28b9183f95f6bf6be4b49f6fa883682e91a63e16e19385d4d87254aa92a78400
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/model.js" import RecordSet from '#src/core/recordSet.js'; import util from 'util'; util.inspect.styles.record = 'blue'; const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom'); const capitalize = str => str.charAt(0).toUpperCase(...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/model.js" import RecordSet from '#src/core/recordSet.js'; import util from 'util'; util.inspect.styles.record = 'blue'; const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom'); const capitalize = str => str.charAt(0).toUpperCase(...
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/model.js" import RecordSet from '#src/core/recordSet.js'; import util from 'util'; util.inspect.styles.record = 'blue'; const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom'); const capitalize = str => str.charAt(0).toUpperCase(...
ai_ref_knowledge
7a77bd32-8ef2-4a2b-bcab-dcd1eff0099e
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
21
SemanticChunker@1.0.0
ce31e95f876eb4ba3ffcc9c8f477115012525668465244b5ec4bfef2c6a867b4
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
unknown
unknown
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
ai_ref_knowledge
8195e7c1-7ad9-49f6-8b9e-a0661688e3a4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
27
SemanticChunker@1.0.0
a6b87ae067460c0f82ba5f7dfdedf3b7ea11adbe832034a80412d9cfe09088cb
[Directory structure > Addendum: Code summary] export default class Factory { static factoryMap = new Map(); static modelMap = new Map(); static prepare(factory, model, base = {}, traits = {}) { const modelName = model.name; const factoryBase = {}; Object.keys(base).forEach(key => { const value = base[key]; ...
unknown
unknown
[Directory structure > Addendum: Code summary] export default class Factory { static factoryMap = new Map(); static modelMap = new Map(); static prepare(factory, model, base = {}, traits = {}) { const modelName = model.name; const factoryBase = {}; Object.keys(base).forEach(key => { const value = base[key]; ...
[Directory structure > Addendum: Code summary] export default class Factory { static factoryMap = new Map(); static modelMap = new Map(); static prepare(factory, model, base = {}, traits = {}) { const modelName = model.name; const factoryBase = {}; Object.keys(base).forEach(key => { const value = base[key]; ...
ai_ref_knowledge
8a0addaa-f451-4431-abd4-5362c3522156
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/articles/s/how-30-seconds-of-code-is-deployed.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
32
SemanticChunker@1.0.0
b8a230b61f0130f5cf7a077203d893b28cd924ea6f7344139e9a93193a8c4f42
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
unknown
unknown
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
ai_ref_knowledge
8b16a540-ea86-4c12-9f77-2321be5d6e52
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
16
SemanticChunker@1.0.0
e4d4faefcf3c77ca1b8918893cd2298077ee60c9031d6c4d48c08211f4f6c0b6
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
unknown
unknown
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
ai_ref_knowledge
92cc3475-042c-419d-b74d-e05f79ed4fe2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
30
SemanticChunker@1.0.0
322d7fd414fd09abcfadbf77d75e8b69db328bde76fc2ba813cf372da49387a0
[Directory structure > Addendum: Code summary] ``` ```js title="src/models/category.js" import Model from '#src/core/model.js'; export default class Category extends Model { static { // Prepare storage for the Category model super.prepare(this, { fields: [['title', { type: 'string', allowEmpty: false }]], relat...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/models/category.js" import Model from '#src/core/model.js'; export default class Category extends Model { static { // Prepare storage for the Category model super.prepare(this, { fields: [['title', { type: 'string', allowEmpty: false }]], relat...
[Directory structure > Addendum: Code summary] ``` ```js title="src/models/category.js" import Model from '#src/core/model.js'; export default class Category extends Model { static { // Prepare storage for the Category model super.prepare(this, { fields: [['title', { type: 'string', allowEmpty: false }]], relat...
ai_ref_knowledge
9e6d1375-f645-4615-8b3a-02718ea30a1d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
20
SemanticChunker@1.0.0
d87de34cf60f4bde69255451cb41c5a83c0cc2fb4304ff853c9faa52ed433cd5
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
unknown
unknown
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
ai_ref_knowledge
c4b800be-fe79-44d4-9ee4-4636bb47bab4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
23
SemanticChunker@1.0.0
64249d3e5b747b471fd476dbb7d05e544755451e06410756f4de5111f772bb20
[Directory structure > Addendum: Code summary] ``` # [continued: part 1] Object.defineProperty(model.prototype, propertyName, { get() { const targetModel = Model.models[capitalize(toSingular(options.target))]; return targetModel.where({ [foreignKey]: this.id }); }, configurable: true, }); } else { throw new...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` # [continued: part 1] Object.defineProperty(model.prototype, propertyName, { get() { const targetModel = Model.models[capitalize(toSingular(options.target))]; return targetModel.where({ [foreignKey]: this.id }); }, configurable: true, }); } else { throw new...
[Directory structure > Addendum: Code summary] ``` # [continued: part 1] Object.defineProperty(model.prototype, propertyName, { get() { const targetModel = Model.models[capitalize(toSingular(options.target))]; return targetModel.where({ [foreignKey]: this.id }); }, configurable: true, }); } else { throw new...
ai_ref_knowledge
c97c0a04-bb35-4b9e-988e-4930eaf05333
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
24
SemanticChunker@1.0.0
7a88066b166d0c123cba135ddb428ef0acb5f98115fa441fa48b693b2dd8ec4d
[Directory structure > Addendum: Code summary] ``` # [continued: part 2] // Create a map to speed up queries if (!Model.indexedInstances[name]) { Model.indexedInstances[name] = model.indexes.reduce((acc, index) => { acc[index] = new Map(); return acc; }, {}); } Object.entries(Object.getOwnPropertyDescriptors...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` # [continued: part 2] // Create a map to speed up queries if (!Model.indexedInstances[name]) { Model.indexedInstances[name] = model.indexes.reduce((acc, index) => { acc[index] = new Map(); return acc; }, {}); } Object.entries(Object.getOwnPropertyDescriptors...
[Directory structure > Addendum: Code summary] ``` # [continued: part 2] // Create a map to speed up queries if (!Model.indexedInstances[name]) { Model.indexedInstances[name] = model.indexes.reduce((acc, index) => { acc[index] = new Map(); return acc; }, {}); } Object.entries(Object.getOwnPropertyDescriptors...
ai_ref_knowledge
ccfa027a-d832-4543-afa8-5ce814446bba
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
19
SemanticChunker@1.0.0
983ac2ca9b08ed3fc1649d507f14584c15f7b2430df82aa5f3b9d869daf9cb76
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
unknown
unknown
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
ai_ref_knowledge
e0b03648-627e-4899-94c8-1c096b5d0341
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
17
SemanticChunker@1.0.0
5ae005d32bc967575fe32990dfca89d6b79b3d4016d0afe0ce7531003afc90eb
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
unknown
unknown
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
ai_ref_knowledge
faa3d530-8d22-4b81-80d8-51ed7e9f7f7a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
29
SemanticChunker@1.0.0
39425d7aded530d6c7571f98ce6c8bc50c28a8e2f76074240398d79693ff7a4e
[Directory structure > Addendum: Code summary] ``` ```js title="src/models/post.js" import Model from '#src/core/model.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, { fields: [ ['title', { type: 'string', allowEmpty: false }], ['content', 'str...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/models/post.js" import Model from '#src/core/model.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, { fields: [ ['title', { type: 'string', allowEmpty: false }], ['content', 'str...
[Directory structure > Addendum: Code summary] ``` ```js title="src/models/post.js" import Model from '#src/core/model.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, { fields: [ ['title', { type: 'string', allowEmpty: false }], ['content', 'str...
ai_ref_knowledge
fbd67053-ca15-409c-bb29-a49f0f1e863c
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
e01450bf-fef4-4d4e-92e6-04b82fe2fa27
31
SemanticChunker@1.0.0
9076f788e2fdcdc6cb55e614b0d1f813c8b7c950792fc420aaa2216aada473dc
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
ai_ref_knowledge
2c826418-1b8d-4803-8352-af8bdfa4f3fb
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/js/s/array-grouping.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
0
SemanticChunker@1.0.0
3e2d8b6e4cd56358b8d693f7722e4f3377f7de9732a3cb3ae1872dbdd5894e27
--- title: Group array elements test: true language: javascript tags: [array,object] cover: man-cup-laptop excerpt: Groups the elements of an array based on the given function. listed: true dateModified: 2020-10-22 --- Groups the elements of an array based on the given function. - Use `Array.prototype.map()` to map t...
unknown
unknown
--- title: Group array elements test: true language: javascript tags: [array,object] cover: man-cup-laptop excerpt: Groups the elements of an array based on the given function. listed: true dateModified: 2020-10-22 --- Groups the elements of an array based on the given function. - Use `Array.prototype.map()` to map t...
--- title: Group array elements test: true language: javascript tags: [array,object] cover: man-cup-laptop excerpt: Groups the elements of an array based on the given function. listed: true dateModified: 2020-10-22 --- Groups the elements of an array based on the given function. - Use `Array.prototype.map()` to map t...
code_snippets
d748e83c-7301-42df-8657-9f22ddf95c7a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/js/s/array-initialize.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
1
SemanticChunker@1.0.0
b83bdabe4cfb9e61888b24f5fa44fdd1f472e3e22453f1fe3bcab3fb68293337
[Array() constructor] ## Array() constructor The first thing you'd reach for would probably be the `Array()` constructor. ```js const arr = Array(3); // [ , , ] - 3 empty slots arr.map(() => 1); // [ , , ] - map() skips empty slots arr.map((_, i) => i); // [ , , ] - map() skips empty slots arr[0]; // undefined - act...
unknown
unknown
[Array() constructor] ## Array() constructor The first thing you'd reach for would probably be the `Array()` constructor. ```js const arr = Array(3); // [ , , ] - 3 empty slots arr.map(() => 1); // [ , , ] - map() skips empty slots arr.map((_, i) => i); // [ , , ] - map() skips empty slots arr[0]; // undefined - act...
[Array() constructor] ## Array() constructor The first thing you'd reach for would probably be the `Array()` constructor. ```js const arr = Array(3); // [ , , ] - 3 empty slots arr.map(() => 1); // [ , , ] - map() skips empty slots arr.map((_, i) => i); // [ , , ] - map() skips empty slots arr[0]; // undefined - act...
code_snippets
093872fe-1484-4eb0-b779-e4e5995cc071
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/js/s/array-initialize.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
2
SemanticChunker@1.0.0
b72e6fac76bf000ed55d8c447a5d455c33b6fc6364c16e1356f4218549e64a2a
[Array() constructor > Array.from()] ## Array.from() `Array.from()` is a static method that creates a new, shallow-copied Array instance from an **array-like or iterable object**. ```js const arr = Array.from({ length: 3 }); // [undefined, undefined, undefined] arr.map(() => 1); // [1, 1, 1] arr.map((_, i) => i); //...
unknown
unknown
[Array() constructor > Array.from()] ## Array.from() `Array.from()` is a static method that creates a new, shallow-copied Array instance from an **array-like or iterable object**. ```js const arr = Array.from({ length: 3 }); // [undefined, undefined, undefined] arr.map(() => 1); // [1, 1, 1] arr.map((_, i) => i); //...
[Array() constructor > Array.from()] ## Array.from() `Array.from()` is a static method that creates a new, shallow-copied Array instance from an **array-like or iterable object**. ```js const arr = Array.from({ length: 3 }); // [undefined, undefined, undefined] arr.map(() => 1); // [1, 1, 1] arr.map((_, i) => i); //...
code_snippets
f961cabb-b95c-411a-ab67-c589293655f3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/js/s/array-initialize.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
3
SemanticChunker@1.0.0
40c919b683f8996d6f791d9bfcd53a055b2d72e72892c06c753fe0ef1c6be9d7
[Array() constructor > Array.prototype.fill()] ## Array.prototype.fill() While `Array.from()` is quite flexible, using a mapping function to fill it with the same value isn't particularly efficient, so use `Array.prototype.fill()`. ```js const nullArr = new Array(3).fill(null); // [null, null, null] const staticArr ...
unknown
unknown
[Array() constructor > Array.prototype.fill()] ## Array.prototype.fill() While `Array.from()` is quite flexible, using a mapping function to fill it with the same value isn't particularly efficient, so use `Array.prototype.fill()`. ```js const nullArr = new Array(3).fill(null); // [null, null, null] const staticArr ...
[Array() constructor > Array.prototype.fill()] ## Array.prototype.fill() While `Array.from()` is quite flexible, using a mapping function to fill it with the same value isn't particularly efficient, so use `Array.prototype.fill()`. ```js const nullArr = new Array(3).fill(null); // [null, null, null] const staticArr ...
code_snippets
0c4d7539-5204-4f34-bfff-5d89c3ef71f9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/window-global-environment-ssr-hooks.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
5
SemanticChunker@1.0.0
16bc213cacc4769e435e4b306ec956643ce3479bb9484274d399fed4018e7f99
[`useUnload` hook > `useOnWindowScroll` hook] ## `useOnWindowScroll` hook Similar to the `useOnWindowResize` hook, the `useOnWindowScroll` hook executes a callback whenever the **window is scrolled**. The implementation is virtually identical to the previous hook, except that it listens for the `'scroll'` event inst...
unknown
unknown
[`useUnload` hook > `useOnWindowScroll` hook] ## `useOnWindowScroll` hook Similar to the `useOnWindowResize` hook, the `useOnWindowScroll` hook executes a callback whenever the **window is scrolled**. The implementation is virtually identical to the previous hook, except that it listens for the `'scroll'` event inst...
[`useUnload` hook > `useOnWindowScroll` hook] ## `useOnWindowScroll` hook Similar to the `useOnWindowResize` hook, the `useOnWindowScroll` hook executes a callback whenever the **window is scrolled**. The implementation is virtually identical to the previous hook, except that it listens for the `'scroll'` event inst...
code_snippets
48ef8362-cd28-4a11-8d4c-a67de6ce4ebd
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/window-global-environment-ssr-hooks.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
8
SemanticChunker@1.0.0
d9423d9bd2ae0c057a0f5e1c055917568593f5e96673fea8546da9383e34188d
[`useUnload` hook > `useIsomorphicEffect` hook] ## `useIsomorphicEffect` hook A further use-case for handling window and environment events is the `useIsomorphicEffect` hook. This hook resolves to `useEffect()` on the server and `useLayoutEffect()` on the client. To implement this hook, use `typeof` to check if the ...
unknown
unknown
[`useUnload` hook > `useIsomorphicEffect` hook] ## `useIsomorphicEffect` hook A further use-case for handling window and environment events is the `useIsomorphicEffect` hook. This hook resolves to `useEffect()` on the server and `useLayoutEffect()` on the client. To implement this hook, use `typeof` to check if the ...
[`useUnload` hook > `useIsomorphicEffect` hook] ## `useIsomorphicEffect` hook A further use-case for handling window and environment events is the `useIsomorphicEffect` hook. This hook resolves to `useEffect()` on the server and `useLayoutEffect()` on the client. To implement this hook, use `typeof` to check if the ...
code_snippets
6476f8be-e9f7-495b-bb27-b6e944c5b5b4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
10
SemanticChunker@1.0.0
f6bc68dcf18d52929fb28ae8f1979b8fc875985c67a3fe56b8890a795f15d1da
[Rendering introduction > Context optimization] ## Context optimization By default, any update to a parent component that renders a context `Provider` will cause all of the child components to re-render regardless of changes in the context, due to React's rendering process. To avoid re-rendering child components when...
unknown
unknown
[Rendering introduction > Context optimization] ## Context optimization By default, any update to a parent component that renders a context `Provider` will cause all of the child components to re-render regardless of changes in the context, due to React's rendering process. To avoid re-rendering child components when...
[Rendering introduction > Context optimization] ## Context optimization By default, any update to a parent component that renders a context `Provider` will cause all of the child components to re-render regardless of changes in the context, due to React's rendering process. To avoid re-rendering child components when...
code_snippets
86aae190-134b-451d-bfd8-fec6e528e0da
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/window-global-environment-ssr-hooks.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
6
SemanticChunker@1.0.0
9937d63354d406a3283495cf1c329c04464821c05138c3ee054a6ab63e16b2c9
[`useUnload` hook > `useMediaQuery` hook] ## `useMediaQuery` hook Speaking of responsive design, the `useMediaQuery` hook can be used to check if the current environment matches a given **media query** and return the appropriate value. In order to implement this hook, you'll need to check if `Window` and `Window.mat...
unknown
unknown
[`useUnload` hook > `useMediaQuery` hook] ## `useMediaQuery` hook Speaking of responsive design, the `useMediaQuery` hook can be used to check if the current environment matches a given **media query** and return the appropriate value. In order to implement this hook, you'll need to check if `Window` and `Window.mat...
[`useUnload` hook > `useMediaQuery` hook] ## `useMediaQuery` hook Speaking of responsive design, the `useMediaQuery` hook can be used to check if the current environment matches a given **media query** and return the appropriate value. In order to implement this hook, you'll need to check if `Window` and `Window.mat...
code_snippets
a236ac37-b9df-4016-a7c3-7d0b752dd3e8
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
9
SemanticChunker@1.0.0
630aa8776d154911360333cafb27757e57d1ef00e51cbc1c2c513a6757ac7b7a
[Rendering introduction > Context API] ## Context API React's **Context API** provides a way to pass data through the component tree without using `props`, but should not be used for state management as it requires manual updating. Any component inside a context's `Provider` can access the data in the context instanc...
unknown
unknown
[Rendering introduction > Context API] ## Context API React's **Context API** provides a way to pass data through the component tree without using `props`, but should not be used for state management as it requires manual updating. Any component inside a context's `Provider` can access the data in the context instanc...
[Rendering introduction > Context API] ## Context API React's **Context API** provides a way to pass data through the component tree without using `props`, but should not be used for state management as it requires manual updating. Any component inside a context's `Provider` can access the data in the context instanc...
code_snippets
c5d24afd-cd23-4411-87c7-25b60ea6c821
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/window-global-environment-ssr-hooks.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
7
SemanticChunker@1.0.0
18fae72ebf5b3c62fc44da5ef114cad5219dbc03b4a4235d332a94f964eedbcb
[`useUnload` hook > `useSSR` hook] ## `useSSR` hook As we've already touched upon the subject of **server-side rendering** (SSR), it's worth mentioning the `useSSR` hook. This hook can be used to check if the code is running on the browser or the server. To implement this hook, you'll need to check if `Window`, `Win...
unknown
unknown
[`useUnload` hook > `useSSR` hook] ## `useSSR` hook As we've already touched upon the subject of **server-side rendering** (SSR), it's worth mentioning the `useSSR` hook. This hook can be used to check if the code is running on the browser or the server. To implement this hook, you'll need to check if `Window`, `Win...
[`useUnload` hook > `useSSR` hook] ## `useSSR` hook As we've already touched upon the subject of **server-side rendering** (SSR), it's worth mentioning the `useSSR` hook. This hook can be used to check if the code is running on the browser or the server. To implement this hook, you'll need to check if `Window`, `Win...
code_snippets
ee73f794-f959-4f9e-a873-0b79038d0fdb
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/css/s/content-centering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
4
SemanticChunker@1.0.0
9b463c29c37468421d4ac5f42d40ba6a18e5426d9bef4415be37e673d96c09c6
[Flexbox centering > Table centering] ## Table centering Last but not least, **table** centering is an older technique which you might favor when working with **older browsers**. ```html <div class="table-centering"> <div class="content">Content</div> </div> ``` ```css .table-centering { display: table; height: ...
unknown
unknown
[Flexbox centering > Table centering] ## Table centering Last but not least, **table** centering is an older technique which you might favor when working with **older browsers**. ```html <div class="table-centering"> <div class="content">Content</div> </div> ``` ```css .table-centering { display: table; height: ...
[Flexbox centering > Table centering] ## Table centering Last but not least, **table** centering is an older technique which you might favor when working with **older browsers**. ```html <div class="table-centering"> <div class="content">Content</div> </div> ``` ```css .table-centering { display: table; height: ...
code_snippets
20918dd3-bb87-4e7d-8c12-97cbf1b08c4d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
12
SemanticChunker@1.0.0
29fe018bcb08dd9c59d4d5800f5f642759fb571dd4d2b4586b6cb60fb8e8fdd7
[Rendering introduction > React-Redux optimization] ## React-Redux optimization React-Redux provides two ways of connecting to its store, performing the necessary work and returning the combined `props`: - `connect` (any component): Higher-order component (HOC) that wraps any given component - `useSelector` (functio...
unknown
unknown
[Rendering introduction > React-Redux optimization] ## React-Redux optimization React-Redux provides two ways of connecting to its store, performing the necessary work and returning the combined `props`: - `connect` (any component): Higher-order component (HOC) that wraps any given component - `useSelector` (functio...
[Rendering introduction > React-Redux optimization] ## React-Redux optimization React-Redux provides two ways of connecting to its store, performing the necessary work and returning the combined `props`: - `connect` (any component): Higher-order component (HOC) that wraps any given component - `useSelector` (functio...
code_snippets
4e5ebfc1-49ad-419d-b9e7-c4b2025eb367
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
13
SemanticChunker@1.0.0
d2532103e4aec1bebc4c3cdd3cb271446734a4fcd145a04f45b3634b4e23c2d9
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
unknown
unknown
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
code_snippets
ab4703e2-2b80-4823-b096-476e71ed3693
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
11
SemanticChunker@1.0.0
f3b3e5ff4db43ddd5d2879f5996c927f8df4e321497c2cbc43256af3cf4f0636
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
unknown
unknown
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
code_snippets
f01f90c3-66f2-4c0c-b88a-54e9c908ecc6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
14
SemanticChunker@1.0.0
8d21162d2170f47351e715bc3e0f93c8ea216f56d081aa2e42463683191cf8ca
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
unknown
unknown
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
code_snippets
1d744f70-14c7-48bc-a491-9913fda021a2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
26
SemanticChunker@1.0.0
1c21cd7e2f30e6f18990d3143ddb19963e0def019a130889c2bb12469dbd343f
[Directory structure > Addendum: Code summary] if (!attributeName) return; const alias = isAlias ? attribute[1] : null; serializer.serializableAttributes.push(attributeName); Object.defineProperty(serializer.prototype, attributeName, { get() { if (!isAlias) return this.subject[attributeName]; if (typeof alias...
unknown
unknown
[Directory structure > Addendum: Code summary] if (!attributeName) return; const alias = isAlias ? attribute[1] : null; serializer.serializableAttributes.push(attributeName); Object.defineProperty(serializer.prototype, attributeName, { get() { if (!isAlias) return this.subject[attributeName]; if (typeof alias...
[Directory structure > Addendum: Code summary] if (!attributeName) return; const alias = isAlias ? attribute[1] : null; serializer.serializableAttributes.push(attributeName); Object.defineProperty(serializer.prototype, attributeName, { get() { if (!isAlias) return this.subject[attributeName]; if (typeof alias...
code_snippets
2914c1e1-dd78-4c9b-aad5-18199a09b05a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
24
SemanticChunker@1.0.0
bb36ec6317c30602c241f36e41ce6e15a2fd7702614efb19c6f7193633f537dc
[Directory structure > Addendum: Code summary] Object.entries(Object.getOwnPropertyDescriptors(model.prototype)).forEach( ([key, descriptor]) => { // Find getter functions, create the WeakMap, redefine the getter if (typeof descriptor.get === 'function') { Model.getterCache[name][key] = new WeakMap(); Object.defi...
unknown
unknown
[Directory structure > Addendum: Code summary] Object.entries(Object.getOwnPropertyDescriptors(model.prototype)).forEach( ([key, descriptor]) => { // Find getter functions, create the WeakMap, redefine the getter if (typeof descriptor.get === 'function') { Model.getterCache[name][key] = new WeakMap(); Object.defi...
[Directory structure > Addendum: Code summary] Object.entries(Object.getOwnPropertyDescriptors(model.prototype)).forEach( ([key, descriptor]) => { // Find getter functions, create the WeakMap, redefine the getter if (typeof descriptor.get === 'function') { Model.getterCache[name][key] = new WeakMap(); Object.defi...
code_snippets
2ffa1f73-5bfc-4965-a4d2-843a2d618c84
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
28
SemanticChunker@1.0.0
8829c4214f7867b24b2b72c33891fd416c3ba6d23a4b56b35505441342bee03f
[Directory structure > Addendum: Code summary] ```js title="src/models/post.js" import Model from '#src/core/model.js'; import Author from '#src/models/author.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, [ ['title', { type: 'string', allowEmpty:...
unknown
unknown
[Directory structure > Addendum: Code summary] ```js title="src/models/post.js" import Model from '#src/core/model.js'; import Author from '#src/models/author.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, [ ['title', { type: 'string', allowEmpty:...
[Directory structure > Addendum: Code summary] ```js title="src/models/post.js" import Model from '#src/core/model.js'; import Author from '#src/models/author.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, [ ['title', { type: 'string', allowEmpty:...
code_snippets
397e8380-c25e-4690-bfb0-889c0ffd64b1
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
16
SemanticChunker@1.0.0
e4d4faefcf3c77ca1b8918893cd2298077ee60c9031d6c4d48c08211f4f6c0b6
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
unknown
unknown
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
code_snippets
3de79c9e-3782-4961-b33c-bc209f849c80
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
21
SemanticChunker@1.0.0
ce31e95f876eb4ba3ffcc9c8f477115012525668465244b5ec4bfef2c6a867b4
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
unknown
unknown
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
code_snippets
4246ba56-cb96-4056-ae4e-9be617752c88
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
15
SemanticChunker@1.0.0
229619eff2676e6680e4a0ce9404c2a8741493ae074df52abcbf18b3769d9ddb
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
unknown
unknown
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
code_snippets
4e90792c-3259-445e-833b-3c073143a570
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
30
SemanticChunker@1.0.0
7e8470dcfb611b3e29a41b7c3117929e982db7a5a7c25d6d29ff254a36800922
[Directory structure > Addendum: Code summary] ``` ```js title="spec/factories/postFactory.js" import Factory from '#src/core/factory.js'; import Post from '#src/models/post.js'; const idSequence = Factory.sequence(); const titleSequence = Factory.sequence(n => `Post #${n}`); const base = { id: idSequence, title:...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="spec/factories/postFactory.js" import Factory from '#src/core/factory.js'; import Post from '#src/models/post.js'; const idSequence = Factory.sequence(); const titleSequence = Factory.sequence(n => `Post #${n}`); const base = { id: idSequence, title:...
[Directory structure > Addendum: Code summary] ``` ```js title="spec/factories/postFactory.js" import Factory from '#src/core/factory.js'; import Post from '#src/models/post.js'; const idSequence = Factory.sequence(); const titleSequence = Factory.sequence(n => `Post #${n}`); const base = { id: idSequence, title:...
code_snippets
65fade29-5db9-46b4-879c-edbb604cb6b4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/articles/s/how-30-seconds-of-code-is-deployed.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
32
SemanticChunker@1.0.0
b8a230b61f0130f5cf7a077203d893b28cd924ea6f7344139e9a93193a8c4f42
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
unknown
unknown
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
code_snippets
6ee46c16-abea-4022-abfd-4a2146c882b0
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
19
SemanticChunker@1.0.0
983ac2ca9b08ed3fc1649d507f14584c15f7b2430df82aa5f3b9d869daf9cb76
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
unknown
unknown
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
code_snippets
875651f1-b385-4736-bedf-7f7797c7b51b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
25
SemanticChunker@1.0.0
39bd969b1a94979de3af8ad75703c9fc10123e562947457350d433b4b753f98e
[Directory structure > Addendum: Code summary] static scope(...scopes) { return scopes.reduce((acc, scope) => this[scope](acc), this.all); } static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.lengt...
unknown
unknown
[Directory structure > Addendum: Code summary] static scope(...scopes) { return scopes.reduce((acc, scope) => this[scope](acc), this.all); } static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.lengt...
[Directory structure > Addendum: Code summary] static scope(...scopes) { return scopes.reduce((acc, scope) => this[scope](acc), this.all); } static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.lengt...
code_snippets
8b368a32-610e-4ed4-a6f6-58ca5d6ebe45
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
27
SemanticChunker@1.0.0
e5210dc461a683043bd6bca005f753a339098435d0693b014b6bc15f3b922f3d
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/factory.js" import Model from '#src/core/model.js'; const sequenceSymbol = Symbol('sequence'); const isSequence = value => value && typeof value[sequenceSymbol] === 'function'; export default class Factory { static factoryMap = new Map(); ...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/factory.js" import Model from '#src/core/model.js'; const sequenceSymbol = Symbol('sequence'); const isSequence = value => value && typeof value[sequenceSymbol] === 'function'; export default class Factory { static factoryMap = new Map(); ...
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/factory.js" import Model from '#src/core/model.js'; const sequenceSymbol = Symbol('sequence'); const isSequence = value => value && typeof value[sequenceSymbol] === 'function'; export default class Factory { static factoryMap = new Map(); ...
code_snippets
95f34989-a869-4cf4-b62d-674abf748dc6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
23
SemanticChunker@1.0.0
a7b73a8b9f0d1471afcf1bd7d2b3974ccbfeef60e56a9f646d3eea95a9c2a946
[Directory structure > Addendum: Code summary] if (isAlias) { if (typeof field[1] === 'string') fieldOptions.type = field[1]; else if (typeof field[1] === 'object') fieldOptions = { ...fieldOptions, ...field[1] }; else throw new Error( `Invalid field definition for ${fieldName} in ${name}` ); } const { type:...
unknown
unknown
[Directory structure > Addendum: Code summary] if (isAlias) { if (typeof field[1] === 'string') fieldOptions.type = field[1]; else if (typeof field[1] === 'object') fieldOptions = { ...fieldOptions, ...field[1] }; else throw new Error( `Invalid field definition for ${fieldName} in ${name}` ); } const { type:...
[Directory structure > Addendum: Code summary] if (isAlias) { if (typeof field[1] === 'string') fieldOptions.type = field[1]; else if (typeof field[1] === 'object') fieldOptions = { ...fieldOptions, ...field[1] }; else throw new Error( `Invalid field definition for ${fieldName} in ${name}` ); } const { type:...
code_snippets
9850fcd7-0424-45cb-bf79-b6aaaf08b48a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
29
SemanticChunker@1.0.0
ae56b3488f1c6854015addacb4df5fea7240026a07fc6ca68d1e801724a90181
[Directory structure > Addendum: Code summary] export default class PostSerializer extends Serializer { static { super.prepare(this, [ 'title', ['content', post => `<p>${post.content}</p>`], ['date', post => { const date = new Date(post.publishedAt); return date.toLocaleDateString('en-US', { weekday: 'short', ...
unknown
unknown
[Directory structure > Addendum: Code summary] export default class PostSerializer extends Serializer { static { super.prepare(this, [ 'title', ['content', post => `<p>${post.content}</p>`], ['date', post => { const date = new Date(post.publishedAt); return date.toLocaleDateString('en-US', { weekday: 'short', ...
[Directory structure > Addendum: Code summary] export default class PostSerializer extends Serializer { static { super.prepare(this, [ 'title', ['content', post => `<p>${post.content}</p>`], ['date', post => { const date = new Date(post.publishedAt); return date.toLocaleDateString('en-US', { weekday: 'short', ...
code_snippets
cd962b07-d946-4bd6-b404-7dd080ce2750
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
17
SemanticChunker@1.0.0
5ae005d32bc967575fe32990dfca89d6b79b3d4016d0afe0ce7531003afc90eb
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
unknown
unknown
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
code_snippets
d49e5c2c-f15d-4892-b0dc-598942ad4081
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
22
SemanticChunker@1.0.0
b8604aba90ac6debfca76a26e8c9598d2dc03a33270bfe29c2b0b6e3a9269f11
[Directory structure > Addendum: Code summary] ## Addendum: Code summary The complete implementation is summarized below, as is traditional by now. This includes all the changes we've made to the `Model` class, as well as the changes to the `Author` and `Post` models, and all previous implementations. You can also [...
unknown
unknown
[Directory structure > Addendum: Code summary] ## Addendum: Code summary The complete implementation is summarized below, as is traditional by now. This includes all the changes we've made to the `Model` class, as well as the changes to the `Author` and `Post` models, and all previous implementations. You can also [...
[Directory structure > Addendum: Code summary] ## Addendum: Code summary The complete implementation is summarized below, as is traditional by now. This includes all the changes we've made to the `Model` class, as well as the changes to the `Author` and `Post` models, and all previous implementations. You can also [...
code_snippets
e066e467-8db4-4e83-bb13-3a76aa72f86d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
18
SemanticChunker@1.0.0
1c7943fbe945c8422e4f6ac363d1b6f37113df3dba962e9f57c56594c7f14ca9
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
unknown
unknown
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
code_snippets
e0f18e04-cec1-4be6-8004-6db6c6223fb5
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
31
SemanticChunker@1.0.0
9076f788e2fdcdc6cb55e614b0d1f813c8b7c950792fc420aaa2216aada473dc
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
code_snippets
f67cf09e-4f4a-4f21-bd35-5fa0f7866339
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
20
SemanticChunker@1.0.0
d87de34cf60f4bde69255451cb41c5a83c0cc2fb4304ff853c9faa52ed433cd5
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
unknown
unknown
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
code_snippets
2c826418-1b8d-4803-8352-af8bdfa4f3fb
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/js/s/array-grouping.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
0
SemanticChunker@1.0.0
3e2d8b6e4cd56358b8d693f7722e4f3377f7de9732a3cb3ae1872dbdd5894e27
--- title: Group array elements test: true language: javascript tags: [array,object] cover: man-cup-laptop excerpt: Groups the elements of an array based on the given function. listed: true dateModified: 2020-10-22 --- Groups the elements of an array based on the given function. - Use `Array.prototype.map()` to map t...
unknown
unknown
--- title: Group array elements test: true language: javascript tags: [array,object] cover: man-cup-laptop excerpt: Groups the elements of an array based on the given function. listed: true dateModified: 2020-10-22 --- Groups the elements of an array based on the given function. - Use `Array.prototype.map()` to map t...
--- title: Group array elements test: true language: javascript tags: [array,object] cover: man-cup-laptop excerpt: Groups the elements of an array based on the given function. listed: true dateModified: 2020-10-22 --- Groups the elements of an array based on the given function. - Use `Array.prototype.map()` to map t...
code_snippets
d748e83c-7301-42df-8657-9f22ddf95c7a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/js/s/array-initialize.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
1
SemanticChunker@1.0.0
b83bdabe4cfb9e61888b24f5fa44fdd1f472e3e22453f1fe3bcab3fb68293337
[Array() constructor] ## Array() constructor The first thing you'd reach for would probably be the `Array()` constructor. ```js const arr = Array(3); // [ , , ] - 3 empty slots arr.map(() => 1); // [ , , ] - map() skips empty slots arr.map((_, i) => i); // [ , , ] - map() skips empty slots arr[0]; // undefined - act...
unknown
unknown
[Array() constructor] ## Array() constructor The first thing you'd reach for would probably be the `Array()` constructor. ```js const arr = Array(3); // [ , , ] - 3 empty slots arr.map(() => 1); // [ , , ] - map() skips empty slots arr.map((_, i) => i); // [ , , ] - map() skips empty slots arr[0]; // undefined - act...
[Array() constructor] ## Array() constructor The first thing you'd reach for would probably be the `Array()` constructor. ```js const arr = Array(3); // [ , , ] - 3 empty slots arr.map(() => 1); // [ , , ] - map() skips empty slots arr.map((_, i) => i); // [ , , ] - map() skips empty slots arr[0]; // undefined - act...
code_snippets
093872fe-1484-4eb0-b779-e4e5995cc071
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/js/s/array-initialize.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
2
SemanticChunker@1.0.0
b72e6fac76bf000ed55d8c447a5d455c33b6fc6364c16e1356f4218549e64a2a
[Array() constructor > Array.from()] ## Array.from() `Array.from()` is a static method that creates a new, shallow-copied Array instance from an **array-like or iterable object**. ```js const arr = Array.from({ length: 3 }); // [undefined, undefined, undefined] arr.map(() => 1); // [1, 1, 1] arr.map((_, i) => i); //...
unknown
unknown
[Array() constructor > Array.from()] ## Array.from() `Array.from()` is a static method that creates a new, shallow-copied Array instance from an **array-like or iterable object**. ```js const arr = Array.from({ length: 3 }); // [undefined, undefined, undefined] arr.map(() => 1); // [1, 1, 1] arr.map((_, i) => i); //...
[Array() constructor > Array.from()] ## Array.from() `Array.from()` is a static method that creates a new, shallow-copied Array instance from an **array-like or iterable object**. ```js const arr = Array.from({ length: 3 }); // [undefined, undefined, undefined] arr.map(() => 1); // [1, 1, 1] arr.map((_, i) => i); //...
code_snippets
f961cabb-b95c-411a-ab67-c589293655f3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/js/s/array-initialize.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
3
SemanticChunker@1.0.0
40c919b683f8996d6f791d9bfcd53a055b2d72e72892c06c753fe0ef1c6be9d7
[Array() constructor > Array.prototype.fill()] ## Array.prototype.fill() While `Array.from()` is quite flexible, using a mapping function to fill it with the same value isn't particularly efficient, so use `Array.prototype.fill()`. ```js const nullArr = new Array(3).fill(null); // [null, null, null] const staticArr ...
unknown
unknown
[Array() constructor > Array.prototype.fill()] ## Array.prototype.fill() While `Array.from()` is quite flexible, using a mapping function to fill it with the same value isn't particularly efficient, so use `Array.prototype.fill()`. ```js const nullArr = new Array(3).fill(null); // [null, null, null] const staticArr ...
[Array() constructor > Array.prototype.fill()] ## Array.prototype.fill() While `Array.from()` is quite flexible, using a mapping function to fill it with the same value isn't particularly efficient, so use `Array.prototype.fill()`. ```js const nullArr = new Array(3).fill(null); // [null, null, null] const staticArr ...
code_snippets
0c4d7539-5204-4f34-bfff-5d89c3ef71f9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/window-global-environment-ssr-hooks.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
5
SemanticChunker@1.0.0
16bc213cacc4769e435e4b306ec956643ce3479bb9484274d399fed4018e7f99
[`useUnload` hook > `useOnWindowScroll` hook] ## `useOnWindowScroll` hook Similar to the `useOnWindowResize` hook, the `useOnWindowScroll` hook executes a callback whenever the **window is scrolled**. The implementation is virtually identical to the previous hook, except that it listens for the `'scroll'` event inst...
unknown
unknown
[`useUnload` hook > `useOnWindowScroll` hook] ## `useOnWindowScroll` hook Similar to the `useOnWindowResize` hook, the `useOnWindowScroll` hook executes a callback whenever the **window is scrolled**. The implementation is virtually identical to the previous hook, except that it listens for the `'scroll'` event inst...
[`useUnload` hook > `useOnWindowScroll` hook] ## `useOnWindowScroll` hook Similar to the `useOnWindowResize` hook, the `useOnWindowScroll` hook executes a callback whenever the **window is scrolled**. The implementation is virtually identical to the previous hook, except that it listens for the `'scroll'` event inst...
code_snippets
48ef8362-cd28-4a11-8d4c-a67de6ce4ebd
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/window-global-environment-ssr-hooks.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
8
SemanticChunker@1.0.0
d9423d9bd2ae0c057a0f5e1c055917568593f5e96673fea8546da9383e34188d
[`useUnload` hook > `useIsomorphicEffect` hook] ## `useIsomorphicEffect` hook A further use-case for handling window and environment events is the `useIsomorphicEffect` hook. This hook resolves to `useEffect()` on the server and `useLayoutEffect()` on the client. To implement this hook, use `typeof` to check if the ...
unknown
unknown
[`useUnload` hook > `useIsomorphicEffect` hook] ## `useIsomorphicEffect` hook A further use-case for handling window and environment events is the `useIsomorphicEffect` hook. This hook resolves to `useEffect()` on the server and `useLayoutEffect()` on the client. To implement this hook, use `typeof` to check if the ...
[`useUnload` hook > `useIsomorphicEffect` hook] ## `useIsomorphicEffect` hook A further use-case for handling window and environment events is the `useIsomorphicEffect` hook. This hook resolves to `useEffect()` on the server and `useLayoutEffect()` on the client. To implement this hook, use `typeof` to check if the ...
code_snippets
6476f8be-e9f7-495b-bb27-b6e944c5b5b4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
10
SemanticChunker@1.0.0
f6bc68dcf18d52929fb28ae8f1979b8fc875985c67a3fe56b8890a795f15d1da
[Rendering introduction > Context optimization] ## Context optimization By default, any update to a parent component that renders a context `Provider` will cause all of the child components to re-render regardless of changes in the context, due to React's rendering process. To avoid re-rendering child components when...
unknown
unknown
[Rendering introduction > Context optimization] ## Context optimization By default, any update to a parent component that renders a context `Provider` will cause all of the child components to re-render regardless of changes in the context, due to React's rendering process. To avoid re-rendering child components when...
[Rendering introduction > Context optimization] ## Context optimization By default, any update to a parent component that renders a context `Provider` will cause all of the child components to re-render regardless of changes in the context, due to React's rendering process. To avoid re-rendering child components when...
code_snippets
86aae190-134b-451d-bfd8-fec6e528e0da
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/window-global-environment-ssr-hooks.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
6
SemanticChunker@1.0.0
9937d63354d406a3283495cf1c329c04464821c05138c3ee054a6ab63e16b2c9
[`useUnload` hook > `useMediaQuery` hook] ## `useMediaQuery` hook Speaking of responsive design, the `useMediaQuery` hook can be used to check if the current environment matches a given **media query** and return the appropriate value. In order to implement this hook, you'll need to check if `Window` and `Window.mat...
unknown
unknown
[`useUnload` hook > `useMediaQuery` hook] ## `useMediaQuery` hook Speaking of responsive design, the `useMediaQuery` hook can be used to check if the current environment matches a given **media query** and return the appropriate value. In order to implement this hook, you'll need to check if `Window` and `Window.mat...
[`useUnload` hook > `useMediaQuery` hook] ## `useMediaQuery` hook Speaking of responsive design, the `useMediaQuery` hook can be used to check if the current environment matches a given **media query** and return the appropriate value. In order to implement this hook, you'll need to check if `Window` and `Window.mat...
code_snippets
a236ac37-b9df-4016-a7c3-7d0b752dd3e8
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
9
SemanticChunker@1.0.0
630aa8776d154911360333cafb27757e57d1ef00e51cbc1c2c513a6757ac7b7a
[Rendering introduction > Context API] ## Context API React's **Context API** provides a way to pass data through the component tree without using `props`, but should not be used for state management as it requires manual updating. Any component inside a context's `Provider` can access the data in the context instanc...
unknown
unknown
[Rendering introduction > Context API] ## Context API React's **Context API** provides a way to pass data through the component tree without using `props`, but should not be used for state management as it requires manual updating. Any component inside a context's `Provider` can access the data in the context instanc...
[Rendering introduction > Context API] ## Context API React's **Context API** provides a way to pass data through the component tree without using `props`, but should not be used for state management as it requires manual updating. Any component inside a context's `Provider` can access the data in the context instanc...
code_snippets
c5d24afd-cd23-4411-87c7-25b60ea6c821
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/window-global-environment-ssr-hooks.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
7
SemanticChunker@1.0.0
18fae72ebf5b3c62fc44da5ef114cad5219dbc03b4a4235d332a94f964eedbcb
[`useUnload` hook > `useSSR` hook] ## `useSSR` hook As we've already touched upon the subject of **server-side rendering** (SSR), it's worth mentioning the `useSSR` hook. This hook can be used to check if the code is running on the browser or the server. To implement this hook, you'll need to check if `Window`, `Win...
unknown
unknown
[`useUnload` hook > `useSSR` hook] ## `useSSR` hook As we've already touched upon the subject of **server-side rendering** (SSR), it's worth mentioning the `useSSR` hook. This hook can be used to check if the code is running on the browser or the server. To implement this hook, you'll need to check if `Window`, `Win...
[`useUnload` hook > `useSSR` hook] ## `useSSR` hook As we've already touched upon the subject of **server-side rendering** (SSR), it's worth mentioning the `useSSR` hook. This hook can be used to check if the code is running on the browser or the server. To implement this hook, you'll need to check if `Window`, `Win...
code_snippets
ee73f794-f959-4f9e-a873-0b79038d0fdb
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/spec/fixtures/content/snippets/css/s/content-centering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
4
SemanticChunker@1.0.0
9b463c29c37468421d4ac5f42d40ba6a18e5426d9bef4415be37e673d96c09c6
[Flexbox centering > Table centering] ## Table centering Last but not least, **table** centering is an older technique which you might favor when working with **older browsers**. ```html <div class="table-centering"> <div class="content">Content</div> </div> ``` ```css .table-centering { display: table; height: ...
unknown
unknown
[Flexbox centering > Table centering] ## Table centering Last but not least, **table** centering is an older technique which you might favor when working with **older browsers**. ```html <div class="table-centering"> <div class="content">Content</div> </div> ``` ```css .table-centering { display: table; height: ...
[Flexbox centering > Table centering] ## Table centering Last but not least, **table** centering is an older technique which you might favor when working with **older browsers**. ```html <div class="table-centering"> <div class="content">Content</div> </div> ``` ```css .table-centering { display: table; height: ...
code_snippets
20918dd3-bb87-4e7d-8c12-97cbf1b08c4d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
12
SemanticChunker@1.0.0
29fe018bcb08dd9c59d4d5800f5f642759fb571dd4d2b4586b6cb60fb8e8fdd7
[Rendering introduction > React-Redux optimization] ## React-Redux optimization React-Redux provides two ways of connecting to its store, performing the necessary work and returning the combined `props`: - `connect` (any component): Higher-order component (HOC) that wraps any given component - `useSelector` (functio...
unknown
unknown
[Rendering introduction > React-Redux optimization] ## React-Redux optimization React-Redux provides two ways of connecting to its store, performing the necessary work and returning the combined `props`: - `connect` (any component): Higher-order component (HOC) that wraps any given component - `useSelector` (functio...
[Rendering introduction > React-Redux optimization] ## React-Redux optimization React-Redux provides two ways of connecting to its store, performing the necessary work and returning the combined `props`: - `connect` (any component): Higher-order component (HOC) that wraps any given component - `useSelector` (functio...
code_snippets
4e5ebfc1-49ad-419d-b9e7-c4b2025eb367
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
13
SemanticChunker@1.0.0
d2532103e4aec1bebc4c3cdd3cb271446734a4fcd145a04f45b3634b4e23c2d9
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
unknown
unknown
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
[Edge cases > Backreferences] #### Backreferences The first case I want to discuss are backreferences. They are a special kind of pattern that refers to a previously captured group. The difference with other patterns is that they are not patterns, but rather a reference to a pattern, either via name or index. @[Quic...
code_snippets
ab4703e2-2b80-4823-b096-476e71ed3693
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/react/s/rendering.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
11
SemanticChunker@1.0.0
f3b3e5ff4db43ddd5d2879f5996c927f8df4e321497c2cbc43256af3cf4f0636
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
unknown
unknown
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
[Rendering introduction > React-Redux] ## React-Redux React-Redux provides bindings for **Redux**, a state container for JavaScript applications, and works a little differently from React's Context API. One of the key differences is that React-Redux only re-renders components that need to render, due to the fact that...
code_snippets
f01f90c3-66f2-4c0c-b88a-54e9c908ecc6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
14
SemanticChunker@1.0.0
8d21162d2170f47351e715bc3e0f93c8ea216f56d081aa2e42463683191cf8ca
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
unknown
unknown
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
[Edge cases > Quantifiers] #### Quantifiers The `repeat` quantifier is the most common one in these examples and for good reason. It's a very common pattern that's also quite versatile. However, designing it in a way that makes sense is a bit tricky. We need to support three resulting syntaxes: 1. Exact match (exact...
code_snippets
1d744f70-14c7-48bc-a491-9913fda021a2
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
26
SemanticChunker@1.0.0
1c21cd7e2f30e6f18990d3143ddb19963e0def019a130889c2bb12469dbd343f
[Directory structure > Addendum: Code summary] if (!attributeName) return; const alias = isAlias ? attribute[1] : null; serializer.serializableAttributes.push(attributeName); Object.defineProperty(serializer.prototype, attributeName, { get() { if (!isAlias) return this.subject[attributeName]; if (typeof alias...
unknown
unknown
[Directory structure > Addendum: Code summary] if (!attributeName) return; const alias = isAlias ? attribute[1] : null; serializer.serializableAttributes.push(attributeName); Object.defineProperty(serializer.prototype, attributeName, { get() { if (!isAlias) return this.subject[attributeName]; if (typeof alias...
[Directory structure > Addendum: Code summary] if (!attributeName) return; const alias = isAlias ? attribute[1] : null; serializer.serializableAttributes.push(attributeName); Object.defineProperty(serializer.prototype, attributeName, { get() { if (!isAlias) return this.subject[attributeName]; if (typeof alias...
code_snippets
2914c1e1-dd78-4c9b-aad5-18199a09b05a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
24
SemanticChunker@1.0.0
bb36ec6317c30602c241f36e41ce6e15a2fd7702614efb19c6f7193633f537dc
[Directory structure > Addendum: Code summary] Object.entries(Object.getOwnPropertyDescriptors(model.prototype)).forEach( ([key, descriptor]) => { // Find getter functions, create the WeakMap, redefine the getter if (typeof descriptor.get === 'function') { Model.getterCache[name][key] = new WeakMap(); Object.defi...
unknown
unknown
[Directory structure > Addendum: Code summary] Object.entries(Object.getOwnPropertyDescriptors(model.prototype)).forEach( ([key, descriptor]) => { // Find getter functions, create the WeakMap, redefine the getter if (typeof descriptor.get === 'function') { Model.getterCache[name][key] = new WeakMap(); Object.defi...
[Directory structure > Addendum: Code summary] Object.entries(Object.getOwnPropertyDescriptors(model.prototype)).forEach( ([key, descriptor]) => { // Find getter functions, create the WeakMap, redefine the getter if (typeof descriptor.get === 'function') { Model.getterCache[name][key] = new WeakMap(); Object.defi...
code_snippets
2ffa1f73-5bfc-4965-a4d2-843a2d618c84
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
28
SemanticChunker@1.0.0
8829c4214f7867b24b2b72c33891fd416c3ba6d23a4b56b35505441342bee03f
[Directory structure > Addendum: Code summary] ```js title="src/models/post.js" import Model from '#src/core/model.js'; import Author from '#src/models/author.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, [ ['title', { type: 'string', allowEmpty:...
unknown
unknown
[Directory structure > Addendum: Code summary] ```js title="src/models/post.js" import Model from '#src/core/model.js'; import Author from '#src/models/author.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, [ ['title', { type: 'string', allowEmpty:...
[Directory structure > Addendum: Code summary] ```js title="src/models/post.js" import Model from '#src/core/model.js'; import Author from '#src/models/author.js'; export default class Post extends Model { static { // Prepare storage for the Post model super.prepare(this, [ ['title', { type: 'string', allowEmpty:...
code_snippets
397e8380-c25e-4690-bfb0-889c0ffd64b1
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
16
SemanticChunker@1.0.0
e4d4faefcf3c77ca1b8918893cd2298077ee60c9031d6c4d48c08211f4f6c0b6
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
unknown
unknown
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
[Problem brief > Conclusion] ## Conclusion That was quite a long journey, but I believe careful, **user-centric API design** is crucial to the success of any library or tool. A well-designed API can make a library a joy to use, while a poorly designed one can make it a nightmare. After all, developer experience is no...
code_snippets
3de79c9e-3782-4961-b33c-bc209f849c80
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
21
SemanticChunker@1.0.0
ce31e95f876eb4ba3ffcc9c8f477115012525668465244b5ec4bfef2c6a867b4
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
unknown
unknown
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
[API design recap > Conclusion] ## Conclusion Phew! That was quite a long journey, but I think the library is now ready for use. Using TDD and a carefully designed API before starting out, the library took shape easily and quickly. The resulting bundle is small and the code is easy to read and understand. Next time, ...
code_snippets
4246ba56-cb96-4056-ae4e-9be617752c88
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/user-centric-api-design.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
15
SemanticChunker@1.0.0
229619eff2676e6680e4a0ce9404c2a8741493ae074df52abcbf18b3769d9ddb
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
unknown
unknown
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
[Edge cases > Character sets] #### Character sets Last but not last, character sets are a special case in and of themselves. A range has a start and an end, but what happens if we want to match any character in a set of characters that do not form a contiguous range? ```js // Good - simple range range('a', 'z'); // ...
code_snippets
4e90792c-3259-445e-833b-3c073143a570
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
30
SemanticChunker@1.0.0
7e8470dcfb611b3e29a41b7c3117929e982db7a5a7c25d6d29ff254a36800922
[Directory structure > Addendum: Code summary] ``` ```js title="spec/factories/postFactory.js" import Factory from '#src/core/factory.js'; import Post from '#src/models/post.js'; const idSequence = Factory.sequence(); const titleSequence = Factory.sequence(n => `Post #${n}`); const base = { id: idSequence, title:...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="spec/factories/postFactory.js" import Factory from '#src/core/factory.js'; import Post from '#src/models/post.js'; const idSequence = Factory.sequence(); const titleSequence = Factory.sequence(n => `Post #${n}`); const base = { id: idSequence, title:...
[Directory structure > Addendum: Code summary] ``` ```js title="spec/factories/postFactory.js" import Factory from '#src/core/factory.js'; import Post from '#src/models/post.js'; const idSequence = Factory.sequence(); const titleSequence = Factory.sequence(n => `Post #${n}`); const base = { id: idSequence, title:...
code_snippets
65fade29-5db9-46b4-879c-edbb604cb6b4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/articles/s/how-30-seconds-of-code-is-deployed.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
32
SemanticChunker@1.0.0
b8a230b61f0130f5cf7a077203d893b28cd924ea6f7344139e9a93193a8c4f42
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
unknown
unknown
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
I wanted code tabs to work in the most frictionless way possible. This meant that I had to use a `details` element to wrap them, which made me resort to some pretty clever and complicated hacks to make them work. A simplified implementation is documented [here](https://www.30secondsofcode.org/css/s/details-tabbed-conte...
code_snippets
6ee46c16-abea-4022-abfd-4a2146c882b0
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
19
SemanticChunker@1.0.0
983ac2ca9b08ed3fc1649d507f14584c15f7b2430df82aa5f3b9d869daf9cb76
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
unknown
unknown
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
[Exports > Building the code] ### Building the code We'll also add a `build` **script** to our `package.json` before we can bundle our code: ```json title="package.json" { "scripts": { "build": "vite build" } } ``` Then, we can finally run the `build` script: ```shell npm run build ``` This results in the fol...
code_snippets
875651f1-b385-4736-bedf-7f7797c7b51b
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
25
SemanticChunker@1.0.0
39bd969b1a94979de3af8ad75703c9fc10123e562947457350d433b4b753f98e
[Directory structure > Addendum: Code summary] static scope(...scopes) { return scopes.reduce((acc, scope) => this[scope](acc), this.all); } static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.lengt...
unknown
unknown
[Directory structure > Addendum: Code summary] static scope(...scopes) { return scopes.reduce((acc, scope) => this[scope](acc), this.all); } static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.lengt...
[Directory structure > Addendum: Code summary] static scope(...scopes) { return scopes.reduce((acc, scope) => this[scope](acc), this.all); } static find(id) { return Model.indexedInstances[this.name].id.get(id); } static findBy(fieldAndValue) { const entries = Object.entries(fieldAndValue); if (entries.lengt...
code_snippets
8b368a32-610e-4ed4-a6f6-58ca5d6ebe45
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
27
SemanticChunker@1.0.0
e5210dc461a683043bd6bca005f753a339098435d0693b014b6bc15f3b922f3d
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/factory.js" import Model from '#src/core/model.js'; const sequenceSymbol = Symbol('sequence'); const isSequence = value => value && typeof value[sequenceSymbol] === 'function'; export default class Factory { static factoryMap = new Map(); ...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/factory.js" import Model from '#src/core/model.js'; const sequenceSymbol = Symbol('sequence'); const isSequence = value => value && typeof value[sequenceSymbol] === 'function'; export default class Factory { static factoryMap = new Map(); ...
[Directory structure > Addendum: Code summary] ``` ```js title="src/core/factory.js" import Model from '#src/core/model.js'; const sequenceSymbol = Symbol('sequence'); const isSequence = value => value && typeof value[sequenceSymbol] === 'function'; export default class Factory { static factoryMap = new Map(); ...
code_snippets
95f34989-a869-4cf4-b62d-674abf748dc6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
23
SemanticChunker@1.0.0
a7b73a8b9f0d1471afcf1bd7d2b3974ccbfeef60e56a9f646d3eea95a9c2a946
[Directory structure > Addendum: Code summary] if (isAlias) { if (typeof field[1] === 'string') fieldOptions.type = field[1]; else if (typeof field[1] === 'object') fieldOptions = { ...fieldOptions, ...field[1] }; else throw new Error( `Invalid field definition for ${fieldName} in ${name}` ); } const { type:...
unknown
unknown
[Directory structure > Addendum: Code summary] if (isAlias) { if (typeof field[1] === 'string') fieldOptions.type = field[1]; else if (typeof field[1] === 'object') fieldOptions = { ...fieldOptions, ...field[1] }; else throw new Error( `Invalid field definition for ${fieldName} in ${name}` ); } const { type:...
[Directory structure > Addendum: Code summary] if (isAlias) { if (typeof field[1] === 'string') fieldOptions.type = field[1]; else if (typeof field[1] === 'object') fieldOptions = { ...fieldOptions, ...field[1] }; else throw new Error( `Invalid field definition for ${fieldName} in ${name}` ); } const { type:...
code_snippets
9850fcd7-0424-45cb-bf79-b6aaaf08b48a
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
29
SemanticChunker@1.0.0
ae56b3488f1c6854015addacb4df5fea7240026a07fc6ca68d1e801724a90181
[Directory structure > Addendum: Code summary] export default class PostSerializer extends Serializer { static { super.prepare(this, [ 'title', ['content', post => `<p>${post.content}</p>`], ['date', post => { const date = new Date(post.publishedAt); return date.toLocaleDateString('en-US', { weekday: 'short', ...
unknown
unknown
[Directory structure > Addendum: Code summary] export default class PostSerializer extends Serializer { static { super.prepare(this, [ 'title', ['content', post => `<p>${post.content}</p>`], ['date', post => { const date = new Date(post.publishedAt); return date.toLocaleDateString('en-US', { weekday: 'short', ...
[Directory structure > Addendum: Code summary] export default class PostSerializer extends Serializer { static { super.prepare(this, [ 'title', ['content', post => `<p>${post.content}</p>`], ['date', post => { const date = new Date(post.publishedAt); return date.toLocaleDateString('en-US', { weekday: 'short', ...
code_snippets
cd962b07-d946-4bd6-b404-7dd080ce2750
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
17
SemanticChunker@1.0.0
5ae005d32bc967575fe32990dfca89d6b79b3d4016d0afe0ce7531003afc90eb
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
unknown
unknown
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
[API design recap > Exports] ## Exports Finally, I exported all the building blocks and the main function from the `index.js` file. This way, I could bundle everything up in a nice neat package. ```js title="src/index.js" export * from './readEx.js'; export * from './backReference.js'; export * from './group.js'; ex...
code_snippets
d49e5c2c-f15d-4892-b0dc-598942ad4081
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-field-validation.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
22
SemanticChunker@1.0.0
b8604aba90ac6debfca76a26e8c9598d2dc03a33270bfe29c2b0b6e3a9269f11
[Directory structure > Addendum: Code summary] ## Addendum: Code summary The complete implementation is summarized below, as is traditional by now. This includes all the changes we've made to the `Model` class, as well as the changes to the `Author` and `Post` models, and all previous implementations. You can also [...
unknown
unknown
[Directory structure > Addendum: Code summary] ## Addendum: Code summary The complete implementation is summarized below, as is traditional by now. This includes all the changes we've made to the `Model` class, as well as the changes to the `Author` and `Post` models, and all previous implementations. You can also [...
[Directory structure > Addendum: Code summary] ## Addendum: Code summary The complete implementation is summarized below, as is traditional by now. This includes all the changes we've made to the `Model` class, as well as the changes to the `Author` and `Post` models, and all previous implementations. You can also [...
code_snippets
e066e467-8db4-4e83-bb13-3a76aa72f86d
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
18
SemanticChunker@1.0.0
1c7943fbe945c8422e4f6ac363d1b6f37113df3dba962e9f57c56594c7f14ca9
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
unknown
unknown
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
[API design recap > Exports] I've based this configuration off of [Vite's library mode](https://vite.dev/guide/build.html#library-mode) documentation. The `lib` object specifies the entry point, the library name, the output file name, and the format. We're using ES modules for compatibility with modern browsers and No...
code_snippets
e0f18e04-cec1-4be6-8004-6db6c6223fb5
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/complex-object-advanced-relationships.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
31
SemanticChunker@1.0.0
9076f788e2fdcdc6cb55e614b0d1f813c8b7c950792fc420aaa2216aada473dc
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
unknown
unknown
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
[Directory structure > Addendum: Code summary] ``` ```js title="src/serializers/postPreviewSerializer.js" import Serializer from '#src/core/serializer.js'; export default class PostPreviewSerializer extends Serializer { static { super.prepare(this, [ 'title', ['date', post => { const date = new Date(post.publis...
code_snippets
f67cf09e-4f4a-4f21-bd35-5fa0f7866339
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/content/snippets/js/s/tdd-library-implementation-with-vite-vitest.md
unknown
7dd1b641-f9d4-41f6-9b38-e7ef39173d3b
20
SemanticChunker@1.0.0
d87de34cf60f4bde69255451cb41c5a83c0cc2fb4304ff853c9faa52ed433cd5
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
unknown
unknown
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
[Exports > Publishing to npm] ### Publishing to npm Finally, we can **publish our package to npm**. We'll need to specify a few things in our `package.json` first to make sure the right files are included and the package is importable as an ES module: ```json title="package.json" { "name": "readex", "type": "modul...
code_snippets
21032a3d-f7d9-4131-8334-f8b64ce2c5b6
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/.github/prompts/new-article.prompt.md
unknown
e0de0340-58d0-452a-b6ae-2121849c7612
0
SemanticChunker@1.0.0
cd62eb463dd10ef0d9490a7065c693f2ba2056f5404d631a66764285e4de05de
--- mode: agent description: A prompt for writing new articles for 30 Seconds of Code. --- Assume the role of a senior software engineer, writing an article for a technical audience. Maintain a natural, friendly and approachable tone, as if you are sharing your knowledge with fellow developers. Focus on delivering cle...
unknown
unknown
--- mode: agent description: A prompt for writing new articles for 30 Seconds of Code. --- Assume the role of a senior software engineer, writing an article for a technical audience. Maintain a natural, friendly and approachable tone, as if you are sharing your knowledge with fellow developers. Focus on delivering cle...
--- mode: agent description: A prompt for writing new articles for 30 Seconds of Code. --- Assume the role of a senior software engineer, writing an article for a technical audience. Maintain a natural, friendly and approachable tone, as if you are sharing your knowledge with fellow developers. Focus on delivering cle...
code_snippets
294ab468-8c20-4f97-8b73-cda54fb1d4bb
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/.github/prompts/new-article.prompt.md
unknown
e0de0340-58d0-452a-b6ae-2121849c7612
2
SemanticChunker@1.0.0
9dd79e883cc41886e116f31424b499561de483b6d475529ecac88ffdeea59628
Headings should be between level 2 and level 4. Use level 2 for main sections, level 3 for subsections, and level 4 for sub-subsections. Avoid unnecessary nesting. Use bold text to emphasize key points or important concepts. Use it sparingly to maintain impact. Never use `’`, always use `'` for apostrophes. Use `"` f...
unknown
unknown
Headings should be between level 2 and level 4. Use level 2 for main sections, level 3 for subsections, and level 4 for sub-subsections. Avoid unnecessary nesting. Use bold text to emphasize key points or important concepts. Use it sparingly to maintain impact. Never use `’`, always use `'` for apostrophes. Use `"` f...
Headings should be between level 2 and level 4. Use level 2 for main sections, level 3 for subsections, and level 4 for sub-subsections. Avoid unnecessary nesting. Use bold text to emphasize key points or important concepts. Use it sparingly to maintain impact. Never use `’`, always use `'` for apostrophes. Use `"` f...
code_snippets
53355499-f47e-47a2-92a5-9fc7298683b3
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/.github/prompts/new-article.prompt.md
unknown
e0de0340-58d0-452a-b6ae-2121849c7612
3
SemanticChunker@1.0.0
c16ac5687ff6aea2b97d3da4e45a263b3748c24c8f602c536f2222e00df50e73
Ensure optimal SEO by including relevant keywords naturally in the text. Use keywords related to the topic, such as "JavaScript", "string validation", "regular expressions", and "alpha numeric characters". Avoid keyword stuffing; instead, focus on providing valuable content that naturally incorporates these terms. Ensu...
unknown
unknown
Ensure optimal SEO by including relevant keywords naturally in the text. Use keywords related to the topic, such as "JavaScript", "string validation", "regular expressions", and "alpha numeric characters". Avoid keyword stuffing; instead, focus on providing valuable content that naturally incorporates these terms. Ensu...
Ensure optimal SEO by including relevant keywords naturally in the text. Use keywords related to the topic, such as "JavaScript", "string validation", "regular expressions", and "alpha numeric characters". Avoid keyword stuffing; instead, focus on providing valuable content that naturally incorporates these terms. Ensu...
code_snippets
8023e00f-ff04-4351-a96a-2c878695fa30
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/.github/prompts/new-article.prompt.md
unknown
e0de0340-58d0-452a-b6ae-2121849c7612
1
SemanticChunker@1.0.0
d333117a172ad038d1bce1539222fc05679b05e94073fac43a9174d2588801bb
Mix paragraph lengths. Use varied sentence lengths and complexity for dynamic flow. Avoid predictable patterns. Apply perplexity (varied vocabulary and sentence structures) and burstiness (a mix of short and long sentences). Mix short, impactful sentences with longer, more complex ones. Don't follow formulaic structure...
unknown
unknown
Mix paragraph lengths. Use varied sentence lengths and complexity for dynamic flow. Avoid predictable patterns. Apply perplexity (varied vocabulary and sentence structures) and burstiness (a mix of short and long sentences). Mix short, impactful sentences with longer, more complex ones. Don't follow formulaic structure...
Mix paragraph lengths. Use varied sentence lengths and complexity for dynamic flow. Avoid predictable patterns. Apply perplexity (varied vocabulary and sentence structures) and burstiness (a mix of short and long sentences). Mix short, impactful sentences with longer, more complex ones. Don't follow formulaic structure...
code_snippets
6c31b38e-e80d-4eed-a734-70654b920a86
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/.github/copilot-instructions.md
unknown
77d7d353-fcf4-4850-ba03-af381cfc2b90
1
SemanticChunker@1.0.0
c4258aaf1c7f0a254f3eb531a9719e635c66b55fd531ca78b5428bb6320d2ffe
[Markdown] - Assume the role of a senior software engineer, writing an article for a technical audience. Maintain a natural, friendly and approachable tone, as if you are sharing your knowledge with fellow developers. Focus on delivering clear, concise, and actionable information that developers can apply directly to ...
unknown
unknown
[Markdown] - Assume the role of a senior software engineer, writing an article for a technical audience. Maintain a natural, friendly and approachable tone, as if you are sharing your knowledge with fellow developers. Focus on delivering clear, concise, and actionable information that developers can apply directly to ...
[Markdown] - Assume the role of a senior software engineer, writing an article for a technical audience. Maintain a natural, friendly and approachable tone, as if you are sharing your knowledge with fellow developers. Focus on delivering clear, concise, and actionable information that developers can apply directly to ...
code_snippets
e3b8f4f5-b642-481d-a8b3-a43eedbc47a9
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/.github/copilot-instructions.md
unknown
77d7d353-fcf4-4850-ba03-af381cfc2b90
0
SemanticChunker@1.0.0
c91f975a790be70c9d3b702a502922b70ec5849a1c6015aa59b2b44b161a514a
[JavaScript] # JavaScript - Use ES6 syntax for all JavaScript code. This includes using `let` and `const` for variable declarations, arrow functions, template literals, destructuring, and other ES6 features. - Use semicolons at the end of each statement. - Prefer single quotes for strings, except when the string cont...
unknown
unknown
[JavaScript] # JavaScript - Use ES6 syntax for all JavaScript code. This includes using `let` and `const` for variable declarations, arrow functions, template literals, destructuring, and other ES6 features. - Use semicolons at the end of each statement. - Prefer single quotes for strings, except when the string cont...
[JavaScript] # JavaScript - Use ES6 syntax for all JavaScript code. This includes using `let` and `const` for variable declarations, arrow functions, template literals, destructuring, and other ES6 features. - Use semicolons at the end of each statement. - Prefer single quotes for strings, except when the string cont...
code_snippets
0176fc26-d29c-4172-8d32-1d51171cdef4
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/CODE_OF_CONDUCT.md
unknown
e184fcbf-f9b9-4bfe-9ee6-833981a07b21
1
SemanticChunker@1.0.0
7e1fbdc11fed698d4423cea329a7d4ccddfed4c066a1e2ee64490e00bfe99800
[Contributor Covenant Code of Conduct > Our Standards] ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully acc...
unknown
unknown
[Contributor Covenant Code of Conduct > Our Standards] ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully acc...
[Contributor Covenant Code of Conduct > Our Standards] ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully acc...
code_snippets
0befdd0f-91d7-4e7e-bf61-1ef2d97e6c14
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/CODE_OF_CONDUCT.md
unknown
e184fcbf-f9b9-4bfe-9ee6-833981a07b21
9
SemanticChunker@1.0.0
c9c5971c00b54d956a6d28f4ebc4ffa78bd87d91b9801dd2843232771b367749
[Enforcement Guidelines > 4. Permanent Ban] ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ba...
unknown
unknown
[Enforcement Guidelines > 4. Permanent Ban] ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ba...
[Enforcement Guidelines > 4. Permanent Ban] ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ba...
code_snippets
33c19649-01e8-4941-95c5-f66e2ae393fe
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/CODE_OF_CONDUCT.md
unknown
e184fcbf-f9b9-4bfe-9ee6-833981a07b21
4
SemanticChunker@1.0.0
e82e5df26d355975e4d6ca3537c471c1280b6bd526d29ff52533ce4e3886db06
[Contributor Covenant Code of Conduct > Enforcement] ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. All community ...
unknown
unknown
[Contributor Covenant Code of Conduct > Enforcement] ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. All community ...
[Contributor Covenant Code of Conduct > Enforcement] ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. All community ...
code_snippets
87a1ff1c-f203-4ceb-903d-13f71b990d88
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/CODE_OF_CONDUCT.md
unknown
e184fcbf-f9b9-4bfe-9ee6-833981a07b21
8
SemanticChunker@1.0.0
2a4df13520050e3214f793d82a34cf9a8cbbf065c53a4e34c18582dbd177f233
[Enforcement Guidelines > 3. Temporary Ban] ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No pu...
unknown
unknown
[Enforcement Guidelines > 3. Temporary Ban] ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No pu...
[Enforcement Guidelines > 3. Temporary Ban] ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No pu...
code_snippets
98f624b0-a698-4f15-ab51-e1f3711e03c0
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/CODE_OF_CONDUCT.md
unknown
e184fcbf-f9b9-4bfe-9ee6-833981a07b21
2
SemanticChunker@1.0.0
52554fcbe03f5f7bfd373403a7095a4dc061f6949d05863185f530122bff8dab
[Contributor Covenant Code of Conduct > Enforcement Responsibilities] ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threa...
unknown
unknown
[Contributor Covenant Code of Conduct > Enforcement Responsibilities] ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threa...
[Contributor Covenant Code of Conduct > Enforcement Responsibilities] ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threa...
code_snippets
9fba779b-15af-4d41-95c1-21b76abdf071
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/CODE_OF_CONDUCT.md
unknown
e184fcbf-f9b9-4bfe-9ee6-833981a07b21
5
SemanticChunker@1.0.0
d155c8817464a915c1630bd1a7292a4bd515d6940f2b96f79b70fadb8afabd0e
[Contributor Covenant Code of Conduct > Enforcement Guidelines] ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
unknown
unknown
[Contributor Covenant Code of Conduct > Enforcement Guidelines] ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
[Contributor Covenant Code of Conduct > Enforcement Guidelines] ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
code_snippets
a6123308-4d04-470b-af53-348b58aaff22
unknown
file:///home/sanjeev/Downloads/depthapi/datasets/30-seconds-of-code/CODE_OF_CONDUCT.md
unknown
e184fcbf-f9b9-4bfe-9ee6-833981a07b21
7
SemanticChunker@1.0.0
11d927034adaf7035cefaf04a5e2d8566926f865747e535130712664b98a0d7c
[Enforcement Guidelines > 2. Warning] ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Condu...
unknown
unknown
[Enforcement Guidelines > 2. Warning] ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Condu...
[Enforcement Guidelines > 2. Warning] ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Condu...
code_snippets