-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
10,049 additions
and
3,231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,40 @@ | ||
//#region YI | ||
|
||
import { Y, yClassifyProp, } from "@syls/y"; | ||
import { YCursor } from "../-submodule/cursor/-module/export.mjs"; | ||
import { YMany } from "@syls/y/many"; | ||
|
||
/** @type {import('./config.mjs')['default']['value']?} */ | ||
let config = null; | ||
|
||
await import('./config.mjs') | ||
|
||
.then(c => config = c.default?.value ? c.default.value : c.default) | ||
.catch(e => e); | ||
|
||
/** @type {import('./error.mjs')['default']?} */ | ||
let error = null; | ||
|
||
await import('./error.mjs') | ||
|
||
.then(e => error = e.default) | ||
.catch(e => e); | ||
import { YArg } from "@syls/y/arg"; | ||
import { configArray as config } from "./config.mjs"; | ||
import { Y } from "@syls/y"; | ||
|
||
//#endregion | ||
//#region YT | ||
|
||
/** ### YArrayT | ||
* - Тип `T` | ||
* | ||
* Основной параметр модуля `YArray`. | ||
* | ||
/** | ||
* ### YArray | ||
* - Тип `S` | ||
* - Версия `1.0.0` | ||
* *** | ||
* | ||
* @typedef {YArrayTE&YArrayTU} YArrayT | ||
*/ | ||
/** ### YArrayTE | ||
* - Тип `TE` | ||
* | ||
* Параметр наследования `YArray`. | ||
* | ||
* @typedef {Omit<DArray, keyof SArray>} YArrayTE | ||
*/ | ||
/** ### YArrayTU | ||
* - Тип `TU` | ||
* | ||
* Уникальные параметры `YArray`. | ||
* | ||
* *** | ||
* @typedef YArrayTU | ||
* @prop {number} length | ||
*/ | ||
/** ### YArrayTUG | ||
* - Тип `TUP` | ||
* @prop {} _ | ||
* | ||
* Уникальные генеративные параметры `YArray`. | ||
* @typedef {YArrayTU&YArrayTE} YArrayT | ||
* @typedef {Omit<YArray, keyof Y>} YArrayTE | ||
* *** | ||
* @class | ||
* @since `1.0.0` | ||
* @version `1.0.0` | ||
* | ||
* @typedef YArrayTUG | ||
* @prop {null} _ | ||
*/ | ||
|
||
//#endregion | ||
|
||
/** | ||
* @template Y1 | ||
*/ | ||
class SArray extends YMany { | ||
export class YArray extends Y { | ||
|
||
//#region static | ||
|
||
static { | ||
|
||
|
||
|
||
}; | ||
|
||
/** | ||
* ### stock | ||
|
@@ -95,207 +68,98 @@ class SArray extends YMany { | |
*/ | ||
static create(...args) { | ||
|
||
return Object.getPrototypeOf(SArray).create.apply(this, [...args]); | ||
return Object.getPrototypeOf(this).create.apply(this, args); | ||
|
||
}; | ||
|
||
/** | ||
* ### sequence | ||
* | ||
* *** | ||
* | ||
* Метод создания массива из указанной последовательности значений. | ||
* | ||
* *** | ||
* @arg {...any} args `Аргументы` | ||
* @arg {Y1} value `Значение` | ||
* @static | ||
* @method | ||
* @public | ||
* @returns {(Y1&Y1)?} | ||
* @template {YArray} Y1 | ||
*/ | ||
static sequence(...args) { | ||
|
||
return new YArray({ values: args, }); | ||
static becomePrototype(value) { | ||
return Object.getPrototypeOf(this).becomePrototype.apply(this, [value]); | ||
|
||
}; | ||
|
||
}; | ||
/** | ||
* @extends SArray<Y1> | ||
* @template Y1 | ||
*/ | ||
class DArray extends SArray { | ||
|
||
/** | ||
* ### values | ||
* | ||
* Значения. | ||
* | ||
* *** | ||
* @type {Y1[]} | ||
* @field | ||
* @public | ||
*/ | ||
values; | ||
|
||
}; | ||
/** | ||
* @extends DArray<Y1> | ||
* @template Y1 | ||
*/ | ||
class IArray extends DArray { | ||
//#endregion | ||
|
||
num; | ||
|
||
/** | ||
* ### cursors | ||
* ### YArrayConstructor | ||
* | ||
* Курсоры. | ||
* | ||
* *** | ||
* @type {YCursor[]} | ||
* @field | ||
* @public | ||
*/ | ||
cursors; | ||
|
||
}; | ||
/** | ||
* @extends IArray<Y1> | ||
* @template Y1 | ||
*/ | ||
class MArray extends IArray { | ||
|
||
|
||
|
||
}; | ||
/** | ||
* @extends MArray<Y1> | ||
* @template Y1 | ||
*/ | ||
class FArray extends MArray { | ||
|
||
/** | ||
* ### YArray.constructor | ||
* | ||
* *** | ||
* @arg {YArrayT} args `Аргументы` | ||
* | ||
* Представлены единым объектом носителем аргументов. | ||
* | ||
* *** | ||
* @arg {YArrayT&G} t | ||
* @constructor | ||
*/ | ||
constructor(t) { | ||
|
||
t = [...arguments]; | ||
|
||
super(Object.assign(t = FArray.#before(t), {})); | ||
constructor(...args) { | ||
|
||
FArray.#deceit.apply(this, [t]); | ||
|
||
}; | ||
|
||
/** @arg {any[]} t */ | ||
static #before(t) { | ||
|
||
/** @type {YArrayT} */ | ||
let r = {}; | ||
|
||
if (t?.length === 1 && [Object, YArray].includes(t[0]?.constructor) && !Object.getOwnPropertyNames(t[0]).includes('_ytp')) { | ||
|
||
r = t[0]; | ||
try { | ||
|
||
//#region before | ||
|
||
/** @type {YArg<YArray>} */ | ||
const yarg = args instanceof YArg ? args : new YArg(args); | ||
|
||
yarg.set(['num', 'number']); | ||
|
||
return r; | ||
super(yarg); | ||
|
||
} else if (!t.length) { | ||
//#endregion | ||
//#region verify | ||
|
||
return r; | ||
|
||
}; | ||
|
||
if (t[0]?._ytp) { | ||
|
||
t = [...t[0]._ytp]; | ||
|
||
}; | ||
|
||
const arg = yClassifyProp(t); | ||
|
||
r.values = arg.array[0]; | ||
|
||
if (!Object.values(r).length) { | ||
|
||
r = { _ytp: t, }; | ||
//#endregion | ||
//#region handle | ||
|
||
}; | ||
|
||
return r; | ||
|
||
}; | ||
/** @arg {YArrayT} t @this {YArray} */ | ||
static #deceit(t) { | ||
|
||
try { | ||
|
||
FArray.#verify.apply(this, [t]); | ||
|
||
} catch (e) { | ||
//#endregion | ||
//#region comply | ||
|
||
throw e; | ||
|
||
} finally { | ||
|
||
//#endregion | ||
|
||
return this | ||
|
||
}; | ||
|
||
}; | ||
/** @arg {YArrayT} t @this {YArray} */ | ||
static #verify(t) { | ||
|
||
FArray.#handle.apply(this, [t]); | ||
|
||
}; | ||
/** @arg {YArrayT} t @this {YArray} */ | ||
static #handle(t) { | ||
|
||
|
||
|
||
FArray.#create.apply(this, [t]); | ||
|
||
}; | ||
/** @arg {YArrayT} t @this {YArray} */ | ||
static #create(t) { | ||
|
||
const { | ||
.adopt(yarg.getData()) | ||
.correlate() | ||
|
||
|
||
} catch (err) { | ||
|
||
if (config.value.strictMode) { | ||
|
||
throw err; | ||
|
||
}; | ||
|
||
} finally { | ||
|
||
} = t; | ||
|
||
this.adopt(t); | ||
|
||
if (config) { | ||
|
||
this.adoptDefault(this.constructor.config ?? config); | ||
|
||
}; | ||
|
||
}; | ||
|
||
}; | ||
|
||
/** | ||
* ### YArray | ||
* - Тип `SDIMFY` | ||
* - Цепочка `BDVHC` | ||
* *** | ||
* | ||
* Класс `YArray` предназначен для работы с индексируемыми множествами. | ||
* | ||
* *** | ||
* @class | ||
* @extends FArray<YArrayTUG&Y1> | ||
* @template Y1 | ||
* | ||
*/ | ||
export class YArray extends FArray { | ||
|
||
/** @arg {Y1} t */ | ||
constructor(t) { super(t); }; | ||
|
||
}; | ||
* @file array/class.mjs | ||
* @author Yakhin Nikita Artemovich <[email protected]> | ||
* @license Apache-2.0 | ||
* @copyright SYLS (Software Y Lib Solutions) 2023 | ||
*/ |
Oops, something went wrong.