happn-commons
Advanced tools
Comparing version 1.5.1 to 1.5.2-test
@@ -33,8 +33,11 @@ const path = require('path'), | ||
BaseDataProvider: require('./lib/base-data-provider'), | ||
BaseBuilder: require('./lib/base-builder'), | ||
lruCache: require('lru-cache'), | ||
fastClone: require('fast-clone'), | ||
HashRingSemaphore: require('./lib/concurrency/hashring-semaphore'), | ||
AsyncQueue: require('./lib/concurrency/async-queue'), | ||
lock: require('async-lock'), | ||
delay: require('await-delay'), | ||
}; | ||
// must be declared after we have attached other deps | ||
module.exports.clone = require('./lib/clone'); |
@@ -27,3 +27,3 @@ const _ = require('lodash'); | ||
} | ||
build() { | ||
build(obj) { | ||
const fieldNames = Object.keys(this.__data); | ||
@@ -33,3 +33,3 @@ if (this.__required) this.checkRequired(); | ||
return _.set(json, key, this.buildValue(this.__data[key])); | ||
}, {}); | ||
}, obj || {}); | ||
} | ||
@@ -46,3 +46,7 @@ push(fieldName, value, type, max) { | ||
if (type != null) this.checkType(value, type, fieldName); | ||
this.__data[fieldName] = value; | ||
if (fieldName === '.') { | ||
this.__data = value; | ||
} else { | ||
this.__data[fieldName] = value; | ||
} | ||
return this; | ||
@@ -49,0 +53,0 @@ } |
@@ -14,2 +14,8 @@ /* eslint-disable prettier/prettier */ | ||
}, | ||
SERVICE_STATE: { | ||
UNINITIALIZED: 0, | ||
STARTED: 1, | ||
STOPPING: 2, | ||
STOPPED: 3, | ||
}, | ||
CLIENT_STATE: { | ||
@@ -16,0 +22,0 @@ UNINITIALIZED: 0, |
@@ -17,5 +17,8 @@ module.exports = { | ||
wildcardPreliminaryMatch: function (pattern, matchTo) { | ||
// do an explicit check | ||
if (pattern.indexOf('*') === -1) return pattern === matchTo; | ||
const preparedPattern = pattern.replace(/(.)\1+/g, '*'); //strip out *** ****** and replace with * | ||
if (preparedPattern === '*') return true; | ||
// do a starts with check | ||
if (!matchTo.startsWith(preparedPattern.split('*')[0])) return false; | ||
return preparedPattern; | ||
@@ -34,7 +37,7 @@ }, | ||
if (typeof preparedOrMatched === 'boolean') return preparedOrMatched; //we have a match result, return it | ||
//try a starts with reject | ||
const initialSegment = preparedOrMatched.split('*').pop(); | ||
if (initialSegment.length > 0 && matchTo.indexOf(initialSegment) === -1) return false; | ||
return this.makeRe(preparedOrMatched).test(matchTo); | ||
}, | ||
addLeadingSlashIfNone: function (path) { | ||
return path.startsWith('/') ? path : '/' + path; | ||
}, | ||
stripLeadingSlashes: function (path) { | ||
@@ -41,0 +44,0 @@ return path.replace(/^\//, ''); |
{ | ||
"name": "happn-commons", | ||
"version": "1.5.1", | ||
"version": "1.5.2-test", | ||
"description": "", | ||
@@ -14,2 +14,3 @@ "main": "index.js", | ||
"async-lock": "^1.4.0", | ||
"await-delay": "^1.0.0", | ||
"custom-env": "^2.0.1", | ||
@@ -16,0 +17,0 @@ "fast-clone": "^1.5.13", |
@@ -30,1 +30,5 @@ 1.0.2 2022-03-29 | ||
- refactor: lint | ||
1.5.2-prerelease 2023-09-13 | ||
----------------- | ||
- Includes BaseBuilder in index |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24821
13
765
16
2
1
+ Addedawait-delay@^1.0.0
+ Addedawait-delay@1.0.0(transitive)