Catalog npm
Back to packageRELEASE DETAILS

2.2.4

npm

@0x2e757/wrappers

TypeScript variable wrapper library, transpiled to ES2015 JavaScript.

Published9 Feb 2023
Direct dependencies1
Transitive dependenciesNot calculated

README

Current package documentation

Wrappers

TypeScript variable wrapper library, transpiled to ESNext JavaScript.

Install

npm i @0x2e757/wrappers

Usage

StaticWrapper

Simple wrapper that can be used as a value container. Has derived LocalStorageWrapper and SessionStorageWrapper implementation that read and save their values to corresponding storages.

Usage example:

import { StaticWrapper } from "@0x2e757/Wrappers";

const wNumber = new StaticWrapper(0);
wNumber.subscribe(console.log);

wNumber.value = 1;
wNumber.value = 2;
wNumber.value += 3;

Console output:

1
2
5

DynamicWrapper

Advanced wrapper which contains dynamically computed value (it can not be set manually). Values are being computed only before they are going to be used.

Usage example:

import { StaticWrapper, DynamicWrapper } from "@0x2e757/Wrappers";

const wUsername = new StaticWrapper("John");
const wBalance = new StaticWrapper(100);

const wAccountInfo = new DynamicWrapper(() => `${wUsername.value} has ${wBalance.value}$.`);
wAccountInfo.subscribe(console.log);

wBalance.value -= 50;

Console output:

John has 50$.

Generic Wrapper

Helper class that dynamically will return either StaticWrapper or DynamicWrapper, depending on value type (is function or not) passed to the constructor.

Usage example:

import { Wrapper } from "@0x2e757/Wrappers";

const staticWrapper = new Wrapper(0);
const dynamicWrapper = new Wrapper(() => staticWrapper.value * 2);
dynamicWrapper.subscribe(console.log);

staticWrapper.value = 5;

Console output:

10

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^4.9.5development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-MOXSSu7mwSU3MuG8JsW1W+L4OldAr6sPBP+i31vp5J15Fm8pqFq2Aa29ldGP/iaVRUaUTXkcMc/2DLqKFteZfQ==",
  "shasum": "63d9bea07b56e182a569dc641907f190bc559525",
  "tarball": "https://registry.npmjs.org/@0x2e757/wrappers/-/wrappers-2.2.4.tgz",
  "fileCount": 23,
  "unpackedSize": 54481,
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQD6DqbJuu5Qf+72iqOrb3mat81JT6gpx+0dGI3UHVsXjwIhALMaURErMdM6E2a7vFn/e2+aHfMDhM4siNPAHoq6sCzl"
    }
  ],
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5QqhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLvA//V2Zz97eSrQjgvvy1UqwTAa0izNc0z2iGAQoJwuVnjG4pBBBG\r\nGsO8y05n9LG4E1QEie6ovu7ke3T+KrZ5nt41N/0U3dKEdc+jzwLH3f3QIfYD\r\nA66qW9VLsBLg3XXqMUW1pDP4qo7qD/QggRfZG//lJK9/0freZaUn8Sm2XFZG\r\nauM/3oa7Afw8oW4cFCQCpEtdt0TIWFE/myzugbItWP24+PyHGQ45BU13ytRz\r\nSOcaTDKnmNa1GNaZYPWDoRbiBDPzymlSQc67S7+a9zV8App4lBCjbUV+e5dd\r\ng3nAMLtrcQD3mmcdGGVnUhatdYX9UeFU0qoV+pigLztT24X6+IHxIsbP2vp9\r\nP168Fkvan+wPTqRIyLi3HJa6151TKLAnn5jwRZEagYcSJ5a5AmHKtclJw9+B\r\nAtygmjbxemFZ3qOgkHEy6DeOt6UHsnx6op30P4zAxK5dTN9eXuNyqpVMcBEO\r\nBdqcVDj7LLaVT2SFRU40F9UkscT+9T4xagmlfCOSVy2wW1VSI7IDYOumDZL+\r\nhS5Cd+/pd4X6V6Ivm51Ls5vNjbHgoGyXXwJq1vAd26dGLYQzORGyewtNQKH1\r\nbk18wjO1jCI14GAt666KWC43LzeA2NqdG1jHZVKCGuJEUsQrxIHH8y82moIi\r\nyW7q96EcfKHlkJWZ318FA4Kt09S04TllJQE=\r\n=+r4Y\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
0x2e757/wrappers

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:34 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:d3be22765a38ec7ca6cc85d93509e1083d0aa7b002bf00927b8c413dacfc448e

Other collected versions

3.0.129 Nov3.0.029 Nov2.2.625 Mar2.2.524 Mar2.2.314 Jul2.2.211 JulView all collected versions →