Explain subtle difference between remove and delete action (#75)

This commit is contained in:
Doma 2022-07-09 22:54:38 +08:00 committed by GitHub
parent b392481dae
commit 6cc3894c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -234,6 +234,14 @@ function deletePost(id) {
> See also [remove](#remove).
> **`remove` or `delete`?**
>
> When the difference between `remove` and `delete` is not so obvious to you, I'd sugguest looking at their opposite actions - `add` and `create`.
> The key difference between `add` and `create` is that `add` needs a destination while `create` **requires no destination**. You `add` an item *to somewhere*, but you don't "`create` it *to somewhere*".
> Simply pair `remove` with `add` and `delete` with `create`.
>
> Explained in detail [here](https://github.com/kettanaito/naming-cheatsheet/issues/74#issue-1174942962).
### `compose`
Creates new data from the existing one. Mostly applicable to strings, objects, or functions.