55

Recreating Python's Slice Syntax in JavaScript Using ES6 Proxies

 5 years ago
source link: https://intoli.com/blog/python-slicing-in-javascript/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Slice is a JavaScript library on npm that brings Python's extended slice syntax and negative indexing to JavaScript. This write-up explains in detail how Slice was built using ES6 Proxies, and serves as an interesting use-case of how you can use the Proxy object to build creative APIs.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK