Catalog npm
Back to packageRELEASE DETAILS

1.1.0

npm

@0x2e757/wrappers

TypeScript variable wrapper library, transpiled to ES2015 JavaScript.

Published30 Dec 2020
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.1.3development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-gY6SJh1Oa1mnJrs9MiMRAlPBN6jfQhiHMqtd6D/0Sl3gWt9baYaZe7Uzu1CxBLQga3hoOKcX5k2QkQeH6QfxKg==",
  "shasum": "737d7103e4cb0a74af744fc9751dc535370731c4",
  "tarball": "https://registry.npmjs.org/@0x2e757/wrappers/-/wrappers-1.1.0.tgz",
  "fileCount": 10,
  "unpackedSize": 46766,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf7MLECRA9TVsSAnZWagAA5noP/jtDfeDAngb4FhFAVsk4\noIfdRI8uTC/vJ8VkYZIEycCvnANxsI1xQJVq2c9rSaVnx4TCVzsS/y3K4G4A\noE4LsXYskmINSwQjaUj8vsTeQy/bsqW568Vvt5P4uaQuDN16LzpVwpxNPW+T\nDtnfo+zslRJ7VVpfV+hqhnRf/s4+ft6PjvHxzSIBS5pk31xBjSvgHTOZuU81\nBYxoV4+mCcnzBt3gqPP7E+43CfMQFNzli/lGlv3qkR6d4l7W7JcQq5UEMiIU\nrWT4VPB1Dr5iQSXsE6V7j9BoloXomQm3An4GgP8ZxC87/yp4isE/XwuVq875\nsrC1WBlPqrT2qawZDQRulLqS0GJHbvs86sgDPjxDpCWmY/PHg8+NrkqIU0VW\n0xy4YdtMLfiIfI1vL+JMwqYFAzBk7DR577wBe+QXEP+FKFZDMXItHdqYdrm/\nvKtT8KJVoyYQbT/Suswsj4aUlUb3flWqLzn9mvS8OB5qRYRWGKKaTjo/EuHt\n6LBW8E0tj19DM8znISDkJO2lSZ9wkM+Q/BA1+xdfINXP684SrEQrlBfIA6Iq\nQ/14QKIf+i8RPG5W0KNL41E+IS3a74XyOq1VO+g7wFxElZ+VxM/JNs8tBvDH\nQVB58UHH61qBF1HFEvP3f9HPjHcFfASAn0MaK+ZxPCNgfujXOX35hINEZ5ZZ\n4wub\r\n=WX55\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQD1tZmzTKeP8SKMCDn0kjGG7ZBHizgiT1n3Kyy8Ta2KEwIhAJnucvFz5QBCNaY4/omGZ6vr0WqRFdBEH1lT28EIGJ6R"
    }
  ]
}

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:2aed0819b32f7ab0da29de8d68cacd66ed755ef8f35d2d2e531b3090e2b9eb7c

Other collected versions

3.0.129 Nov3.0.029 Nov2.2.625 Mar2.2.524 Mar2.2.49 Feb2.2.314 JulView all collected versions →