parent-folder:获取给定路径的父文件夹的名称

  • W5_285432
    了解作者
  • 8.3KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 04:47
    上传日期
父文件夹 获取父文件夹的名称。 对于给定的路径,返回最直接的父文件夹的名称。 对于要以某种方式使用父文件夹名称(项目命名等)的脚本和生成器很有用。 安装 npm install --save parent-folder 用法 var parentFolder = require ( 'parent-folder' ) ; // Assuming we're currently in: /foo/bar/index.js // Defaults to current folder of call: parentFolder ( ) //=> 'bar' // Passing in a path to a folder: parentFolder ( '/some/path/here' ) //=> 'here' // If using in a path to a file, mak
parent-folder-master.zip
  • parent-folder-master
  • .gitignore
    62B
  • .nvmrc
    12B
  • test
  • mocha.opts
    57B
  • index-test.js
    541B
  • helper.js
    193B
  • api.md
    648B
  • .eslintrc
    3.1KB
  • package.json
    1.3KB
  • src
  • index.js
    858B
  • readme.md
    1.9KB
  • changelog.md
    55B
  • .eslintignore
    5B
  • .npmignore
    6B
  • .travis.yml
    80B
  • .editorconfig
    197B
  • lib
  • index.js
    1.2KB
  • license
    1.1KB
内容介绍
# parent-folder [![Travis CI build status](https://img.shields.io/travis/danawoodman/parent-folder.svg)](https://travis-ci.org/danawoodman/parent-folder) [![Dependency Status](https://img.shields.io/david/danawoodman/parent-folder.svg)](https://david-dm.org/danawoodman/parent-folder) [![View on npm](https://img.shields.io/npm/dm/parent-folder.svg)](https://www.npmjs.com/package/parent-folder) [![View on npm](https://img.shields.io/npm/v/parent-folder.svg)](https://www.npmjs.com/package/parent-folder) [![Code Climate](https://codeclimate.com/github/danawoodman/parent-folder/badges/gpa.svg)](https://codeclimate.com/github/danawoodman/parent-folder) > Get the name of the parent folder. For the given path return the name of the most immediate parent folder. Useful for scripts and generators where you want to use the parent folder name in some way (project naming, etc). ## Install ``` npm install --save parent-folder ``` ## Usage ```js var parentFolder = require('parent-folder'); // Assuming we're currently in: /foo/bar/index.js // Defaults to current folder of call: parentFolder() //=> 'bar' // Passing in a path to a folder: parentFolder('/some/path/here') //=> 'here' // If using in a path to a file, make sure to // pass in `true` flag as the second parameter. parentFolder('/path/to/project/file.js', true) //=> 'project' ``` Should also work on Windows. If it doesn't, please [submit an issue][issues]. ## API See [the API docs](api.md) for full documentation. ## Contributing Pull requests welcome! Please use the `.editorconfig`, `.eslintrc` configurations in your editor to ensure proper formatting. Run the test suite with `npm test` and linting with `npm run lint`, make sure tests are passing and that you write tests for new features. ## License [MIT](license) © [Dana Woodman][author] [author]: https://github.com/danawoodman [issues]: https://github.com/danawoodman/parent-folder/issues
评论
    相关推荐
    • npm
      npm install 编译和热重装以进行开发 npm run serve 编译并最小化生产 npm run build 运行测试 npm run test 整理和修复文件 npm run lint 运行单元测试 npm run test:unit 自定义配置 请参阅。
    • npm-max:NPM软件包
      最大NPM 该函数返回最大值 npm install
    • npm-exercises
      npm-exercises
    • npmTest:测试npm
      npmTest 测试npm
    • npm-lifecycle:npm生命周期脚本运行器
      npm v7发布后,将不建议使用此模块。 请不要绝对依赖它。 npm v7中使用的生命周期脚本运行程序是 。 请继续使用该模块。 npm-lifecycle 是一个独立的库,用于执行软件包的生命周期脚本。 它是从npm本身提取的,...
    • TSProjectDemo:npm ts
      TSProjectDemo:npm ts
    • npmd-install
      npmd 安装 从 npmd-resolve 树安装节点模块。 npm install - g npmd - resolve npmd - install npmd - resolve browserify | npmd - install 另外, 一个关键部分 执照 麻省理工学院
    • npm-cli-login
      npm-cli-login 允许您不使用STDIN,STDOUT登录到NPM。 在CI构建系统等地方使用。 还可以在〜/ .npmrc文件中创建/修改条目以进行身份​​验证。 安装 npm install -g npm-cli-login 使用-g标志通过CLI使用npm-cli-...
    • npm-practice
      npm-practice
    • npm:测试
      npm 测试