Releasing < validate-access > Validate project accessibility files

栏目: IT技术 · 发布时间: 5年前

内容简介: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

Test

npm test

License

This project is licensed under the GPL-3.0 License


以上所述就是小编给大家介绍的《Releasing < validate-access > Validate project accessibility files》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Introduction to Graph Theory

Introduction to Graph Theory

Douglas B. West / Prentice Hall / 2000-9-1 / USD 140.00

For undergraduate or graduate courses in Graph Theory in departments of mathematics or computer science. This text offers a comprehensive and coherent introduction to the fundamental topics of graph ......一起来看看 《Introduction to Graph Theory》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具