Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-toolbox - npm Package Compare versions

Comparing version 0.0.17 to 0.1.0

129

main.js

@@ -1,3 +0,5 @@

// standardjs
/* global Blob File FormData $ */
if (typeof module !== 'undefined' && module.exports) {
var crypto = require('crypto')
}

@@ -21,60 +23,2 @@ var tools = {

/**
* @constructor
* @param {Object} params
* @param {String[]|string} params.segments enabled segments or '*' for all
* @param {String[]|string} params.segments enabled level or '*' for all; levels are: info, warning, error
*/
Log: function (params) {
var __segments
var __levels
var __browser
var MARKER_SUCCESS, MARKER_ERROR, MARKER_INFO, MARKER_WARNING
var __init = function (params) {
__segments = params.segments
__levels = params.levels
__browser = tools.core.onBrowser()
// @todo const __mode = params.mode console, file, email ...
MARKER_SUCCESS = '✔' // ✔ ✔️
MARKER_ERROR = '✗️'
MARKER_INFO = 'ℹ️'
MARKER_WARNING = '❗️️'
if (!__browser) {
var colors = require('colors')
MARKER_SUCCESS = colors.green(MARKER_SUCCESS)
MARKER_ERROR = colors.red(MARKER_ERROR)
MARKER_INFO = colors.blue(MARKER_INFO)
MARKER_WARNING = colors.yellow(MARKER_WARNING)
} else {
}
}
var verbose = function (segment, level) {
if ((__segments === '*' || tools.array.contains(__segments, segment)) &&
(__levels === '*' || tools.array.contains(__levels, level))) {
var _args = Array.prototype.slice.call(arguments)
if (level === tools.Log.level.ERROR) {
_args[1] = MARKER_ERROR
console.error.apply(console, _args)
} else if (level === tools.Log.level.WARNING) {
_args[1] = MARKER_WARNING
console.warn.apply(console, _args)
} else if (level === tools.Log.level.SUCCESS) {
_args[1] = MARKER_SUCCESS
console.log.apply(console, _args)
} else {
_args[1] = MARKER_INFO
console.log.apply(console, _args)
}
}
}
__init(params)
return {
verbose: verbose
}
},
/**
* array utils, inspired to goog.array

@@ -221,4 +165,4 @@ */

* @param {number} [length=8]
* @param {Array} [set=qwertyuiopasdfghjklzxcvbnm]
* @return {String}
* @param {Array} [set=abcdefghijklmnopqrstuvwxyz]
* @return {string}
*/

@@ -230,3 +174,3 @@ string: function (length, set) {

if (!set) {
set = 'qwertyuiopasdfghjklzxcvbnm'
set = 'abcdefghijklmnopqrstuvwxyz'
}

@@ -242,3 +186,3 @@ var _str = ''

* @param {number} [length=8]
* @return {String}
* @return {string}
*/

@@ -250,5 +194,20 @@ hex: function (length) {

return tools.random.string(length, '0123456789abcdef')
},
hash: function () {
return tools.hash.sha256(new Date().toISOString())
}
},
hash: {
/**
* @param {string} data
* @return {string}
*/
sha256: function (data) {
return crypto.createHash('sha256')
.update(data)
.digest('hex')
}
},
object: {

@@ -308,2 +267,5 @@ /**

getKeys: function (obj) {
if (Object.keys) {
return Object.keys(obj)
}
var _keys = []

@@ -327,5 +289,23 @@ for (var key in obj) {

return _obj
},
/**
* @todo properly
*/
apply: function (source, destination, schema) {
let _properties
if (schema) {
switch (schema.template) {
// @todo create template dir
case 'EventEmitter':
_properties = ['on', 'once', 'removeAllListeners', 'removeListener']
}
}
// else if template is array ..
_properties.forEach((property) => {
destination[property] = function () {
source[property].apply(source, arguments)
}
})
}
},
/**

@@ -599,25 +579,4 @@ * async parallel task manager

// enums
tools.Log.level = {
ERROR: 'ERROR',
WARNING: 'WARNING',
INFO: 'INFO',
SUCCESS: 'SUCCESS'
}
// compatibilty < 0.0.10 - to remove
tools.tasks = tools.Tasks
String.prototype.replaceAll = function (from, to) {
console.warn('String.replaceAll is deprecated, please use tools.string.replaceAll')
return tools.string.replaceAll(this, from, to)
}
String.prototype.capitalize = function () {
console.warn('String.capitalize is deprecated, please use tools.string.capitalize')
return tools.string.capitalize(this)
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = tools
}
{
"name": "a-toolbox",
"version": "0.0.17",
"description": "lightweight tools",
"version": "0.1.0",
"description": "basic lightweight tools",
"main": "main.js",
"devDependencies": {
"faker": "x",
"tap": "x"
},
"engines": {
"node": ">= 4"
},
"files": [
"main.js"
],
"repository": {
"type": "git",
"url": "git://github.com/simone-sanfratello/a-toolbox.git"
},
"keywords": [

@@ -15,30 +30,4 @@ "tools",

],
"url": "http://github.com/simone-sanfratello/a-toolbox",
"author": "Simone Sanfratello <simone.sanfra@gmail.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/simone-sanfratello/a-toolbox.git"
},
"engines": {
"node": ">= 0.10.x"
},
"scripts": {
"test": "istanbul cover test.js -x test.js",
"doc": "jsdoc -c jsdoc.json -R README.md"
},
"tonicExampleFilename": "test.js",
"files": [
"main.js",
"test.js"
],
"main": "main",
"dependencies" : {
"colors": "x"
},
"devDependencies": {
"standard": "x",
"istanbul": "x",
"ink-docstrap": "x"
}
}
"license": "MIT"
}

@@ -9,7 +9,5 @@ # a-toolbox

[![PayPayl donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MRV4AM2CA9F78 "Donate using Paypal")
[![NPM](https://nodei.co/npm-dl/a-toolbox.png)](https://nodei.co/npm/a-toolbox/)
Javascript lightweight tools
Javascript isomorphic lightweight tools

@@ -44,3 +42,3 @@ > "This is my rifle. There are many others like it, but this one is mine."

#### tasks async manage (no promises)
#### tasks async manage

@@ -271,3 +269,3 @@ ```js

Copyright (c) 2015-2016 Simone Sanfratello
Copyright (c) 2015-2017 Simone Sanfratello

@@ -274,0 +272,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

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