@podium/utils
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -51,3 +51,3 @@ 'use strict'; | ||
(Array.isArray(arg) && arg.length !== 0) || | ||
(isString(arg) && arg.length !== 0) | ||
(isString(arg) && arg.length !== 0), | ||
) | ||
@@ -193,3 +193,3 @@ .map(arg => { | ||
toProperty, | ||
getFromLocalsPodium(response, fromProperty) | ||
getFromLocalsPodium(response, fromProperty), | ||
); | ||
@@ -208,12 +208,13 @@ | ||
const serializeContext = (headers = {}, context = {}, arg = '') => { | ||
const localHeaders = headers; | ||
Object.keys(context).forEach(key => { | ||
if (isString(context[key])) { | ||
headers[key] = context[key]; | ||
localHeaders[key] = context[key]; | ||
} | ||
if (isFunction(context[key])) { | ||
headers[key] = context[key](arg); | ||
localHeaders[key] = context[key](arg); | ||
} | ||
}); | ||
return headers; | ||
return localHeaders; | ||
}; | ||
@@ -220,0 +221,0 @@ |
{ | ||
"name": "@podium/utils", | ||
"version": "2.1.0", | ||
"license": "SEE LICENSE IN LICENSE", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.schibsted.io:Podium/utils.git" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"main": "./lib/utils.js", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"test": "jest", | ||
"test:verbose": "jest --verbose", | ||
"test:coverage": "jest --coverage" | ||
}, | ||
"devDependencies": { | ||
"jest": "^23.6.0", | ||
"eslint": "^5.5.0", | ||
"eslint-config-finn": "^3.0.1", | ||
"eslint-config-finn-prettier": "^3.0.2", | ||
"prettier": "^1.14.2" | ||
}, | ||
"jest": { | ||
"coveragePathIgnorePatterns": [ | ||
"test/" | ||
"name": "@podium/utils", | ||
"version": "2.2.0", | ||
"license": "MIT", | ||
"keywords": [ | ||
"micro services", | ||
"micro frontend", | ||
"components" | ||
], | ||
"coverageThreshold": { | ||
"global": { | ||
"branches": 100, | ||
"functions": 100, | ||
"lines": 100, | ||
"statements": 100 | ||
} | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:podium-lib/utils.git" | ||
}, | ||
"testEnvironment": "node" | ||
}, | ||
"dependencies": { | ||
"camelcase": "^5.0.0" | ||
} | ||
"bugs": { | ||
"url": "https://github.com/podium-lib/issues" | ||
}, | ||
"homepage": "https://podium-lib.io/", | ||
"files": [ | ||
"lib" | ||
], | ||
"main": "./lib/utils.js", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"test": "jest", | ||
"test:verbose": "jest --verbose", | ||
"test:coverage": "jest --coverage" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.6.1", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-config-prettier": "^3.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-prettier": "^3.0.0", | ||
"jest": "^23.6.0", | ||
"prettier": "^1.14.2" | ||
}, | ||
"jest": { | ||
"coveragePathIgnorePatterns": [ | ||
"test/" | ||
], | ||
"coverageThreshold": { | ||
"global": { | ||
"branches": 100, | ||
"functions": 100, | ||
"lines": 100, | ||
"statements": 100 | ||
} | ||
}, | ||
"testEnvironment": "node" | ||
}, | ||
"dependencies": { | ||
"camelcase": "^5.0.0" | ||
} | ||
} |
# Podium Utils | ||
[![Build Status](https://travis.schibsted.io/Podium/utils.svg?token=9zzG3RHGpsXkFZyESkVu)](https://travis.schibsted.io/Podium/utils) | ||
[![Build Status](https://travis-ci.org/podium-lib/utils.svg?branch=master)](https://travis-ci.org/podium-lib/utils) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/podium-lib/utils.svg)](https://greenkeeper.io/) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/podium-lib/utils/badge.svg)](https://snyk.io/test/github/podium-lib/utils) | ||
@@ -23,3 +25,3 @@ Misc common / generic utility methods. | ||
* str - `*` - A value to check. Required. | ||
- str - `*` - A value to check. Required. | ||
@@ -34,3 +36,3 @@ Returns a boolean. | ||
* fn - `*` - A value to check. Required. | ||
- fn - `*` - A value to check. Required. | ||
@@ -51,3 +53,3 @@ Returns a boolean. | ||
const pathname = utils.pathnameBuilder(foo, bar, xyz); | ||
console.log(pathname) // outputs: foo/a/bar/b/xyz | ||
console.log(pathname); // outputs: foo/a/bar/b/xyz | ||
``` | ||
@@ -61,5 +63,5 @@ | ||
* input - `String` - Relative URI. Required. | ||
* base - `String` - Absolute manifest URI to append the input too. Required. | ||
* extra - `String` - Relative path to be appended at the end of the URI. Optional. | ||
- input - `String` - Relative URI. Required. | ||
- base - `String` - Absolute manifest URI to append the input too. Required. | ||
- extra - `String` - Relative path to be appended at the end of the URI. Optional. | ||
@@ -74,3 +76,3 @@ Returns a resolved URI. | ||
const url = utils.uriBuilder(content, manifest); | ||
console.log(url) // outputs: http://foo.site.com/bar/here/is/content.html | ||
console.log(url); // outputs: http://foo.site.com/bar/here/is/content.html | ||
``` | ||
@@ -84,3 +86,3 @@ | ||
* uri - `String` - The URI to check. Required. | ||
- uri - `String` - The URI to check. Required. | ||
@@ -92,4 +94,4 @@ Returns a Boolean. | ||
utils.uriIsRelative('http://foo.site.com/bar/'); // false | ||
utils.uriIsRelative('/bar/'); // true | ||
utils.uriIsRelative('http://foo.site.com/bar/'); // false | ||
utils.uriIsRelative('/bar/'); // true | ||
``` | ||
@@ -104,5 +106,5 @@ | ||
* input - `String` - Relative or absolute URI. Required. | ||
* base - `String` - Absolute manifest URI to append the possible relative input too. Required. | ||
* extra - `String` - Relative path to be appended at the end of the URI. Optional. | ||
- input - `String` - Relative or absolute URI. Required. | ||
- base - `String` - Absolute manifest URI to append the possible relative input too. Required. | ||
- extra - `String` - Relative path to be appended at the end of the URI. Optional. | ||
@@ -117,3 +119,3 @@ Returns a resolved URI. | ||
const url = utils.uriRelativeToAbsolute(content, manifest); | ||
console.log(url) // outputs: http://foo.site.com/here/is/content.html | ||
console.log(url); // outputs: http://foo.site.com/here/is/content.html | ||
``` | ||
@@ -131,5 +133,5 @@ | ||
* response - `Object` - A http response object. | ||
* property - `String` - Property for the value. | ||
* value - `String` - Value to store on the property. | ||
- response - `Object` - A http response object. | ||
- property - `String` - Property for the value. | ||
- value - `String` - Value to store on the property. | ||
@@ -139,3 +141,3 @@ The http response object. | ||
```js | ||
const obj = utils.setAtLocalsPodium({}, 'foo', 'bar') | ||
const obj = utils.setAtLocalsPodium({}, 'foo', 'bar'); | ||
@@ -159,4 +161,4 @@ /* | ||
* response - `Object` - A http response object | ||
* property - `String` - Property for the value | ||
- response - `Object` - A http response object | ||
- property - `String` - Property for the value | ||
@@ -170,5 +172,5 @@ returns The property, or `null` if it does not exist | ||
* response - `Object` - A http response object | ||
* fromProperty - `String` - Property for the existent value | ||
* toProperty - `String` - Property for the duplicated value | ||
- response - `Object` - A http response object | ||
- fromProperty - `String` - Property for the existent value | ||
- toProperty - `String` - Property for the duplicated value | ||
@@ -183,5 +185,5 @@ @returns {Object} The http response object | ||
* headers - `Object` - A http headers object the context will be copied into. | ||
* context - `Object` - A contect object to copy from | ||
* arg - `*` - An argument value passed on to the function if a context value is a function. | ||
- headers - `Object` - A http headers object the context will be copied into. | ||
- context - `Object` - A contect object to copy from | ||
- arg - `*` - An argument value passed on to the function if a context value is a function. | ||
@@ -212,3 +214,2 @@ A http header object. | ||
### .deserializeContext(headers, prefix) | ||
@@ -220,4 +221,4 @@ | ||
* headers - `Object` - A http headers object the context will be extracted from. | ||
* prefix - `String` - The prefix used to mark what properties are context properties | ||
- headers - `Object` - A http headers object the context will be extracted from. | ||
- prefix - `String` - The prefix used to mark what properties are context properties | ||
@@ -224,0 +225,0 @@ A object containing context properties and values |
Sorry, the diff of this file is not supported yet
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
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
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 bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
15062
0
0
100
215
1
0
220
0
7