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

poly-js-utils

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poly-js-utils - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "poly-js-utils",
"version": "1.1.0",
"version": "1.1.1",
"description": "Common client-side tools used in HSS Sites themes and locators.",

@@ -5,0 +5,0 @@ "main": "main.js",

@@ -97,2 +97,23 @@ var viewHelpers = require('../src/view-helpers');

});
it("should be able to take a list of fields, if we want some different ones", function() {
var alternativeAddress = {
planet: "Earth",
country: "USA",
state: "WA",
city: "Seattle",
zipCode: 98109,
foo: "bar"
};
var fields = ["city", "state", "zipCode", "country", "planet"];
var expected = "Seattle, WA 98109 USA Earth";
expect(viewHelpers.printAddress(alternativeAddress, fields)).toBe(expected);
});
it("should ignore non-existent fields specified as arguments", function() {
var fields = ["city", "state", "zipCode", "country", "planet"];
var expected = "Seattle, WA USA";
expect(viewHelpers.printAddress(address, fields)).toBe(expected);
});
});

@@ -99,0 +120,0 @@

@@ -101,5 +101,5 @@ /****************************/

/* Combine address elements into single string. */
var printAddress = function(address) {
var printAddress = function(address, fields) {
address.city = address.city && address.city + ",";
var fields = ["street", "suite", "city", "state", "country", "zip_code"];
var fields = fields || ["street", "suite", "city", "state", "country", "zip_code"];
var fullAddress = _.chain(fields)

@@ -106,0 +106,0 @@ .map(_.propertyOf(address))

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