0.0.1 • Published 11 years ago
utilize v0.0.1
utilize
A Node.js utility library for lazy people. Provides extended functions of built-in objects.
Getting Started
Install utilize with npm
npm install utilizeUsage
<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
bazContributing
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
0.0.1
11 years ago