1.0.1 • Published 10 years ago

parents v1.0.1

Weekly downloads
891,762
License
MIT
Repository
github
Last release
10 years ago

parents

Return all the parent directories of a directory, inclusive of that directory.

build status

example

dirname

var parents = require('parents');
var dirs = parents(__dirname);
console.dir(dirs);

[ '/home/substack/projects/node-parents/example',
  '/home/substack/projects/node-parents',
  '/home/substack/projects',
  '/home/substack',
  '/home',
  '/' ]

win32

var parents = require('parents');
var dir = 'C:\\Program Files\\Maxis\\Sim City 2000\\cities';

var dirs = parents(dir, { platform : 'win32' });
console.dir(dirs);

[ 'C:\\Program Files\\Maxis\\Sim City 2000\\cities',
  'C:\\Program Files\\Maxis\\Sim City 2000',
  'C:\\Program Files\\Maxis',
  'C:\\Program Files',
  'C:' ]

methods

var parents = require('parents')

parents(dir, opts)

Return an array of the parent directories of dir, including and starting with dir. If a dir isn't specified, process.cwd() will be used.

Optionally specify an opts.platform to control whether the separator and paths works the unixy way with '/' or the windowsy way where sometimes things use '/' and sometimes they use '\\' and also there are leading drive letters and other exotic features. If opts.platform isn't specified, process.platform will be used. Anything that matches /^win/ will use the windowsy behavior.

install

With npm do:

npm install parents

licence

MIT

browserifybit-binwenke-browserifyencrypto-browserify@infinitebrahmanuniverse/nolb-pare@everything-registry/sub-chunk-2409tanngoreactjs-github-widgetvideo-multi-uploadermodule-depsmodule-deps-disklessmodule-deps-sortable-2itapekountexamplekomgulp-clientlibifygulp-clientlibify-mirumgulp-clientlibs-mirumgulp-fez-sftpgulp-sftp-socksv5gulp-sftp-up4gulp-sftp-up5gulp-sftp-up5-hjfgulp-sftp-with-callbacksgulp-sftpgulp-sftp-cleangulp-sftp-fixgulp-sftp-hdhgulp-sftp-keyboardgulp-sftp-newgulp-ssh-uploadgulp-vsftpgulp-vsftpprogupackgulp-ftpgulp-docker-destmy-build-servepackagerootowt-client-javascriptprojectspotternguyenfs-config-resolverpc-build-serverpeerdepreact-native-firebase-messagingnode-serverifynode-sftp-deploynode-sftp-deploy-inode-sftp-deploy2raynos-browserifyraynost-browserifysourcessftp-client@cljs-oss/module-depsuploadr@foxtail/gulp-sftp-up4@leichtgewicht/browserify@makeomatic/browserify@mapbox/check-file-dependencies@naiverlabs/browserify@naiverlabs/module-deps@nodeframe/config-resolver@mlie/quick-cli@jzetlen/bowserify@jimbly/browserify@juancarlosrmr/node-sftp-deploy-sp@inesfidalgo/forge@sammacbeth/webextify@sammacbeth/browserify@novembrecom/zxcvbn@pirxpilot/browserify@pirxpilot/module-deps@soapdog/webextify@cobalt-engine/co-browserify@rstacruz/pnpm@zdychacek/browserify-babylon@zdychacek/module-deps@xhonker/deploy@victorlizarraga/bit-javascriptcordova-plugin-amplify-paycordova-plugin-amplify-paymentconferconfusedistifyebit-binbcx-browserifybowserifybit-javascriptbalm-coreapp-build-serverbrowserify-debufbrowserify-fbrowserify-blentedbrowserify-kinegraphxbrowserify-lite2browserify-windows-fixbrowser-unixcascadifybunt
1.0.1

10 years ago

1.0.0

10 years ago

0.0.3

10 years ago

0.0.2

11 years ago

0.0.1

12 years ago

0.0.0

12 years ago