Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1# ObjectSchema Package2 3## Overview4 5A JavaScript object merge/validation utility where you can define a different merge and validation strategy for each key. This is helpful when you need to validate complex data structures and then merge them in a way that is more complex than `Object.assign()`. This is used in the [`@eslint/config-array`](https://npmjs.com/package/@eslint/config-array) package but can also be used on its own.6 7## Installation8 9For Node.js and compatible runtimes:10 11```shell12npm install @eslint/object-schema13# or14yarn add @eslint/object-schema15# or16pnpm install @eslint/object-schema17# or18bun add @eslint/object-schema19```20 21For Deno:22 23```shell24deno add @eslint/object-schema25```26 27## Usage28 29Import the `ObjectSchema` constructor:30 31```js32// using ESM33import { ObjectSchema } from "@eslint/object-schema";34 35// using CommonJS36const { ObjectSchema } = require("@eslint/object-schema");37 38const schema = new ObjectSchema({39 // define a definition for the "downloads" key40 downloads: {41 required: true,42 merge(value1, value2) {43 return value1 + value2;44 },45 validate(value) {46 if (typeof value !== "number") {47 throw new Error("Expected downloads to be a number.");48 }49 },50 },51 52 // define a strategy for the "versions" key53 version: {54 required: true,55 merge(value1, value2) {56 return value1.concat(value2);57 },58 validate(value) {59 if (!Array.isArray(value)) {60 throw new Error("Expected versions to be an array.");61 }62 },63 },64});65 66const record1 = {67 downloads: 25,68 versions: ["v1.0.0", "v1.1.0", "v1.2.0"],69};70 71const record2 = {72 downloads: 125,73 versions: ["v2.0.0", "v2.1.0", "v3.0.0"],74};75 76// make sure the records are valid77schema.validate(record1);78schema.validate(record2);79 80// merge together (schema.merge() accepts any number of objects)81const result = schema.merge(record1, record2);82 83// result looks like this:84 85const result = {86 downloads: 75,87 versions: ["v1.0.0", "v1.1.0", "v1.2.0", "v2.0.0", "v2.1.0", "v3.0.0"],88};89```90 91## Tips and Tricks92 93### Named merge strategies94 95Instead of specifying a `merge()` method, you can specify one of the following strings to use a default merge strategy:96 97- `"assign"` - use `Object.assign()` to merge the two values into one object.98- `"overwrite"` - the second value always replaces the first.99- `"replace"` - the second value replaces the first if the second is not `undefined`.100 101For example:102 103```js104const schema = new ObjectSchema({105 name: {106 merge: "replace",107 validate() {},108 },109});110```111 112### Named validation strategies113 114Instead of specifying a `validate()` method, you can specify one of the following strings to use a default validation strategy:115 116- `"array"` - value must be an array.117- `"boolean"` - value must be a boolean.118- `"number"` - value must be a number.119- `"object"` - value must be an object.120- `"object?"` - value must be an object or null.121- `"string"` - value must be a string.122- `"string!"` - value must be a non-empty string.123 124For example:125 126```js127const schema = new ObjectSchema({128 name: {129 merge: "replace",130 validate: "string",131 },132});133```134 135### Subschemas136 137If you are defining a key that is, itself, an object, you can simplify the process by using a subschema. Instead of defining `merge()` and `validate()`, assign a `schema` key that contains a schema definition, like this:138 139```js140const schema = new ObjectSchema({141 name: {142 schema: {143 first: {144 merge: "replace",145 validate: "string",146 },147 last: {148 merge: "replace",149 validate: "string",150 },151 },152 },153});154 155schema.validate({156 name: {157 first: "n",158 last: "z",159 },160});161```162 163### Remove Keys During Merge164 165If the merge strategy for a key returns `undefined`, then the key will not appear in the final object. For example:166 167```js168const schema = new ObjectSchema({169 date: {170 merge() {171 return undefined;172 },173 validate(value) {174 Date.parse(value); // throws an error when invalid175 },176 },177});178 179const object1 = { date: "5/5/2005" };180const object2 = { date: "6/6/2006" };181 182const result = schema.merge(object1, object2);183 184console.log("date" in result); // false185```186 187### Requiring Another Key Be Present188 189If you'd like the presence of one key to require the presence of another key, you can use the `requires` property to specify an array of other properties that any key requires. For example:190 191```js192const schema = new ObjectSchema();193 194const schema = new ObjectSchema({195 date: {196 merge() {197 return undefined;198 },199 validate(value) {200 Date.parse(value); // throws an error when invalid201 },202 },203 time: {204 requires: ["date"],205 merge(first, second) {206 return second;207 },208 validate(value) {209 // ...210 },211 },212});213 214// throws error: Key "time" requires keys "date"215schema.validate({216 time: "13:45",217});218```219 220In this example, even though `date` is an optional key, it is required to be present whenever `time` is present.221 222## License223 224Apache 2.0225 226<!-- NOTE: This section is autogenerated. Do not manually edit.-->227<!--sponsorsstart-->228 229## Sponsors230 231The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)232to get your logo on our READMEs and [website](https://eslint.org/sponsors).233 234<h3>Platinum Sponsors</h3>235<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>236<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>237<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>238<p><a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>239<h3>Technology Sponsors</h3>240Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.241<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>242<!--sponsorsend-->243 