quotifier

1.1.1 • Public • Published

quotifier

Functions to recursively add and remove quotes to strings inside objects or arrays.

Usage

import { quotifier, unquotifier } from 'quotifier';
 
const withQuotes = quotifier({       // {
  myVariable: 'production',          //   myVariable: '"production"',
});                                  // }
 
const withoutQuotes = unquotifier([  // [
  '"production"',                    //  'production',
]);                                  // ]
 
// it will also do this recursively inside the object or array that it is given:
 
const deeperQuotes = quotifier({     // {
  myVariable: [                      //   myVariable: [
    'production',                    //     '"production"',
    {                                //     {
      'other-variable': [ 'yeah' ],  //       'other-variable': [ '"yeah"' ],
    }                                //     },
  ],                                 //   ],
  'JustBecause?': 'yup',             //   'JustBecause?': '"yup"',
});                                  // }

Why I use it

To define variables for Webpack.DefinePlugin and then re-use that code to to test the components/scripts that use those variables defined by the plugin.

Known limitations

Does not deal with any other data types aside from objects, arrays and strings... yet.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.1
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.1
    3
  • 1.1.0
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i quotifier

Weekly Downloads

3

Version

1.1.1

License

MIT

Last publish

Collaborators

  • legendary.gates