Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ziqiangwang/js-zip
Implement zip function of python
https://github.com/ziqiangwang/js-zip
matrix python transpose zip
Last synced: 7 days ago
JSON representation
Implement zip function of python
- Host: GitHub
- URL: https://github.com/ziqiangwang/js-zip
- Owner: ZiQiangWang
- License: mit
- Created: 2017-07-04T06:27:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-09T15:06:40.000Z (over 7 years ago)
- Last Synced: 2024-11-19T00:49:14.156Z (about 2 months ago)
- Topics: matrix, python, transpose, zip
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-zip
> Implement zip function of python, used to transform a matrix,such as:
```js
[
[1,2,3],
[4,5,6],
[7,8,9]
]
```
to:
```js
[
[1,4,7],
[2,5,8],
[3,6,9]
]
```
Each row must be **iteratable object**,such as Array,String
## Installation> npm i -S js-zip
## Example
- Multi Arrays
```js
const JsZip = require('js-zip');
const a = [1,2,3];
const b = [4,5,6];
const c = [7,8,9];
const matrix = JsZip(a, b, c);
```
output matrix is:
```js
[
[1,4,7],
[2,5,8],
[3,6,9]
]
```
- Matrix
```js
const JsZip = require('js-zip');
const arr = [[1,2,3], [4,5,6], [7,8,9]];
const matrix = JsZip(...arr);
```
output matrix is:
```js
[
[1,4,7],
[2,5,8],
[3,6,9]
]
```
- String List
```js
const JsZip = require('js-zip');
const arr = ['abc', 'def', 'xyz'];
const maxtrix = JsZip(...arr);
```
output matrix is:
```js
[
[ 'a', 'd', 'x' ],
[ 'b', 'e', 'y' ],
[ 'c', 'f', 'z' ]
]
```
- Use label
```js
<script type="text/javascript" src="../dist/js-zip.min.js">(function() {
var a = [1,2,3];
var b = [4,5,6];
const maxtrix = JsZip(a,b);
})();```
## 4. LicenseMIT@[ZiQiangWang](https://github.com/ZiQiangWang).