Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation to reflect the new organization and new features #172

Merged
merged 13 commits into from
Jan 3, 2018

Conversation

frinyvonnick
Copy link
Contributor

Prerequisites

Description

Update documentation to reflect the new organization and new features

Issue : #78

@codecov-io
Copy link

codecov-io commented Dec 15, 2017

Codecov Report

Merging #172 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #172   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          98     98           
  Lines         353    350    -3     
=====================================
- Hits          353    350    -3
Impacted Files Coverage Δ
packages/immutadot/src/util/protect.js 100% <0%> (ø) ⬆️
packages/immutadot/src/path/consts.js 100% <0%> (ø) ⬆️
packages/immutadot/src/path/apply.js 100% <0%> (ø) ⬆️
packages/immutadot/src/seq/ChainWrapper.js 100% <0%> (ø) ⬆️
packages/immutadot/src/core/unset.js 100% <0%> (ø) ⬆️
packages/immutadot/src/core/set.js 100% <0%> (ø) ⬆️
packages/immutadot/src/path/toPath.js 100% <0%> (ø) ⬆️
packages/immutadot/src/core/update.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f383dd7...56e903f. Read the comment docs.

@frinyvonnick frinyvonnick self-assigned this Dec 15, 2017
@@ -22,8 +22,11 @@ Once you have cloned the project, run `yarn` to install all the dependencies.
If you encounter trouble in the post-install phase involving `node-sass`, make sure you are building with VC++ 2013: `yarn config set msvs_version 2013`.

#### Architecture :house:
We have only one peer dependency on [lodash](https://lodash.com/) and we intend to keep it that way.<br />
immutad●t is organized in namespaces (array, collection, lang, etc.), a lot like lodash, please try to respect this organization; if you are not sure where to put your code, ask for the right place in your issue or PR.
immutad●t is managed as [monorepo](https://medium.com/netscape/the-case-for-monorepos-907c1361708a) using [lerna](https://lernajs.io/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a monorepo

immutad●t is organized in namespaces (array, collection, lang, etc.), a lot like lodash, please try to respect this organization; if you are not sure where to put your code, ask for the right place in your issue or PR.
immutad●t is managed as [monorepo](https://medium.com/netscape/the-case-for-monorepos-907c1361708a) using [lerna](https://lernajs.io/)

The main package have no peer dependency and we intend to keep it that way.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has

immutad●t is organized in namespaces (array, collection, lang, etc.), a lot like lodash, please try to respect this organization; if you are not sure where to put your code, ask for the right place in your issue or PR.
immutad●t is managed as [monorepo](https://medium.com/netscape/the-case-for-monorepos-907c1361708a) using [lerna](https://lernajs.io/)

The main package have no peer dependency and we intend to keep it that way.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most packages have no peer dependencies. Did you mean dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the best pratice when developping libraries is to put your dependencies as peer dependencies so you let host library or application choose the right version of your dependencies in case he also need them. Am i clear ?

Copy link
Contributor

@hgwood hgwood Dec 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK but when you say "it has no peer dependencies", I understand that it may have "classic" dependencies, while I guess you mean to say it has no dependencies at all, right? If you say "it has no dependencies" then I understand it has neither dependencies nor peer dependencies.


The main package have no peer dependency and we intend to keep it that way.

Each package of immutad●t is organized in namespaces (array, collection, lang, etc.), a lot like lodash, please try to respect this organization; if you are not sure where to put your code, ask for the right place in your issue or PR.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put a period between lodash and please, and another one instead of the semi-colon.

README.md Outdated
@@ -44,11 +44,11 @@ immutad●t uses plain JavaScript objects so you can access your data using stan

### Exhaustive and yet extensible

immutad●t comes with a large set of built-in utilities, mostly based on [lodash](https://lodash.com/). You haven't found what you're looking for? Do it yourself with the `convert` feature.
immutad●t comes with a large set of built-in utilities, mostly based on [ES2015+](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux). You can also found a package called [immutadot-lodash](https://github.com/Zenika/immutadot/tree/master/packages/immutadot-lodash) with some of [lodash](https://lodash.com/)'s utilities. You haven't found what you're looking for? Do it yourself with the `convert` feature.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also find

README.md Outdated
The list notation let you go trough each keys of objects used as collection or map to apply operations.

```js
toggle({ nested: { prop: { 1: { active: true }, 2: { active: false } } } }, 'nested.prop{*}.active')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to #170, this is not going to be supported right away.

README.md Outdated

### Performances

When appling operations on a path we create the minimum of objects or arrays needed to guarantee your data structure to be immutable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replace "we" with "immutadot".

@frinyvonnick
Copy link
Contributor Author

Thanks for your review @hgwood 👍 !

README.md Outdated
@@ -123,7 +123,7 @@ toLowerCase({ nested: { prop: { 1: { msg: 'Hello' }, 2: { msg: 'Hi' }, 3: { msg

### Performances

When appling operations on a path we create the minimum of objects or arrays needed to guarantee your data structure to be immutable.
When appling operations on a path immutad●t create the minimum of objects or arrays needed to guarantee your data structure to be immutable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah then "create" becomes "creates". Sorry I didn't realize that before.

jlandure
jlandure previously approved these changes Dec 19, 2017
@@ -22,8 +22,11 @@ Once you have cloned the project, run `yarn` to install all the dependencies.
If you encounter trouble in the post-install phase involving `node-sass`, make sure you are building with VC++ 2013: `yarn config set msvs_version 2013`.

#### Architecture :house:
We have only one peer dependency on [lodash](https://lodash.com/) and we intend to keep it that way.<br />
immutad●t is organized in namespaces (array, collection, lang, etc.), a lot like lodash, please try to respect this organization; if you are not sure where to put your code, ask for the right place in your issue or PR.
immutad●t is managed as a [monorepo](https://medium.com/netscape/the-case-for-monorepos-907c1361708a) using [lerna](https://lernajs.io/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would mention yarn workspaces with a link to https://yarnpkg.com/lang/en/docs/workspaces/ before lerna.

README.md Outdated
@@ -44,11 +44,11 @@ immutad●t uses plain JavaScript objects so you can access your data using stan

### Exhaustive and yet extensible

immutad●t comes with a large set of built-in utilities, mostly based on [lodash](https://lodash.com/). You haven't found what you're looking for? Do it yourself with the `convert` feature.
immutad●t comes with a large set of built-in utilities, mostly based on [ES2015+](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux). You can also find a package called [immutadot-lodash](https://github.com/Zenika/immutadot/tree/master/packages/immutadot-lodash) with some of [lodash](https://lodash.com/)'s utilities. You haven't found what you're looking for? Do it yourself with the `convert` feature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use MDN short links https://mdn.io/... which will redirect to a full URL in the user's language.
And I'd rather link to JavaScript reference instead of global objects : https://mdn.io/JavaScript/Reference

README.md Outdated

### Learning curve

If you are already familiar with [lodash](https://lodash.com/) and [ES2015+](https://github.com/tc39/ecma262#ecmascript) then you should be able to use immutad●t quickly.
If you are already familiar with [ES2015+](https://github.com/tc39/ecma262#ecmascript) and [lodash](https://lodash.com/) then you should be able to use immutad●t quickly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are using two different links for the same name "ES2015+", this one doesn't seem really appropriate, maybe use the link to MDN ?
I'm having doubts, should we really mention lodash here ?

Copy link
Contributor Author

@frinyvonnick frinyvonnick Dec 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should mention lodash because we have some features in our main packages that are directly inspired from lodash like chain, toggle, set, get, ...

README.md Outdated

### Slice notation

The slice notation let you go trough arrays to apply operations without having to map arrays at each level of imbrication.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer "The slice notation lets you iterate over arrays...", what do you think ?

README.md Outdated

### Performances

When appling operations on a path immutad●t creates the minimum of objects or arrays needed to guarantee your data structure to be immutable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appling -> applying
We have to be careful about that, immutadot doesn't actually create the minimum instances. It tries to do it, and further improvements are planned on this.
So maybe be more qualified about this ?

README.md Outdated

### List notation

The list notation let you go trough each keys of objects used as collection or map to apply operations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about "The list notation lets you iterate over the keys..."
It's not necessarily each keys...

@frinyvonnick
Copy link
Contributor Author

After a discussion with @nlepage i'll try to make our README more welcoming for newcomers.

My goals are:

  • Compare immutadot examples with ES2015+ ones
  • Use funnier data than obj.nested.prop
  • Keep examples simple by using only set and toggle to demonstrate features

@frinyvonnick
Copy link
Contributor Author

@nlepage i tried to write a more welcoming example in my last commit. What do you think about it ? Maybe it's too friendly ?

@@ -70,26 +70,113 @@ or you can directly download [sources](https://github.com/Zenika/immutadot/relea

## Usage

in browser:
ES modules:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

README.md Outdated
```

Feel free to [try immutad●t on runkit](https://npm.runkit.com/immutadot).

## Dot notation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use "Path notation" instead of "Dot notation" ?

}
]
}
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤢

Copy link
Member

@nlepage nlepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example section is a good start 👍
I think we should rewrite the top examples, especially the one with pickBy which is too complex.
Also simplify or move the examples on the path notation.

README.md Outdated
},
{
vernacularName: 'otter',
scientificName: ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely remove this line

README.md Outdated
const animals = {
weasel: [
{
vernacularName: 'badger',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to capitalize the vernacular names in the input.
It may be the occasion to quickly show the slice notation and immutadot-lodash :

import { capitalize } from 'immutadot-lodash'
const newAnimals = capitalize(animals, 'weasel[:].vernacularName')

vs

import { capitalize } from 'lodash'
const newAnimals = {
  ...animals,
  weasels: animals.weasels.map(weasel => {
    return {
      ...weasel,
      vernacularName: capitalize(weasel.vernacularName),
    }
  }),
}

README.md Outdated
set(animals, 'animals.weasel[1].scientificName', 'Lutrinae')
```

result:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't even write the result...

README.md Outdated
using immutad●t:

```js
set(animals, 'animals.weasel[1].scientificName', 'Lutrinae')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent : const newAnimals = ...

README.md Outdated

```js
const { push } = require('immutadot')
const animals = {
weasel: [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pluralize weasels ?

README.md Outdated

push({ nested: { prop: [1, 2] } }, 'nested.prop', 3, 4)
// → { nested: { prop: [1, 2, 3, 4] } }
We forgot to write down otter's scientific name. Let's set this property with the right name ```Lutrinae```.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about : "Let's add the otter's scientific name without mutating the original object structure :"

README.md Outdated
// → { nested: { prop: [1, 2, 3, 4] } }
We forgot to write down otter's scientific name. Let's set this property with the right name ```Lutrinae```.

using ES2015+:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried to have two columns with some CSS ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried. It's impossible 😢

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poor thing

@frinyvonnick
Copy link
Contributor Author

@nlepage have you an idea about List notation example to make it more meaningfull ?

immutad●t is organized in namespaces (array, collection, lang, etc.), a lot like lodash, please try to respect this organization; if you are not sure where to put your code, ask for the right place in your issue or PR.
immutad●t is managed as a [monorepo](https://medium.com/netscape/the-case-for-monorepos-907c1361708a) using [yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) and [lerna](https://lernajs.io/)

The main package has no peer dependency and we intend to keep it that way.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I had to add a dependency on babel-runtime, we should either change this sentence or remove it.

README.md Outdated
@@ -4,11 +4,11 @@
A JavaScript library to deal with nested immutable structures.

```js
push({ nested: { prop: [1, 2] } }, 'nested.prop', 3, 4)
// → { nested: { prop: [1, 2, 3, 4] } }
set({ english: { greeting: 'Hi' } }, 'nested.prop', 'Hello')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace 'nested.prop' by 'english.greeting'

README.md Outdated

pickBy({ nested: [{ a: 1, b: 2, c: 3, d: 4 }, { e: 6 }] }, 'nested.0', v => v < 3)
// → { nested: [{ a: 1, b: 2 }, { e: 6 }] }
push({ i18n: { languages: ['English', 'French'] } }, 'nested.prop', 'German', 'Spanish')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace 'nested.prop' by 'i18n.languages'

README.md Outdated

### Interoperability

immutad●t uses plain JavaScript objects so you can access your data using standard ways. Moreover, it lets you freely enjoy your favorite libraries.

### Exhaustive and yet extensible

immutad●t comes with a large set of built-in utilities, mostly based on [lodash](https://lodash.com/). You haven't found what you're looking for? Do it yourself with the `convert` feature.
immutad●t comes with a large set of built-in utilities, mostly based on [ES2015+](https://mdn.io/JavaScript/Reference). You can also find a package called [immutadot-lodash](https://github.com/Zenika/immutadot/tree/master/packages/immutadot-lodash) with some of [lodash](https://lodash.com/)'s utilities. You haven't found what you're looking for? Do it yourself with the `convert` feature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a link to convert's documentation (maybe to be replaced to a link to a getting started section) : [`convert`](https://zenika.github.io/immutadot/immutadot/1.0/core.html#.convert)

using ES2015+:

```js
import { capitalize } from 'lodash'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lodash is used in example

docs/README.md Outdated
Latest documentation is available at [zenika.github.io/immutadot](https://zenika.github.io/immutadot).
Latest documentation for our different packages are available at the following links:
- [immutadot](https://zenika.github.io/immutadot)
- [immutadot-lodash](https://zenika.github.io/immutadot-lodash)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nlepage nlepage merged commit fd43609 into master Jan 3, 2018
@nlepage nlepage deleted the enhance/doc branch January 3, 2018 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants