@poppinss/manager
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -18,2 +18,6 @@ import { ManagerContract, ExtendCallback } from './Contracts'; | ||
/** | ||
* A cache to store the function names for initiating driver instances. | ||
*/ | ||
private driverCreatorNames; | ||
/** | ||
* List of drivers added at runtime | ||
@@ -56,2 +60,6 @@ */ | ||
/** | ||
* Returns the creator function name for a given driver. | ||
*/ | ||
private getDriverCreatorName; | ||
/** | ||
* Make the custom driver instance by checking for function on the | ||
@@ -58,0 +66,0 @@ * parent class. |
@@ -12,2 +12,5 @@ "use strict"; | ||
exports.Manager = void 0; | ||
/** | ||
* The simplest implementation of capitalizing a string | ||
*/ | ||
const capitalize = (value) => { | ||
@@ -34,2 +37,6 @@ if (!value) { | ||
/** | ||
* A cache to store the function names for initiating driver instances. | ||
*/ | ||
this.driverCreatorNames = new Map(); | ||
/** | ||
* List of drivers added at runtime | ||
@@ -64,2 +71,11 @@ */ | ||
/** | ||
* Returns the creator function name for a given driver. | ||
*/ | ||
getDriverCreatorName(driver) { | ||
if (!this.driverCreatorNames.has(driver)) { | ||
this.driverCreatorNames.set(driver, `create${capitalize(driver.replace(/-\w|_\w/g, (g) => g.substr(1).toUpperCase()))}`); | ||
} | ||
return this.driverCreatorNames.get(driver); | ||
} | ||
/** | ||
* Make the custom driver instance by checking for function on the | ||
@@ -72,5 +88,3 @@ * parent class. | ||
makeDriver(mappingName, driver, config) { | ||
const driverCreatorName = `create${capitalize(driver.replace(/-\w|_\w/g, (g) => { | ||
return g.substr(1).toUpperCase(); | ||
}))}`; | ||
const driverCreatorName = this.getDriverCreatorName(driver); | ||
/** | ||
@@ -77,0 +91,0 @@ * Raise error when the parent class doesn't implement the function |
# The MIT License | ||
Copyright 2019 Harminder virk, contributors | ||
Copyright 2020 Harminder virk, contributors | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
{ | ||
"name": "@poppinss/manager", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "The builder (Manager) pattern implementation", | ||
@@ -15,3 +15,2 @@ "main": "build/index.js", | ||
"test": "node japaFile.js", | ||
"lint": "eslint . --ext=.ts", | ||
"clean": "del build", | ||
@@ -23,3 +22,6 @@ "compile": "npm run lint && npm run clean && tsc", | ||
"version": "npm run build", | ||
"format": "prettier --write ." | ||
"format": "prettier --write .", | ||
"prepublishOnly": "npm run build", | ||
"lint": "eslint . --ext=.ts", | ||
"sync-labels": "github-label-sync --labels ./node_modules/@adonisjs/mrm-preset/gh-labels.json poppinss/manager" | ||
}, | ||
@@ -33,4 +35,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@adonisjs/mrm-preset": "^2.3.6", | ||
"@types/node": "^14.0.14", | ||
"@adonisjs/mrm-preset": "^2.4.0", | ||
"@types/node": "^14.0.23", | ||
"commitizen": "^4.1.2", | ||
@@ -40,13 +42,15 @@ "cz-conventional-changelog": "^3.2.0", | ||
"doctoc": "^1.4.0", | ||
"eslint": "^7.3.1", | ||
"eslint": "^7.4.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-adonis": "^1.0.14", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"github-label-sync": "^2.0.0", | ||
"husky": "^4.2.5", | ||
"japa": "^3.1.1", | ||
"mrm": "^2.3.3", | ||
"np": "^6.2.5", | ||
"np": "^6.3.2", | ||
"npm-audit-html": "^1.4.1", | ||
"prettier": "^2.0.5", | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.6" | ||
"typescript": "^3.9.7" | ||
}, | ||
@@ -63,3 +67,3 @@ "nyc": { | ||
"hooks": { | ||
"pre-commit": "doctoc README.md --title='## Table of contents' && git add README.md", | ||
"pre-commit": "doctoc README.md --title='## Table of contents' && git add README.md && npm audit --production --json | ./node_modules/.bin/npm-audit-html && git add npm-audit.html", | ||
"commit-msg": "node ./node_modules/@adonisjs/mrm-preset/validateCommit/conventional/validate.js" | ||
@@ -66,0 +70,0 @@ } |
@@ -8,3 +8,3 @@ <div align="center"> | ||
[![circleci-image]][circleci-url] [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url] | ||
[![circleci-image]][circleci-url] [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url] [![audit-report-image]][audit-report-url] | ||
@@ -292,1 +292,4 @@ Manager pattern is a way to ease the construction of objects of similar nature. To understand it better, we will follow an imaginary example through out this document. | ||
[license-url]: LICENSE.md "license" | ||
[audit-report-image]: https://img.shields.io/badge/-Audit%20Report-blueviolet?style=for-the-badge | ||
[audit-report-url]: https://htmlpreview.github.io/?https://github.com/poppinss/manager/blob/develop/npm-audit.html "audit-report" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22663
315
294
19