@mirta/polyfills 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/README.md +19 -0
- package/README.ru.md +19 -0
- package/dist/index.mjs +39 -0
- package/package.json +32 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @mirta/polyfils
|
|
2
|
+
|
|
3
|
+
[](https://github.com/wb-mirta/core/blob/latest/packages/mirta-polyfills/README.md)
|
|
4
|
+
[](https://github.com/wb-mirta/core/blob/latest/packages/mirta-polyfills/README.ru.md)
|
|
5
|
+
[](https://npmjs.com/package/@mirta/polyfills)
|
|
6
|
+
|
|
7
|
+
This is a collection of polyfills covering features of higher ECMAScript versions that is not compatible with a current version of wb-rules engine. They are used to support the internal algorithms of the framework.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
```sh
|
|
11
|
+
pnpm add @mirta/polyfills
|
|
12
|
+
```
|
|
13
|
+
## Usage
|
|
14
|
+
```ts
|
|
15
|
+
import '@mirta/polyfills'
|
|
16
|
+
```
|
|
17
|
+
To apply the polyfills, it is enough to import them into the wb-rules script or any of the imported modules.
|
|
18
|
+
|
|
19
|
+
Due to the absence of third-party dependencies, the source code of the polyfiles will be converted into the wb-rules-module for the Wiren Board controller.
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @mirta/polyfils
|
|
2
|
+
|
|
3
|
+
[](https://github.com/wb-mirta/core/blob/latest/packages/mirta-polyfills/README.md)
|
|
4
|
+
[](https://github.com/wb-mirta/core/blob/latest/packages/mirta-polyfills/README.ru.md)
|
|
5
|
+
[](https://npmjs.com/package/@mirta/polyfills)
|
|
6
|
+
|
|
7
|
+
Коллекция полифилов, добавляющая часть возможностей новых версий стандарта ECMAScript, которые не поддерживаются текущей версией движка wb-rules. Используется для обеспечения работоспособности внутренних алгоритмов фреймворка.
|
|
8
|
+
|
|
9
|
+
## Установка
|
|
10
|
+
```sh
|
|
11
|
+
pnpm add @mirta/polyfills
|
|
12
|
+
```
|
|
13
|
+
## Использование
|
|
14
|
+
```ts
|
|
15
|
+
import '@mirta/polyfills'
|
|
16
|
+
```
|
|
17
|
+
Чтобы полифилы применились, достаточно импортировать их в скрипт правил или любой из подключенных модулей.
|
|
18
|
+
|
|
19
|
+
Благодаря отсутствию сторонних зависимостей, исходный код полифилов будет преобразован в модуль wb-rules-module для контроллера Wiren Board.
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Object.assign() is part of the ES6 (June 2015) specification.
|
|
2
|
+
if (typeof Object.assign != 'function') {
|
|
3
|
+
// Must be writable: true, enumerable: false, configurable: true
|
|
4
|
+
Object.defineProperty(Object, 'assign', {
|
|
5
|
+
value: function assign(target) {
|
|
6
|
+
if (target == null) { // TypeError if undefined or null
|
|
7
|
+
throw new TypeError('Cannot convert undefined or null to object');
|
|
8
|
+
}
|
|
9
|
+
const to = Object(target);
|
|
10
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
11
|
+
// eslint-disable-next-line prefer-rest-params
|
|
12
|
+
const nextSource = arguments[index];
|
|
13
|
+
if (nextSource != null) { // Skip over if undefined or null
|
|
14
|
+
for (const nextKey in nextSource) {
|
|
15
|
+
// Avoid bugs when hasOwnProperty is shadowed
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
18
|
+
to[nextKey] = nextSource[nextKey];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
},
|
|
25
|
+
writable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Object.values() is part of the ES8 (June 2017) specification.
|
|
31
|
+
if (typeof Object.values != 'function') {
|
|
32
|
+
Object.defineProperty(Object, 'values', {
|
|
33
|
+
value: function values(o) {
|
|
34
|
+
return Object.keys(o).map(k => o[k]);
|
|
35
|
+
},
|
|
36
|
+
writable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
});
|
|
39
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mirta/polyfills",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "Unlicense",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mirta",
|
|
7
|
+
"wb-rules"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"exports": "./dist/index.mjs",
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/wb-mirta/core/tree/latest/packages/mirta-polyfills#readme",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/wb-mirta/core.git",
|
|
23
|
+
"directory": "packages/mirta-polyfills"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/wb-mirta/core/issues"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"clean": "rimraf dist build",
|
|
30
|
+
"build": "pnpm clean && rollup -c ../../rollup.config.mjs"
|
|
31
|
+
}
|
|
32
|
+
}
|