ui
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
### API
|
||||
|
||||
All available methods
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
[](https://app.travis-ci.com/github/ecrmnn/collect.js/builds)
|
||||
[](http://badge.fury.io/js/collect.js)
|
||||
[](http://badge.fury.io/js/collect.js)
|
||||
[](http://badge.fury.io/js/collect.js)
|
||||
[](http://makeapullrequest.com)
|
||||
[](https://github.com/ecrmnn/collect.js/blob/master/package.json)
|
||||
[](https://github.com/airbnb/javascript)
|
||||
[](https://cdnjs.com/libraries/collect.js)
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
|
||||
const { readFileSync, readdirSync, writeFileSync } = require('fs');
|
||||
|
||||
// Get all markdown stubs
|
||||
const header = readFileSync('bundler/header.md', 'utf-8');
|
||||
const badges = readFileSync('bundler/badges.md', 'utf-8');
|
||||
const installation = readFileSync('bundler/installation.md', 'utf-8');
|
||||
const api = readFileSync('bundler/api.md', 'utf-8');
|
||||
const strictnessAndComparisons = readFileSync('bundler/strictness_and_comparisons.md', 'utf-8');
|
||||
const notImplemented = readFileSync('bundler/not_implemented.md', 'utf-8');
|
||||
const contribute = readFileSync('bundler/contribute.md', 'utf-8');
|
||||
const license = readFileSync('bundler/license.md', 'utf-8');
|
||||
|
||||
// Get all API docs
|
||||
const methods = readdirSync('docs/api', 'utf-8');
|
||||
|
||||
// Build table of contents
|
||||
const tableOfContents = methods.map((file) => {
|
||||
const methodName = file.replace('.md', '');
|
||||
|
||||
return `- [${methodName}](#${methodName.toLowerCase()})`;
|
||||
}).join('\n');
|
||||
|
||||
// Build methods "readme"
|
||||
const methodDocumentation = methods.map((file) => {
|
||||
let content = readFileSync(`docs/api/${file}`, 'utf-8');
|
||||
|
||||
const lines = content.split('\n');
|
||||
|
||||
lines[0] = `###${lines[0]}`;
|
||||
lines.pop();
|
||||
lines.pop();
|
||||
|
||||
content = lines.join('\n');
|
||||
content = content.replace(/(\r\n|\r|\n){2,}/g, '$1\n');
|
||||
|
||||
return content;
|
||||
}).join('\n\n');
|
||||
|
||||
writeFileSync(
|
||||
'README.md',
|
||||
[
|
||||
header,
|
||||
badges,
|
||||
installation,
|
||||
api,
|
||||
tableOfContents,
|
||||
strictnessAndComparisons,
|
||||
notImplemented,
|
||||
methodDocumentation,
|
||||
contribute,
|
||||
license,
|
||||
].join('\n\n'),
|
||||
);
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
### Contribute
|
||||
|
||||
PRs are welcomed to this project, and help is needed in order to keep up with the changes of Laravel Collections. If you want to improve the collection library, add functionality or improve the docs please feel free to submit a PR.
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# <img src="https://raw.githubusercontent.com/ecrmnn/collect.js/master/collectjs.jpg" alt="collect.js">
|
||||
|
||||
> Convenient and dependency free wrapper for working with arrays and objects
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
### Installation
|
||||
|
||||
#### NPM
|
||||
|
||||
```bash
|
||||
npm install collect.js --save
|
||||
```
|
||||
|
||||
#### Yarn
|
||||
|
||||
```bash
|
||||
yarn add collect.js
|
||||
```
|
||||
|
||||
#### From CDN
|
||||
|
||||
1. Visit https://cdnjs.com/libraries/collect.js
|
||||
2. Add CDN link to your site with `<script>`
|
||||
|
||||
#### Using build / minified version
|
||||
|
||||
1. Download [`collect.min.js`](https://github.com/ecrmnn/collect.js/blob/master/build/collect.min.js)
|
||||
2. Add to your site with `<script>`
|
||||
|
||||
### Tip
|
||||
|
||||
Using Laravel as your backend? Collect.js offers an (almost) identical api to [Laravel Collections](https://laravel.com/docs/master/collections). [See differences](#strictness-and-comparisons).
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
### License
|
||||
|
||||
MIT © [Daniel Eckermann](https://danieleckermann.com)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
##### Methods that have not been implemented:
|
||||
|
||||
- ~~`containsStrict`~~ use `contains()`
|
||||
- ~~`duplicatesStrict`~~ use `duplicates()`
|
||||
- ~~`uniqueStrict`~~ use `unique()`
|
||||
- ~~`whereStrict`~~ use `where()`
|
||||
- ~~`whereInStrict`~~ use `whereIn()`
|
||||
- ~~`whereNotInStrict`~~ use `whereNotIn()`
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
### Strictness and comparisons
|
||||
|
||||
All comparisons in `collect.js` are done using strict equality. Using loose equality comparisons are generally frowned upon in JavaScript. Laravel only performs "loose" comparisons by default and offer several "strict" comparison methods. These methods have not been implemented in `collect.js` because all methods are strict by default.
|
||||
Reference in New Issue
Block a user