Skip to content

Commit

Permalink
lib/remove: removed alias 'delete()'
Browse files Browse the repository at this point in the history
  • Loading branch information
jprichardson committed Aug 28, 2015
1 parent 25c1985 commit 955836b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 43 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,7 @@ console.log(obj) // => null

Removes a file or directory. The directory can have contents. Like `rm -rf`.

Alias: `delete()`

Sync: `removeSync()` / `deleteSync()`
Sync: `removeSync()`


Examples:
Expand Down Expand Up @@ -489,7 +487,7 @@ We have a dilemma though. How do you consistently name methods that perform the

My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too.

So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)` or its alias `fs.delete(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`.
So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`.


Credit
Expand Down
35 changes: 0 additions & 35 deletions lib/remove/__tests__/remove-alias.test.js

This file was deleted.

5 changes: 1 addition & 4 deletions lib/remove/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ function remove (dir, callback) {

module.exports = {
remove: remove,
removeSync: removeSync,
// alias
delete: remove,
deleteSync: removeSync
removeSync: removeSync
}

0 comments on commit 955836b

Please sign in to comment.