New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-lancer

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-lancer

An node logger for colorful with line info supported.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

Lancer (node util for funny)

【騎士道(きしどう)の剣(けん)に誉(ほま)れあれ! 俺(おれ)は、お前(まえ)と出会(であ)えてよかった!】 ---Lancer [Fate/zero night]

自古枪兵幸运E. lancer

Install

run this command: npm install --save

Usage

  • Example
var util = require('node-lancer');
var logger = require('node-lancer/logger');
var debug = logger('myPkg');
var colors = require('node-lancer/color');
var timestamp = require('node-lancer/timestamp');
var type = require('node-lancer/type');



Basic methods

  • md5

var md5str = util.md5('out put md5 string');

  • escapeHTML

var escapedHTML = util.escapeHTML('<div></div>');

  • unescapeHTML

var unescapedHTML =util.unescapeHTML(escapedHTML);

  • random
var randomNum = util.random(10);
var randomNum = util.random(-1, 20);
  • tripBOM

var noBOMBuffer = util.tripBOM(buffer);

  • forEach, map, every, some, filter

    same as the Array.prototype.{METHOD};

var list = util.{forEach|map|every|some|filter}(callback, /*context*/);
  • toArray, arrayOf

var arr = util.{toArray|arrayOf}(arguments); /*same as Array.of*/

  • extend, merge, clone

util.merge is same as util.extend, util.clone is link util.extend(true, {}, target); Same as jQuery.extend;

  • specialValueToNormalValue

trip special values to normal. 'NaN' => NaN 'Infinity'=> Infinity 'Null'=> null 'null'=> null 'false'=> false 'true'=> true

  • camelCase

var camelVar = util.camelCase('this-should-be-camel-cased');

  • namespace
var data = {};
var namespace = 'a.b.c';
// get val;
var val = util.namespace(data, namespace);
// overwrite old value.
util.namespace(data, namespace, 'set value')
// extend new scope data.
util.namespace(data, 'a.b', {d:'don\'t overwrite data',e:'and add this'}, true);
  • inspect, format

Copied from the node/util

  • timestamp

'YYYY': y, 'M': M, 'MM': pad(M), 'D': d, 'DD': pad(d), 'h': H%12, 'hh': pad(H%12), 'H': H, 'HH': pad(H), 'm': m, 'mm': pad(m), 's': s, 'ss':pad(s), 'S': SSS/100 | 0, 'SS': SSS/10 | 0, 'SSS': SSS, 'P': date > new Date(y,m,d,12,0,0,0) ? 'AM':'PM'

Example

var time = util.timestamp();
// output 2016-03-05 13:57:54
  • line

var lineInfo = util.line(/*number*/);

~~ Colors ~~

now using chalk instead.

Logger

Logger

Keywords

FAQs

Package last updated on 21 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc