@wrap-mutant/utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Wrap mutant. Utils

NPM Version minzip Utils solve some problems Github Issues Github Stars GitHub license Telegram

Object mutation is easy and extremelly fast. But such libraries like react make us to rebuild objects on every their change. It's not a problem on simple and small objects. When your object is a big array, your application become slow. When you are trying to handle complicated deeply nested object, it becomes a brain cancer.

Solution is in wrapping that big or complex objects into Proxy object.

Examples

reactflow example [demo | repo]

pravosleva's substring-highlight-sample [demo | repo]


This package contains utility toolbox created to simplify your life and this library usage and solve some regular problems

bindCallables

import { bindCallables } from "@wrap-mutant/utils";

Unfortunally there is a negative effect of wrapping objects into Proxy object -- the wrapped object's methods loose their's this. So, if you have wrapped the object and got an error like this is undefined -- just bind the callables. Avoid to bind callables of your target more then once

API reference:

  • Required target: any extends Object. It may be an Array or its subclass, any kind of Object, any function, any class constructor or instance

Any questions?

Don't be afraid to open this library source code -- it's really small. Also we have Telegram Community

Package Sidebar

Install

npm i @wrap-mutant/utils

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

5.79 kB

Total Files

7

Last publish

Collaborators

  • kai3341