Socket
Socket
Sign inDemoInstall

eslint-plugin-you-dont-need-lodash-underscore

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-you-dont-need-lodash-underscore - npm Package Compare versions

Comparing version 6.13.0 to 6.14.0

4

lib/rules/rules.json

@@ -292,2 +292,6 @@ {

},
"cloneDeep": {
"compatible": true,
"alternative": "structuredClone()"
},
"isFunction": {

@@ -294,0 +298,0 @@ "compatible": true,

8

package.json
{
"name": "eslint-plugin-you-dont-need-lodash-underscore",
"version": "6.13.0",
"version": "6.14.0",
"description": "Check methods you can use natively without lodash/underscore",

@@ -32,7 +32,7 @@ "repository": {

"devDependencies": {
"coveralls": "^2.11.9",
"eslint": "^4.18.2",
"coveralls": "^3.1.1",
"eslint": "^8.48.0",
"istanbul": "^0.4.4",
"lodash": "^4.17.4",
"mocha": "^4.1.0"
"mocha": "^10.2.0"
},

@@ -39,0 +39,0 @@ "engines": {

@@ -24,9 +24,9 @@ 'use strict';

it('pick', () => {
it('invert', () => {
var object = { 'a': 1, 'b': '2', 'c': 3 };
function pick(object, paths) {
const obj = {};
for (const path of paths) {
if (object[path]) {
obj[path] = object[path]
function invert(object) {
var obj = {};
for (var key in object) {
if (object.hasOwnProperty(key)) {
obj[object[key]] = key;
}

@@ -37,7 +37,45 @@ }

assert.deepEqual(
_.pick(object, ['a', 'c']),
pick(object, ['a', 'c'])
_.invert(object),
invert(object)
)
})
it('mapKeys', () => {
var object = { 'a': 1, 'b': 2 };
function mapKeys(object, cb) {
var obj = {};
for (var key in object) {
if (object.hasOwnProperty(key)) {
var newKey = cb(object[key], key, object);
obj[newKey] = object[key];
}
}
return obj;
}
assert.deepEqual(
_.mapKeys(object, function (value, key) {
return key + value;
}),
mapKeys(object, function (value, key) {
return key + value;
})
)
})
it('pick', () => {
var object = { 'a': 1, 'b': '2', 'c': 3 };
function pick(object, keys) {
return keys.reduce((obj, key) => {
if (object && object.hasOwnProperty(key)) {
obj[key] = object[key];
}
return obj;
}, {});
}
assert.deepEqual(
_.pick(object, ['a', 'c', 'x']),
pick(object, ['a', 'c', 'x'])
)
})
it('pickBy', () => {

@@ -265,2 +303,65 @@ var object = { 'a': 1, 'b': null, 'c': 3, 'd': false, 'e': undefined, 'f': '', 'g': 0 };

})
describe('isPlainObject', () => {
function isPlainObject(value) {
if (typeof value !== 'object' || value === null) return false
if (Object.prototype.toString.call(value) !== '[object Object]') return false
const proto = Object.getPrototypeOf(value);
if (proto === null) return true
const Ctor = Object.prototype.hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return (
typeof Ctor === 'function' &&
Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value)
);
}
function Foo() {
this.a = 1;
}
it('_.isPlainObject(NaN)', () => {
assert.equal(
_.isPlainObject(NaN),
isPlainObject(NaN)
)
})
it('_.isPlainObject([1, 2, 3])', () => {
assert.equal(
_.isPlainObject([1, 2, 3]),
isPlainObject([1, 2, 3])
)
})
it('_.isPlainObject(null)', () => {
assert.equal(
_.isPlainObject(null),
isPlainObject(null)
)
})
it("_.isPlainObject({ 'x': 0, 'y': 0 })", () => {
assert.equal(
_.isPlainObject({ 'x': 0, 'y': 0 }),
isPlainObject({ 'x': 0, 'y': 0 })
)
})
it("_.isPlainObject(Object.create(null))", () => {
assert.equal(
_.isPlainObject(Object.create(null)),
isPlainObject(Object.create(null))
)
})
it("_.isPlainObject(Object.create(new Foo()))", () => {
assert.equal(
_.isPlainObject(Object.create(new Foo())),
isPlainObject(Object.create(new Foo()))
)
})
it("_.isPlainObject(Object.create(new Date()))", () => {
assert.equal(
_.isPlainObject(Object.create(new Date())),
isPlainObject(Object.create(new Date()))
)
})
})
describe('get', () => {

@@ -267,0 +368,0 @@ const get = (obj, path, defaultValue) => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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