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 1.2.10 to 1.2.12

19

gulpfile.js

@@ -8,2 +8,3 @@ const gulp = require('gulp')

const sourcemaps = require('gulp-sourcemaps')
const exec = require('child_process').exec

@@ -22,2 +23,3 @@ const _files = [

]
const _nobrowser = ['sys', 'fs']

@@ -33,5 +35,5 @@

_files
.filter(f => _nobrowser.indexOf(f) === -1)
.map(f => `${f}: require('./${f}')`)
.join(',\n') + '\n}'
.filter(f => _nobrowser.indexOf(f) === -1)
.map(f => `${f}: require('./${f}')`)
.join(',\n') + '\n}'
fs.ensureDirSync('./dist')

@@ -44,7 +46,7 @@ fs.writeFileSync('./src/_index.js', _index)

})
.transform('babelify', {
presets: ['es2015', 'env'],
minified: true,
comments: false
})
.transform('babelify', {
presets: ['es2015', 'env'],
minified: true,
comments: false
})

@@ -69,2 +71,3 @@ return b.bundle()

fs.writeFileSync('./index.js', _index)
exec('standard --fix ./index.js')
return gulp.src('src/**.js')

@@ -71,0 +74,0 @@ .pipe(gulp.dest('./'))

module.exports = {array: require('./array'),
fs: require('./fs'),
hash: require('./hash'),
object: require('./object'),
random: require('./random'),
string: require('./string'),
sys: require('./sys'),
task: require('./task'),
time: require('./time'),
util: require('./util')}
fs: require('./fs'),
hash: require('./hash'),
object: require('./object'),
random: require('./random'),
string: require('./string'),
sys: require('./sys'),
task: require('./task'),
time: require('./time'),
util: require('./util')}

@@ -73,2 +73,3 @@ /**

* @test.case {a: 4, b: 'ciao', c: { d: 8, e: 9 }} > {a: 4, b: 'ciao', c: { d: 8, e: 9 }}
* @test.case {a: [4, function() { console.log('hi') }, {a1: 0, a2: null}], b: 'ciao', c: { d: 8, e: 9 }} > {a: [4, function() { console.log('hi') }, {a1: 0, a2: null}], b: 'ciao', c: { d: 8, e: 9 }}
*/

@@ -75,0 +76,0 @@ clone: function (obj) {

{
"name": "a-toolbox",
"version": "1.2.10",
"version": "1.2.12",
"description": "javascript lightweight basic tools, isomorphic",

@@ -22,9 +22,12 @@ "main": "index.js",

"ink-docstrap": "^1.x",
"standard": "^10.x",
"pre-commit": "^1.x",
"standard": "^11.x",
"tap": "^10.x",
"tollo": "^0.0.3-dev",
"vinyl-source-stream": "^1.x"
},
"engines": {
"node": ">=6"
},
"pre-commit": [
"test",
"build"
],
"scripts": {

@@ -35,4 +38,4 @@ "test": "standard && tap test/tdd.js",

"clean": "gulp clean",
"doxdox": "mkdir -p doc/doxdox; doxdox './src/*.js' --layout markdown --output ./doc/README.md",
"jsdoc": "jsdoc -c doc/jsdoc.json -t ./node_modules/ink-docstrap/template -R README.md src/*.js"
"_doxdox": "mkdir -p doc/doxdox; doxdox './src/*.js' --layout markdown --output ./doc/README.md",
"_jsdoc": "jsdoc -c doc/jsdoc.json -t ./node_modules/ink-docstrap/template -R README.md src/*.js"
},

@@ -42,5 +45,9 @@ "standard": {

"test/",
"src/_old/"
"_test/",
"src/_*"
]
},
"engines": {
"node": ">=6"
},
"repository": {

@@ -47,0 +54,0 @@ "type": "git",

@@ -60,4 +60,2 @@ # a-toolbox

documentation in progress
- [array](#array)

@@ -73,5 +71,3 @@ - [fs](#fs)

- [task](#task)
todo
### array

@@ -770,2 +766,5 @@

- [ ] unit test via tollo
- [ ] pre-commit: ``npm test && npm run build``
- [ ] travis CI / node, browser
- [ ] coverage badge / coverage 100%

@@ -772,0 +771,0 @@ ---

@@ -73,2 +73,3 @@ /**

* @test.case {a: 4, b: 'ciao', c: { d: 8, e: 9 }} > {a: 4, b: 'ciao', c: { d: 8, e: 9 }}
* @test.case {a: [4, function() { console.log('hi') }, {a1: 0, a2: null}], b: 'ciao', c: { d: 8, e: 9 }} > {a: [4, function() { console.log('hi') }, {a1: 0, a2: null}], b: 'ciao', c: { d: 8, e: 9 }}
*/

@@ -75,0 +76,0 @@ clone: function (obj) {

@@ -16,3 +16,3 @@ const time = require('./time')

/**
/**
* add task

@@ -30,8 +30,8 @@ * @method Tasks.todo

/**
* declare task it's done
* @method Tasks.todo
* @param {!string} id
* @test.case 'task#1'
*/
/**
* declare task it's done
* @method Tasks.todo
* @param {!string} id
* @test.case 'task#1'
*/
this.done = function (id) {

@@ -38,0 +38,0 @@ array.remove(__tasks, id)

@@ -16,2 +16,3 @@ const util = {

onBrowser: function () {
// eslint-disable-next-line no-undef
return (typeof window === 'object' && window instanceof Window)

@@ -18,0 +19,0 @@ }

@@ -16,3 +16,3 @@ const time = require('./time')

/**
/**
* add task

@@ -30,8 +30,8 @@ * @method Tasks.todo

/**
* declare task it's done
* @method Tasks.todo
* @param {!string} id
* @test.case 'task#1'
*/
/**
* declare task it's done
* @method Tasks.todo
* @param {!string} id
* @test.case 'task#1'
*/
this.done = function (id) {

@@ -38,0 +38,0 @@ array.remove(__tasks, id)

@@ -1,2 +0,2 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/array.js')

@@ -11,2 +11,6 @@

{
input: [[\'js\',\'ruby\',\'python\'], \'ruby\'],
output: [\'js\',\'python\']
},
{
input: [[1,2,3], 2],

@@ -18,6 +22,2 @@ output: [1,3]

output: [1,2]
},
{
input: [['js','ruby','python'], 1],
output: ['js','python']
}

@@ -105,7 +105,7 @@ ],

{
input: [[0,1,'0',false], -2],
output: '0'
input: [[0,1,\'0\',false], -2],
output: \'0\'
},
{
input: [[undefined,'0',false], 0],
input: [[undefined,\'0\',false], 0],
output: undefined

@@ -142,3 +142,3 @@ },

{
input: [[undefined,'0',false]],
input: [[undefined,\'0\',false]],
output: undefined

@@ -158,2 +158,10 @@ },

cases: [
{
input: [[1,2,3], 1],
output: true
},
{
input: [[1,2,3], 4],
output: false
}
],

@@ -168,16 +176,16 @@ assert: tester.assert.equal

{
input: [['john', 'alice', 'bob'], 0, 'mary'],
output: ['mary', 'john', 'alice', 'bob']
input: [[\'john\', \'alice\', \'bob\'], 0, \'mary\'],
output: [\'mary\', \'john\', \'alice\', \'bob\']
},
{
input: [['john', 'alice', 'bob'], 1, 'mary'],
output: ['john', 'mary', 'alice', 'bob']
input: [[\'john\', \'alice\', \'bob\'], 1, \'mary\'],
output: [\'john\', \'mary\', \'alice\', \'bob\']
},
{
input: [['john', 'alice', 'bob'], -1, 'mary'],
output: ['john', 'alice', 'bob', 'mary']
input: [[\'john\', \'alice\', \'bob\'], -1, \'mary\'],
output: [\'john\', \'alice\', \'bob\', \'mary\']
},
{
input: [['john', 'alice', 'bob'], -2, 'mary'],
output: ['john', 'alice', 'mary', 'bob']
input: [[\'john\', \'alice\', \'bob\'], -2, \'mary\'],
output: [\'john\', \'alice\', \'mary\', \'bob\']
}

@@ -197,4 +205,4 @@ ],

{
input: [[0, 1, 2, 3], ['a', 'b', 'c'], [{a: 2}]],
output: [0, 1, 2, 3, 'a', 'b', 'c', {a: 2}]
input: [[0, 1, 2, 3], [\'a\', \'b\', \'c\'], [{a: 2}]],
output: [0, 1, 2, 3, \'a\', \'b\', \'c\', {a: 2}]
}

@@ -225,5 +233,9 @@ ],

cases: [
{
input: [[0,1,2,3], 3, true],
output: [0,1,2,3]
}
],
assert: tester.assert.equal
assert: tester.assert.mutation
}
}

@@ -1,2 +0,2 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/fs.js')

@@ -11,11 +11,11 @@

{
input: ['/tmp/file'],
input: [\'/tmp/file\'],
output: true
},
{
input: ['/tmp/none'],
input: [\'/tmp/none\'],
output: false
},
{
input: ['/tmp'],
input: [\'/tmp\'],
output: false

@@ -39,7 +39,7 @@ }

{
input: ['/none'],
throw: new Error('EACCES')
input: [\'/tmp/touch-me\']
},
{
input: ['/tmp/touch-me']
input: [\'/none\'],
could: 'new Error(\'EACCES\''
}

@@ -64,10 +64,10 @@ ],

{
input: ['/tmp/file']
input: [\'/tmp/file\']
},
{
input: ['/tmp/none', false],
throw: new Error('EACCES')
input: [\'/tmp/none\', false],
could: 'new Error(\'EACCES\''
},
{
input: ['/tmp/none', true]
input: [\'/tmp/none\', true]
}

@@ -74,0 +74,0 @@ ],

@@ -1,2 +0,2 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/hash.js')

@@ -10,2 +10,10 @@

cases: [
{
input: [\'usk6fgbuygbu6\'],
output: \'ee42f619919727584b66fe25248ed4bba8e87dcfb3e62a90143ea17ba48df58e\'
},
{
input: [\'lorem ipsum %1283770tv8gv 6c6fgw ucthv iy\'],
output: \'18d18c26ed98c0e88d9121132be48f42596e899ac50f15f854c9d0a82b9f2cb5\'
}
],

@@ -12,0 +20,0 @@ assert: tester.assert.equal

@@ -1,5 +0,24 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/object.js')
module.exports = {
'object.flat': {
describe: '',
mode: tester.mode.SYNC,
act: instance.flat,
cases: [
{
input: [{ a: { a1: 1, a2: 2 }, b: 3 }],
output: { \'a.a1\': 1, \'a.a2\': 2, \'b\': 3 }
}
],
assert: tester.assert.equal
},
'object._rflat': {
describe: '',
mode: tester.mode.SYNC,
act: instance._rflat,
cases: [
]
},
'object.merge': {

@@ -11,4 +30,4 @@ describe: '',

{
input: [{a: 1, b: 'ciao'}, {a: 4, c: { d: 8, e: 9}}],
output: { a: 4, b: 'ciao', c: { d: 8, e: 9 } }
input: [{a: 1, b: \'ciao\'}, {a: 4, c: { d: 8, e: 9}}],
output: { a: 4, b: \'ciao\', c: { d: 8, e: 9 } }
}

@@ -23,2 +42,18 @@ ],

cases: [
{
input: [{a: 1, b: \'ciao\'}],
output: {a: 1, b: \'ciao\'}
},
{
input: [{a: 4, c: { d: 8, e: 9}}],
output: {a: 4, c: { d: 8, e: 9}}
},
{
input: [{a: 4, b: \'ciao\', c: { d: 8, e: 9 }}],
output: {a: 4, b: \'ciao\', c: { d: 8, e: 9 }}
},
{
input: [{a: [4, function() { console.log(\'hi\') }, {a1: 0, a2: null}], b: \'ciao\', c: { d: 8, e: 9 }}],
could: '{a: [4, function() { console.log(\'hi\') }, {a1: 0, a2: null}], b: \'ciao\', c: { d: 8, e: 9 }}'
}
],

@@ -32,2 +67,6 @@ assert: tester.assert.equal

cases: [
{
input: [{a: () => { }, b: 1, c: \'ciao\'}],
output: [\'a\',\'b\',\'c\']
}
],

@@ -41,4 +80,8 @@ assert: tester.assert.equal

cases: [
{
input: [{}, {f0: () => { }, p1: 1, p2: \'ciao\'}],
output: {f0: () => { }, p1: 1, p2: \'ciao\'}
}
],
assert: tester.assert.equal
assert: tester.assert.mutation
},

@@ -61,38 +104,2 @@ 'object.empty': {

},
'_f.flat': {
describe: '',
mode: tester.mode.SYNC,
act: instance.flat,
cases: [
{
input: [{ a: { a1: 1, a2: 2 }, b: 3 }],
output: { 'a.a1': 1, 'a.a2': 2, 'b': 3 }
}
],
assert: tester.assert.equal
},
'object.flat': {
describe: '',
mode: tester.mode.SYNC,
act: instance.flat,
cases: [
{
input: [{ a: { a1: 1, a2: 2 }, b: 3 }],
output: { 'a.a1': 1, 'a.a2': 2, 'b': 3 }
}
],
assert: tester.assert.equal
},
'_f.raise': {
describe: '',
mode: tester.mode.SYNC,
act: instance.raise,
cases: [
{
input: [{ 'a.a1': 1, 'a.a2': 2, 'b': 3 }],
output: { a: { a1: 1, a2: 2 }, b: 3 }
}
],
assert: tester.assert.equal
},
'object.raise': {

@@ -104,3 +111,3 @@ describe: '',

{
input: [{ 'a.a1': 1, 'a.a2': 2, 'b': 3 }],
input: [{ \'a.a1\': 1, \'a.a2\': 2, \'b\': 3 }],
output: { a: { a1: 1, a2: 2 }, b: 3 }

@@ -117,3 +124,3 @@ }

{
input: [{ a: { b: {c: 1} } }, 'a.b.c'],
input: [{ a: { b: {c: 1} } }, \'a.b.c\'],
output: 1

@@ -130,3 +137,3 @@ }

{
input: [@test.case {}, 'a.b.c', 1],
input: [{}, \'a.b.c\', 1],
output: { a: { b: {c: 1} } }

@@ -133,0 +140,0 @@ }

@@ -1,2 +0,2 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/random.js')

@@ -10,4 +10,22 @@

cases: [
{
input: [10],
could: '5'
},
{
input: [100],
could: '42'
},
{
input: [2],
could: '1'
},
{
input: [99],
could: '44'
}
],
assert: tester.assert.equal
assert: async (result, input, output, sandbox) => {
return result >= 0 && result <= input[0]
}
},

@@ -19,4 +37,18 @@ 'random.number': {

cases: [
{
input: [10, 20],
could: '11'
},
{
input: [1, 100],
could: '14'
},
{
input: [0, 10],
could: '8'
}
],
assert: tester.assert.equal
assert: async (result, input, output, sandbox) => {
return result >= input[0] && result <= input[1]
}
},

@@ -28,4 +60,34 @@ 'random.string': {

cases: [
{
input: [8],
could: '\'ajdsfchakwt\''
},
{
input: [1, '1234567890'],
could: '\'9\''
},
{
input: [0],
output: ''
},
{
input: [-1],
output: ''
}
],
assert: tester.assert.equal
assert: async (result, input, output, sandbox) => {
if(!input[0] && input[0] !== 0) {
input[0] = 8
}
if(!input[1]) {
input[1] = 'abcdefghijklmnopqrstuvwxyz'
}
if(result.length !== input[0])
for (let i = 0; i < input[0]; i++) {
if(input[1].indexOf(result[i]) === -1) {
return false
}
}
return true
}
},

@@ -37,4 +99,32 @@ 'random.hex': {

cases: [
{
input: [8],
could: '\'1bc956bf\''
},
{
input: [ 16]
},
{
input: [0],
output: ''
},
{
input: [-1],
output: ''
}
],
assert: tester.assert.equal
assert: async (result, input, output, sandbox) => {
if(!input[0] && input[0] !== 0) {
input[0] = 8
}
if(result.length !== input[0]) {
return false
}
for (let i = 0; i < input[0]; i++) {
if('0123456789abcdef'.indexOf(result[i]) === -1) {
return false
}
}
return true
}
},

@@ -46,4 +136,10 @@ 'random.hash': {

cases: [
{
input: [],
could: '\'1f8a690b7366a2323e2d5b045120da7e93896f471f8a690b731f8a690b739ab5\''
}
],
assert: tester.assert.equal
assert: async (result, input, output, sandbox) => {
return result.length === 64
}
},

@@ -55,5 +151,24 @@ 'random.element': {

cases: [
{
input: [[1,2,3,4,5]],
could: '1'
},
{
input: [[1,2,3,4,5], 5],
could: '2'
},
{
input: [[1,2,3,4,5], 6],
could: '3'
}
],
assert: tester.assert.equal
assert: async (result, input, output, sandbox) => {
if(input[1]) {
if(result === input[1]) {
return false
}
}
return input[0].indexOf(result)
}
}
}

@@ -1,5 +0,29 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/string.js')
module.exports = {
'string.replaceAll': {
describe: '',
mode: tester.mode.SYNC,
act: instance.replaceAll,
cases: [
{
input: ['repeat repeat repeat', 'repeat', 'don\'t repeat'],
output: 'don\'t repeat don\'t repeat don\'t repeat'
},
{
input: ['abcadaeafaga', 'a', ''],
output: 'bcdefg'
},
{
input: ['112233445544', '4', '9'],
output: '112233995599'
},
{
input: ['no replace all in js native code that replace all the replace', ' ', '_'],
output: 'no_replace_all_in_js_native_code_that_replace_all_the_replace'
}
],
assert: tester.assert.equal
},
'string.template': {

@@ -23,6 +47,4 @@ describe: '',

{
input: [`multiline {1}
multiline`, {1: 'one'}],
output: `multiline one
multiline`
input: [`multiline {1}\n multiline`, {1: 'one'}],
output: `multiline one\n multiline`
},

@@ -46,5 +68,3 @@ {

{
input: [' trim,no,. :
', [',','.',' ', ':', '
']],
input: [' trim,no,. : \n ', [',','.',' ', ':', '\n']],
output: 'trim,no'

@@ -63,25 +83,2 @@ },

},
'string.replaceAll': {
describe: '',
mode: tester.mode.SYNC,
act: instance.replaceAll,
cases: [
{
input: ['abcadaeafaga', 'a', ''],
output: 'bcdefg'
},
{
input: ['112233445544', '4', '9'],
output: '112233995599'
},
{
input: ['repeat repeat repeat', 'repeat', 'don't repeat' > 'don't repeat don't repeat don't repeat']
},
{
input: ['no replace all in js native code that replace all the replace', ' ', '_'],
output: 'no_replace_all_in_js_native_code_that_replace_all_the_replace'
}
],
assert: tester.assert.equal
},
'string.capitalize': {

@@ -88,0 +85,0 @@ describe: '',

@@ -1,2 +0,2 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/sys.js')

@@ -3,0 +3,0 @@

@@ -1,6 +0,6 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/task.js')
module.exports = {
'Tasks.todo': {
'task.todo': {
describe: '',

@@ -13,3 +13,3 @@ mode: tester.mode.SYNC,

},
'Tasks.done': {
'task.done': {
describe: '',

@@ -22,6 +22,6 @@ mode: tester.mode.SYNC,

},
'Tasks.Tasks': {
'task.Worker': {
describe: '',
mode: tester.mode.SYNC,
act: instance.Tasks,
mode: tester.mode.CLASS,
act: instance.Worker,
cases: [

@@ -28,0 +28,0 @@ ]

@@ -1,6 +0,6 @@

const tester = require('../../../tollo-full/index.js').tester
const tester = require('tollo')
const instance = require('../../src/time.js')
module.exports = {
'time.set': {
'chrono.set': {
describe: '',

@@ -10,6 +10,9 @@ mode: tester.mode.SYNC,

cases: [
{
input: [ 'query']
}
],
assert: tester.assert.equal
},
'time.reset': {
'chrono.reset': {
describe: '',

@@ -19,6 +22,9 @@ mode: tester.mode.SYNC,

cases: [
{
input: [ 'query']
}
],
assert: tester.assert.equal
},
'time.clear': {
'chrono.clear': {
describe: '',

@@ -28,6 +34,9 @@ mode: tester.mode.SYNC,

cases: [
{
input: [ 'query']
}
],
assert: tester.assert.equal
},
'time.get': {
'chrono.get': {
describe: '',

@@ -37,2 +46,6 @@ mode: tester.mode.SYNC,

cases: [
{
input: ['query'],
could: '11'
}
],

@@ -39,0 +52,0 @@ assert: tester.assert.equal

const tester = require('../').tester
const tester = require('tollo')

@@ -12,6 +12,2 @@ tester.start = async function () {

tester.bulk(require('./modules/fs.js'))
/* tester.bulk(require('./modules/array.js'))
tester.bulk(require('./modules/object.js'))
tester.bulk(require('./modules/hash.js'))
tester.bulk(require('./modules/string.js'))

@@ -22,4 +18,3 @@ tester.bulk(require('./modules/random.js'))

tester.bulk(require('./modules/time.js'))
*/
tester.run()

@@ -16,2 +16,3 @@ const util = {

onBrowser: function () {
// eslint-disable-next-line no-undef
return (typeof window === 'object' && window instanceof Window)

@@ -18,0 +19,0 @@ }

Sorry, the diff of this file is not supported yet

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