Coder Social home page Coder Social logo

lazylog's Introduction

Lazy Log

A simple wrapper for console.log that does some fun stuff.

A fun logger

  • This module is a wrapper around console.log.
  • The available functions all use a chainable syntax.
  • If a string is passed to one of the functions, it will log out the transformed string.
  • If an object is passed to one of the functions, it will log out all of the values and transform each one. The key is not currently logged. if an array is passed to one of the functions, it will loop over the array and either log the string or act on it in the manner mentioned above if it is an object.

Installation and Setup

npm install lazy-log
var ll = require('lazy-log');

Examples

ll.log('This is a simple log');
ll.log({foo: 'bar'});
ll.log(['Test', 'baz', {foo: 'bar'}]);

Results

  • This is a simple log
// Simple examples of other log functions
ll.toLower('TEST');
ll.toLower({name: 'JOHN DOE'});
ll.toLower(['ONE', 'TWO', 'THREE']);

Results

  • test
  • john doe
  • one
  • two
  • three

```javascript
ll.toUpper('test');
ll.toUpper({name: 'john doe'});
ll.toUpper(['one', 'two', 'three']);

Results

  • TEST
  • JOHN DOE
  • ONE
  • TWO
  • THREE
ll.log('test simple').toLower('TEST').toUpper('test');

Results

  • test simple
  • test
  • TEST
ll.toLower(['TEST', {a: 'MAKE LOWER'}, [{a:'AAA', b: ['BBB', {c: 'CCC'}]}]]);

#### Results
+ test
+ make lower
+ aaa
+ bbb
+ ccc
ll.toLower(['TEST', {a: 'MAKE LOWER'}]).toUpper('test').toUpper([{a: 'aaa'}]);

Results

  • test
  • make lower
  • TEST
  • AAA
ll.toArr(['Test', {a: 'b', foo: 'bar'}, {c: ['NEWS', {test: 'apple'}]}]);

Results

  • [ 'Test', 'b', 'bar', 'NEWS', 'apple' ]
ll.reg('This is my message that I am looking for the word "message"', /message/i);
ll.reg('This is my message that I am looking for the word "message"', /message/g);
ll.reg({test: 'message', b: 'this is a message - message'}, /message/g);

Results

  • [ 'message', index: 11, input: 'This is my message that I am looking for the word "message"' ]
  • [ 'message', 'message' ]
  • [ 'message' ]
  • [ 'message', 'message' ]

To the Community

I will probably be adding some more functions some, but adding new functionality is super easy. Check out the code, do pull requests, and let me know if you have any questions.

lazylog's People

Contributors

dahs81 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.