内容简介:This project is licensed under the
validate-access
Validate project accessibility files
npm install validate-access
API
validateAccess
/**
* Validates access for `package.json` and project entry if
* provided.
*
* @param {string} [dir="."] - project directory
* @param {boolean} [isValidateEntry=false] - if false, it only validate `package.json`
* @param {string} [entry="index"]
* @param {string} [srcName="src"]
*
* @returns {Object} result
* @returns {boolean} result.isValid - true, if access is valid
* @returns {boolean} result.isSrc - true, if project contains src folder
* @returns {string} result.ext - entry file extension
*/
function validateAccess({
dir,
isValidateEntry,
entry,
srcName
})
Example(1)
import { validateAccess } from "validate-access";
const { isValid, isSrc, ext } = validateAccess({
dir: "path/to/valid",
isValidateEntry: true
});
// { isValid: true, isSrc: true, ext: js }
getFileExtension
getFileExtension
is used internally by validateAccess
however it is exported
for further use.
/**
* Gets extension used in for given entry
*
* @param {string} dir - project directory
* @param {string} entry - project file entry name
* @returns {string|undefined} extension if exist
*/
function getFileExtension(dir, entry)
Example(2)
import { validateAccess } from "validate-access";
const extension = getFileExtension("path/to/valid", "index");
// extension > js
Related projects
-
packageSorter - Sorting packages for monorepos production.
-
builderz - Build your project(s) with zero configuration
-
corename - Extracts package name.
-
move-position - Moves element index in an array.
-
get-info - Utility functions for projects production.
-
textics & textics-stream - Counts lines, words, chars and spaces for a given string.
Test
npm test
License
This project is licensed under the GPL-3.0 License
以上所述就是小编给大家介绍的《Releasing < validate-access > Validate project accessibility files》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。