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-depscascadifyuploadr@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@cobalt-engine/co-browserifycovertbrowserify-blentedbrowserify-fbrowserify-debufbrowserify-kinegraphxbrowserify-lite2browser-unixbrowserify-windows-fixebit-bincordova-plugin-amplify-paycordova-plugin-amplify-paymentconferconfusebuntbowserifydistify@rstacruz/pnpm@sammacbeth/webextify@sammacbeth/browserify@novembrecom/zxcvbn@pirxpilot/browserify@pirxpilot/module-deps@zdychacek/module-deps@zdychacek/browserify-babylon@victorlizarraga/bit-javascript@xhonker/deploy@soapdog/webextifybalm-corebit-javascriptbcx-browserify
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