@itcutives/adapter-memory
Advanced tools
Comparing version 1.1.0 to 1.2.0
module.exports = { | ||
'extends': 'airbnb-base', | ||
'plugins': [], | ||
'env': { | ||
'mocha': true | ||
extends: 'airbnb-base', | ||
plugins: [], | ||
env: { | ||
mocha: true, | ||
}, | ||
'rules': { | ||
rules: { | ||
'max-len': 0, | ||
'global-require': 0, | ||
'import/no-dynamic-require': 0 | ||
} | ||
'import/no-dynamic-require': 0, | ||
}, | ||
}; |
{ | ||
"name": "@itcutives/adapter-memory", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Memory Adapter for ITcutives API", | ||
@@ -29,10 +29,10 @@ "main": "index.js", | ||
"chai-as-promised": "^7.1.1", | ||
"mocha": "^7.1.1", | ||
"nyc": "^15.0.0", | ||
"mocha": "^7.2.0", | ||
"nyc": "^15.0.1", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^9.0.1", | ||
"sinon": "^9.0.2", | ||
"sinon-chai": "^3.5.0", | ||
"eslint": "^6.8.0", | ||
"eslint": "^7.1.0", | ||
"eslint-config-airbnb-base": "^14.1.0", | ||
"eslint-plugin-import": "^2.20.1" | ||
"eslint-plugin-import": "^2.20.2" | ||
}, | ||
@@ -42,4 +42,4 @@ "dependencies": { | ||
"lodash": "^4.17.15", | ||
"uuid": "^7.0.2" | ||
"uuid": "^8.1.0" | ||
} | ||
} |
@@ -7,2 +7,5 @@ /* eslint-disable no-unused-vars,class-methods-use-this */ | ||
const loForEach = require('lodash/forEach'); | ||
const loGet = require('lodash/get'); | ||
const loSet = require('lodash/set'); | ||
const loUnset = require('lodash/unset'); | ||
@@ -112,3 +115,3 @@ class AbstractAdapter { | ||
if (this.constructor.FIELDS.indexOf(key) !== -1) { | ||
this.properties[key] = value; | ||
loSet(this.properties, key, value); | ||
} | ||
@@ -121,3 +124,3 @@ } | ||
} | ||
return this.properties[key]; | ||
return loGet(this.properties, key, undefined); | ||
} | ||
@@ -129,4 +132,3 @@ | ||
} | ||
delete this.properties[key]; | ||
return true; | ||
return loUnset(this.properties, key); | ||
} | ||
@@ -133,0 +135,0 @@ |
@@ -6,3 +6,3 @@ /* eslint-disable no-param-reassign,no-unused-vars,class-methods-use-this */ | ||
const Boom = require('boom'); | ||
const UuidV1 = require('uuid/v1'); | ||
const UuidV1 = require('uuid').v1; | ||
const loForEach = require('lodash/forEach'); | ||
@@ -9,0 +9,0 @@ const loIsEmpty = require('lodash/isEmpty'); |
@@ -203,3 +203,3 @@ /** | ||
beforeEach(() => { | ||
Abstract.FIELDS = ['id', 'name']; | ||
Abstract.FIELDS = ['id', 'name', 'json.field']; | ||
a = new Abstract(); | ||
@@ -222,2 +222,7 @@ }); | ||
}); | ||
it('should set the properties with key/value for nested field', () => { | ||
a.set('json.field', '2'); | ||
a.properties.should.be.deep.eql({ json: { field: '2' } }); | ||
}); | ||
}); | ||
@@ -229,3 +234,3 @@ | ||
beforeEach(() => { | ||
Abstract.FIELDS = ['id', 'name']; | ||
Abstract.FIELDS = ['id', 'name', 'json.field']; | ||
a = new Abstract(); | ||
@@ -252,2 +257,7 @@ }); | ||
}); | ||
it('should return value associated with key (jsonPath)', () => { | ||
a.set('json.field', '2'); | ||
a.get('json.field').should.be.eql('2'); | ||
}); | ||
}); | ||
@@ -259,3 +269,3 @@ | ||
beforeEach(() => { | ||
Abstract.FIELDS = ['id', 'name']; | ||
Abstract.FIELDS = ['id', 'name', 'json.field']; | ||
a = new Abstract(); | ||
@@ -278,2 +288,10 @@ }); | ||
}); | ||
it('should try and remove the property provided (json path)', () => { | ||
a.set('id', '2'); | ||
a.set('json.field', '2'); | ||
a.properties.should.be.deep.eql({ id: '2', json: { field: '2' } }); | ||
a.remove('json.field').should.be.eql(true); | ||
a.properties.should.be.deep.eql({ id: '2', json: {} }); | ||
}); | ||
}); | ||
@@ -280,0 +298,0 @@ |
@@ -10,3 +10,3 @@ /** | ||
const Adapter = proxyquire('../src/adapter', { | ||
'uuid/v1': () => 'random-uuid-v1', | ||
uuid: ({ v1: () => 'random-uuid-v1' }), | ||
}); | ||
@@ -13,0 +13,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85414
1729
+ Addeduuid@8.3.2(transitive)
- Removeduuid@7.0.3(transitive)
Updateduuid@^8.1.0