utilize

A utility library for lazy people

Usage no npm install needed!

<script type="module">
  import utilize from 'https://cdn.skypack.dev/utilize';
</script>

README

utilize

A Node.js utility library for lazy people. Provides extended functions of built-in objects.

Getting Started

Install utilize with npm

npm install utilize

Usage

<object>.p()

Prints value of object with util.print

Example
'This prints a string'.p();
' - awesome!'.p();
Result
This prints a string - awesome!

<object>.pl()

Prints line of object value with util.print

Example
'This print ends with \\r\\n'.pl()
':)'.pl()
Result
This print ends with
:)

<string>.f(o)

Format string with object or array

Arguments

o (Object|Array) - The object or array to format with

Example
'{greeting}, {place}!'.f({ greeting: 'Hello',
                           place: 'earth' });
'{0}, {1}!'.f(['Hello', 'World']);

// Dot notated and methods
'The name is {agent.lastname}, {agent.fullname}'.f({
    agent: {
        firstname: 'James',
        lastname: 'Bond',
        fullname: function() {
            return this.agent.firstname + ' '
                + this.agent.lastname;
        }
    }
});
Result
Hello, earth!
Hello, World!
The name is Bond, James Bond

<object>.recompose(str)

Format string with object or array

Arguments

str (String) - Recomposes a object of string with dot notation

Example
{
    foo: {
        bar: 'baz'
    }
}.recompose('foo.bar');
Result
baz

Contributing

You're welcome to contribute any time. Read more here

Todo

  • Add more formating functionality (iterations, booleans, etc.)
  • Make it easier and safer to extend built-in objects
  • Make it optional to use built-in vs. instance