argstostring

1.0.10 • Public • Published

argstostring

CircleCI

argstostring converts provided list of arguments into a single string, similiar to what console.log is doing.

USAGE

const argstostring = require("argstostring");
 
expect(argstostring()).toBe("");
 
expect(argstostring("AA", "BB", "CC", "DD")).toBe("AA BB CC DD");
 
expect(argstostring("A %f %f", 1, 2.44)).toBe("A 1 2.44");
 
const vars = [
  "AAA",
  321.123,
  22,
  44.11,
  { a: 1, b: { c: { d: "e" } } },
  { c: 3, d: 4 },
  { c: 5, d: 6 }
];
expect(argstostring("%s %f %i %d %O %o %j", ...vars)).toBe(
  'AAA 321.123 22 44.11 {"a":1,"b":{"c":{"d":"e"}}} {"c":3,"d":4} {"c":5,"d":6}'
);

more examples in index.spec.js

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i argstostring

    Weekly Downloads

    4

    Version

    1.0.10

    License

    ISC

    Unpacked Size

    8.58 kB

    Total Files

    8

    Last publish

    Collaborators

    • stormcrows