0.0.2 • Published 4 years ago

@jasonhk/variable-name v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

@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.