@jasonhk/variable-name
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@jasonhk/variable-name

A utility package consists functions that used to retrieve the name of variables.

npm-version-badge npm-download-badge npm-license-badge travis-build-badge codecov-coverage-badge

Installation

Node.js

$ npm install @jasonhk/variable-name

Usage

Load the Library

CommonJS

const { getVariableName, getVariableNames } = require("@jasonhk/variable-name");

ES2015 Modules

import { getVariableName, getVariableNames } from "@jasonhk/variable-name";

Using the Library

Get the name of a variable:

const variable = 1337;

// Should return "variable"
getVariableName({ variable });

Get the names of a list of variables:

const object = { property: 1337 };
const { property } = object;

// Should return ["object", "property"]
getVariableNames(
    [
        { object },
        { property },
    ]);

License

Copyright © 2019 Jason Kwok.
Licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i @jasonhk/variable-name

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

8.78 kB

Total Files

12

Last publish

Collaborators

  • jasonhk