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

basic-utils

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-utils - npm Package Compare versions

Comparing version 1.7.4 to 2.0.0

appveyor.yml

28

lib/utils.js

@@ -129,1 +129,29 @@ 'use strict';

};
exports.omit = (obj, omitKey) => {
if (Types.isObj(obj)) {
if (!Types.isString(omitKey)) {
if (!Types.isArray(omitKey)) {
return obj;
}
}
if (Types.isString(omitKey)) {
omitKey = [omitKey];
};
return Object.keys(obj)
.filter((key) => !omitKey.includes(key))
.reduce((reducedObj, key) => {
reducedObj[key] = obj[key];
return reducedObj;
}, {});
}
return null;
};

10

package.json
{
"name": "basic-utils",
"version": "1.7.4",
"version": "2.0.0",
"description": "basic js utils",

@@ -20,5 +20,5 @@ "main": "lib/index.js",

"devDependencies": {
"code": "^4.0.0",
"coveralls": "^2.13.1",
"lab": "^13.0.2"
"code": "^5.1.2",
"coveralls": "^3.0.0",
"lab": "^15.1.2"
},

@@ -28,4 +28,4 @@ "dependencies": {

"mkdirp": "^0.5.1",
"rimraf": "^2.6.1"
"rimraf": "^2.6.2"
}
}

@@ -9,2 +9,3 @@ # basic-utils

[![Build Status](https://travis-ci.org/simon-p-r/basic-utils.svg?branch=master)](https://travis-ci.org/simon-p-r/basic-utils)
[![Windows Build Status](https://img.shields.io/appveyor/ci/simon-p-r/basic-utils/master.svg?label=windows&style=flat-square&maxAge=2592000)](https://ci.appveyor.com/project/simon-p-r/basic-utils)
[![Coveralls](https://img.shields.io/coveralls/simon-p-r/basic-utils.svg?maxAge=1000)](https://coveralls.io/github/simon-p-r/basic-utils)

@@ -68,2 +69,6 @@

###### omit
- Returns a filtered obj based on one or more keys to omit
#### FileSystem

@@ -70,0 +75,0 @@

@@ -22,31 +22,26 @@ 'use strict';

it('should expose mkDirSync method', (done) => {
it('should expose mkDirSync method', () => {
expect(Utils.mkDirSync).to.be.a.function();
done();
});
it('should expose mkDir method', (done) => {
it('should expose mkDir method', () => {
expect(Utils.mkDir).to.be.a.function();
done();
});
it('should expose rmDirSync method', (done) => {
it('should expose rmDirSync method', () => {
expect(Utils.rmDirSync).to.be.a.function();
done();
});
it('should expose rmDir method', (done) => {
it('should expose rmDir method', () => {
expect(Utils.rmDir).to.be.a.function();
done();
});
it('should test fileExists method', (done) => {
it('should test fileExists method', () => {

@@ -56,7 +51,5 @@ expect(Utils.isFile(directory)).to.be.false();

expect(Utils.isFile(file)).to.be.true();
done();
});
it('should test dirExists method', (done) => {
it('should test dirExists method', () => {

@@ -67,4 +60,2 @@

expect(Utils.isDir(directory)).to.be.true();
done();
});

@@ -71,0 +62,0 @@

@@ -18,3 +18,3 @@ 'use strict';

it('should test isObj method', (done) => {
it('should test isObj method', () => {

@@ -30,7 +30,5 @@ Types.nonObject.forEach((type) => {

expect(!Utils.isObj([])).to.be.true();
done();
});
it('should test isNan method', (done) => {
it('should test isNan method', () => {

@@ -45,7 +43,5 @@ Types.nonNan.forEach((type) => {

expect(!Utils.isNan(NaN)).to.be.false();
done();
});
it('should test isArray method', (done) => {
it('should test isArray method', () => {

@@ -60,7 +56,5 @@ expect(Utils.isArray(['hello', 'world'])).to.be.true();

expect(!Utils.isArray([])).to.be.false();
done();
});
it('should test isString method', (done) => {
it('should test isString method', () => {

@@ -76,8 +70,5 @@ expect(Utils.isString('hello')).to.be.true();

expect(!Utils.isString('string')).to.be.false();
done();
});
it('should test isDate method', (done) => {
it('should test isDate method', () => {

@@ -91,7 +82,5 @@ expect(Utils.isDate(new Date())).to.be.true();

expect(!Utils.isDate(new Date())).to.be.false();
done();
});
it('should test isRegex method', (done) => {
it('should test isRegex method', () => {

@@ -105,7 +94,5 @@ expect(Utils.isRegex(new RegExp())).to.be.true();

expect(!Utils.isRegex(new RegExp())).to.be.false();
done();
});
it('should test isFunction method', (done) => {
it('should test isFunction method', () => {

@@ -126,7 +113,5 @@ const func = (hello) => {

expect(Utils.isFunction()).to.be.false();
done();
});
it('should test isNumber method', (done) => {
it('should test isNumber method', () => {

@@ -142,7 +127,5 @@ expect(Utils.isNumber(1234)).to.be.true();

});
done();
});
it('should test isUndefined method', (done) => {
it('should test isUndefined method', () => {

@@ -164,7 +147,5 @@ const nill = (hello) => {

expect(Utils.isUndefined()).to.be.true();
done();
});
it('should test isNull method', (done) => {
it('should test isNull method', () => {

@@ -192,7 +173,5 @@ const nill = (hello) => {

expect(Utils.isNull([])).to.be.false();
done();
});
it('should test isEmpty method', (done) => {
it('should test isEmpty method', () => {

@@ -220,7 +199,5 @@ const nill = (hello) => {

expect(Utils.isEmpty([])).to.be.false();
done();
});
it('should test isObjectID method', (done) => {
it('should test isObjectID method', () => {

@@ -237,7 +214,5 @@ expect(Utils.isObjectID('534b4dcaadc0c2136938de3a')).to.be.true();

});
done();
});
it('should test isIP', (done) => {
it('should test isIP', () => {

@@ -271,7 +246,5 @@ Types.v4.forEach((type) => {

expect(Utils.isIp6()).to.be.false();
done();
});
it('should test isMac', (done) => {
it('should test isMac', () => {

@@ -288,10 +261,7 @@ Types.notMac.forEach((type) => {

expect(Utils.isMac()).to.be.false();
done();
});
it('should test isFQDN', (done) => {
it('should test isFQDN', () => {

@@ -310,7 +280,5 @@ Types.notFQDN.forEach((type) => {

expect(Utils.isFQDN()).to.be.false();
done();
});
it('should test isInt8', (done) => {
it('should test isInt8', () => {

@@ -326,8 +294,5 @@ Types.int8.forEach((m) => {

});
done();
});
it('should test isUint8', (done) => {
it('should test isUint8', () => {

@@ -344,8 +309,5 @@ Types.uInt8.forEach((m) => {

});
done();
});
it('should test isInt16', (done) => {
it('should test isInt16', () => {

@@ -361,8 +323,5 @@ Types.int16.forEach((m) => {

});
done();
});
it('should test isUint16', (done) => {
it('should test isUint16', () => {

@@ -379,8 +338,5 @@ Types.uInt16.forEach((m) => {

});
done();
});
it('should test isInt32', (done) => {
it('should test isInt32', () => {

@@ -396,8 +352,5 @@ Types.int32.forEach((m) => {

});
done();
});
it('should test isUint32', (done) => {
it('should test isUint32', () => {

@@ -414,8 +367,5 @@ Types.uInt32.forEach((m) => {

});
done();
});
it('should test isAscii', (done) => {
it('should test isAscii', () => {

@@ -447,7 +397,5 @@ Types.ascii.forEach((m) => {

expect(Utils.isAscii(f)).to.be.false();
done();
});
it('should test isDateString', (done) => {
it('should test isDateString', () => {

@@ -463,7 +411,5 @@ const date = new Date();

expect(Utils.isDateString([])).to.be.false();
done();
});
it('should test isRegexString', (done) => {
it('should test isRegexString', () => {

@@ -480,8 +426,6 @@ const regexp = new RegExp();

expect(Utils.isRegexString(NaN)).to.be.false();
done();
});
it('should test isError', (done) => {
it('should test isError', () => {

@@ -498,8 +442,6 @@ expect(Utils.isError(new Error())).to.be.true();

expect(Utils.isError({})).to.be.false();
done();
});
it('should test \'or\' comparisons', (done) => {
it('should test \'or\' comparisons', () => {

@@ -509,8 +451,6 @@ const value = { hello: 'world' };

expect(comparison).to.be.true();
done();
});
it('should test \'or\' not comparisons', (done) => {
it('should test \'or\' not comparisons', () => {

@@ -520,9 +460,3 @@ const value = 'hello';

expect(comparison).to.be.true();
done();
});
});

@@ -20,10 +20,8 @@ 'use strict';

it('should expose a deepFreeze method', (done) => {
it('should expose a deepFreeze method', () => {
expect(Utils.deepFreeze).to.be.a.function();
done();
});
it('should test iterateObj method', (done) => {
it('should test iterateObj method', () => {

@@ -38,3 +36,2 @@ const test = {

expect(Utils.iterateObj(test)).to.be.a.string().and.equal('a~value\nd~anotherValue\n');
done();

@@ -44,11 +41,9 @@ });

it('should test format method', (done) => {
it('should test format method', () => {
const expected = 'This is the first entry and this is the second entry';
expect(Utils.format('{0} is the first entry and this is the {1} entry', 'This', 'second')).to.equal(expected);
done();
});
it('should test serialize method', (done) => {
it('should test serialize method', () => {

@@ -86,6 +81,5 @@ const fn = function () {};

expect(Utils.serialize(circular)).to.be.an.instanceof(Error);
done();
});
it('should test deserialize method', (done) => {
it('should test deserialize method', () => {

@@ -99,6 +93,20 @@ const fn = function () {};

expect(Utils.deserialize(new RegExp())).to.be.an.instanceof(Error);
done();
});
it('should test omit method', () => {
const obj = {
key: 1,
test: 'hello'
};
expect(Utils.omit(null, 'key')).to.be.null();
expect(Utils.omit(obj, null)).to.equal(obj);
expect(Utils.omit(obj, 'key')).to.equal({ test: 'hello' });
expect(Utils.omit(obj, ['key', 'test'])).to.equal({ });
});
});

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