https://github.com/dy/swizz
Provide swizzles for an array
https://github.com/dy/swizz
Last synced: 5 months ago
JSON representation
Provide swizzles for an array
- Host: GitHub
- URL: https://github.com/dy/swizz
- Owner: dy
- Created: 2019-08-07T02:03:02.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-07T02:14:24.000Z (almost 7 years ago)
- Last Synced: 2025-04-01T00:34:15.939Z (about 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# swizz [](https://travis-ci.org/dy/swizz)
Provide swizzles for arrays, like GLSL.
[](https://npmjs.org/package/swizz/)
```js
import swizzle from 'swizz'
let arr = swizzle([0, 1, 2, 3])
arr.zyx = arr.xyz
arr // [2, 1, 0, 3]
```
Supported swizzles: `xyzw`, `stpd`, `rgba`.
Uses _Proxy_ under the hood.
## Related art
* [negative-array](https://ghub.io/negative-array)
* [known](https://ghub.io/known)
* [on-change](https://ghub.io/on-change)
## Refs
* [Metaprogramming with proxies](https://exploringjs.com/es6/ch_proxies.html)
HK