-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #172 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 98 98
Lines 353 350 -3
=====================================
- Hits 353 350 -3
Continue to review full report at Codecov.
|
.github/CONTRIBUTING.md
Outdated
@@ -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/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a monorepo
.github/CONTRIBUTING.md
Outdated
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has
.github/CONTRIBUTING.md
Outdated
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
.github/CONTRIBUTING.md
Outdated
|
||
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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".
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. |
There was a problem hiding this comment.
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.
.github/CONTRIBUTING.md
Outdated
@@ -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/) |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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...
After a discussion with @nlepage i'll try to make our README more welcoming for newcomers. My goals are:
|
17414a5
to
067e6b4
Compare
@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: |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" ?
packages/immutadot/src/index.js
Outdated
} | ||
] | ||
} | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤢
There was a problem hiding this 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: '' |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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: [ |
There was a problem hiding this comment.
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```. |
There was a problem hiding this comment.
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+: |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poor thing
@nlepage have you an idea about List notation example to make it more meaningfull ? |
.github/CONTRIBUTING.md
Outdated
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. |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prerequisites
Description
Update documentation to reflect the new organization and new features
Issue : #78