Comparing version
{ | ||
"name": "base-io", | ||
"version": "1.0.3", | ||
"description": "Easy creation of a basis module.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/negezor/base-io.git" | ||
}, | ||
"keywords": [ | ||
"easy", | ||
"create", | ||
"structure", | ||
"module", | ||
"node", | ||
"organization" | ||
], | ||
"author": "https://vk.com/id195624402", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/negezor/base-io/issues" | ||
}, | ||
"homepage": "https://github.com/negezor/base-io#readme" | ||
"name": "base-io", | ||
"version": "2.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/npm/deprecate-holder.git" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/npm/deprecate-holder/issues" | ||
}, | ||
"homepage": "https://github.com/npm/deprecate-holder#readme", | ||
"dependencies": {} | ||
} |
165
README.md
@@ -1,164 +0,5 @@ | ||
# BASE-IO | ||
> Добавление в прототип из файлов, наследование, EventEmitter, создание "цепочек" | ||
# Deprecated Package | ||
Позволяет легко создавать структуры модуля разделяя его по файлам и не только | ||
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name. | ||
[](https://www.npmjs.com/package/base-io) | ||
[](https://www.npmjs.com/package/base-io) | ||
## Инициализация / Начало работы | ||
### Установка модуля | ||
```shell | ||
npm install base-io --save | ||
``` | ||
### Инициализация одного экземпляра | ||
```javascript | ||
'use strict'; | ||
const base = new (require('base-io')); | ||
``` | ||
### Импорт конструктора для расширения | ||
```javascript | ||
base.import(function(){...}); | ||
/* Или */ | ||
base.import(class Example { | ||
constructor () {...} | ||
}); | ||
``` | ||
### Экспорт готового конструктора | ||
```javascript | ||
base.export(); // -> object | ||
``` | ||
### Наследование объектов | ||
Наследует все свойства объекта | ||
```javascript | ||
base.extend({...}); | ||
``` | ||
Наследовать EventEmitter | ||
```javascript | ||
base.emitter(); | ||
``` | ||
### Наследование из файлов | ||
#### Установка пути поиска | ||
Установка пути для поиска директорий, необходимо для `.scan()` | ||
Не обязательно из текущий директории | ||
```javascript | ||
base.root(__dirname); | ||
``` | ||
#### Директории с расширением прототипа | ||
Необходимо передать название директории с файлами | ||
Подгружает файлы с расширением .js вытаскивая из них объекты | ||
Принимает `string` или `array` | ||
```javascript | ||
base.scan([ | ||
'primary', | ||
'middleware' | ||
]); | ||
/* Или */ | ||
base.scan('primary'); | ||
base.scan('middleware'); | ||
``` | ||
Структура папок для примера выше | ||
``` | ||
- module | ||
+ primary | ||
+ middleware | ||
``` | ||
Пример файлов в любой из этих папок | ||
Контекст выполнения что и в основном классе | ||
```javascript | ||
/* primary/random.js */ | ||
exports.getRandom = function(){ | ||
return Math.random(); | ||
} | ||
/* primary/time.js */ | ||
exports.getTimestamp = function(){ | ||
return Date.now(); | ||
}; | ||
/* middleware/test.js */ | ||
exports.test = function(){ | ||
console.log(this.getTimestamp(),this.getRandom()); | ||
}; | ||
``` | ||
### Создание "цепочек" | ||
Установка специального метода для создания цепочки c привязкой контекста `_properties` | ||
```javascript | ||
base.change(); | ||
``` | ||
Пример дальнейшего использования | ||
```javascript | ||
/* module/index.js */ | ||
'use strict'; | ||
const base = new (require('base-io')); | ||
base | ||
.import(function(){ | ||
this.name = 'Example'; | ||
this.version = 1; | ||
this._properties('foo',this.chain); | ||
}) | ||
.root(__dirname) | ||
.scan('main') | ||
.change(); | ||
module.exports = base.export(); | ||
/* module/main/chain.js */ | ||
'use strict'; | ||
exports.chain = []; | ||
const add = (way,handler) => { | ||
exports.chain.push({ | ||
way: way, | ||
handler: handler | ||
}); | ||
}; | ||
add('baz',function(){ | ||
console.log(this.name); | ||
}); | ||
add('bar.quux',function(){ | ||
console.log(this.version); | ||
}); | ||
/* app.js */ | ||
'use strict'; | ||
var chain = new (require('./module')); | ||
chain.foo.baz(); | ||
// Console: Example | ||
chain.foo.bar.quux(); | ||
// Console: 1 | ||
``` | ||
Структура директорий примера: | ||
``` | ||
- module | ||
- main | ||
chain.js | ||
index.js | ||
app.js | ||
``` | ||
Please contact support@npmjs.com if you have questions about this package. |
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
-50%0
-100%692
-90.69%2
-50%0
-100%6
-96.36%3
200%