-
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
Changes from 6 commits
d3dd321
c8fd9b5
9d40880
2d1368a
6cd2f6a
985aed7
067e6b4
aa07a0a
ed37ddb
3a89961
cee1049
b302923
56e903f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/) | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Since I had to add a dependency on |
||
|
||
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. | ||
|
||
#### Tests and Code style :policeman: | ||
If you write any code, be sure to write the test that goes with it in a file located at the same place and named `<something>.spec.js`; we have a coverage of a :100: percent and we would like to keep it :wink:.<br /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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. |
||
|
||
### 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 commentThe 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 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, ... |
||
|
||
## Installation | ||
|
||
|
@@ -90,6 +90,41 @@ in node: | |
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Use "Path notation" instead of "Dot notation" ? |
||
|
||
immutad●t brings a few improvements to the classic dot notation: | ||
|
||
### 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 commentThe 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 ? |
||
|
||
```js | ||
add({ nested: { prop: [{ val: 1 }, { val: 2 }] } }, 'nested.prop[:].val', 1) | ||
// → { nested: { prop: [{ val: 2 }, { val: 3}] } } | ||
|
||
divide({ nested: { prop: [{ val: 1 }, { val: 2 }] } }, 'nested.prop[1:].val', 2) | ||
// → { nested: { prop: [{ val: 1 }, { val: 1}] } } | ||
|
||
multiply({ nested: { prop: [{ val: 1 }, { val: 2 }, { val: 3 }, { val: 4 }] } }, 'nested.prop[1:2].val', 2) | ||
// → { nested: { prop: [{ val: 1 }, { val: 4 }, { val: 6 }, { val: 4 }] } } | ||
``` | ||
|
||
### 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 commentThe reason will be displayed to describe this comment to others. Learn more. What about "The list notation lets you iterate over the keys..." |
||
|
||
```js | ||
toggle({ nested: { prop: { 1: { active: true }, 2: { active: false } } } }, 'nested.prop.{*}.active') | ||
// { nested: { prop: { 1: { active: false }, 2: { active: true }] } } | ||
|
||
toLowerCase({ nested: { prop: { 1: { msg: 'Hello' }, 2: { msg: 'Hi' }, 3: { msg: 'Good morning' } } } }, 'nested.prop{2, 3}.active') | ||
// { nested: { prop: { 1: { msg: 'Hello' }, 2: { msg: 'hi' }, 3: { msg: 'good morning' } } } } | ||
``` | ||
|
||
### 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 commentThe reason will be displayed to describe this comment to others. Learn more. appling -> applying |
||
|
||
## Documentation | ||
|
||
The full list of immutad●t's features is available in our [documentation](https://zenika.github.io/immutadot). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
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 commentThe 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.
I would mention yarn workspaces with a link to https://yarnpkg.com/lang/en/docs/workspaces/ before lerna.