New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zodash/format

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zodash/format - npm Package Compare versions

Comparing version 1.1.0-alpha.0 to 1.1.1

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [1.1.1](https://github.com/zcorky/zodash/compare/@zodash/format@1.1.0-alpha.0...@zodash/format@1.1.1) (2020-07-31)
**Note:** Version bump only for package @zodash/format
# 1.1.0-alpha.0 (2020-07-31)

@@ -8,0 +16,0 @@

2

lib/format.d.ts

@@ -5,2 +5,2 @@ export interface Seperator {

}
export declare function format(text: string, map: Record<string, any>, seperator?: Seperator): string;
export declare function format(text: string, mapOrFn: Record<string, any> | ((key: string, text: string) => any), seperator?: Seperator): string;

@@ -8,8 +8,13 @@ "use strict";

};
function format(text, map, seperator = DEFAULT_SEPERATOR) {
function format(text, mapOrFn, seperator = DEFAULT_SEPERATOR) {
const seperatorStart = seperator.start;
const SeperatorEnd = seperator.end;
const pattern = new RegExp(`${seperatorStart}([^${SeperatorEnd}]+)${SeperatorEnd}`, 'g');
if (typeof mapOrFn === 'function') {
return text.replace(pattern, (_, key) => {
return mapOrFn(key, text);
});
}
return text.replace(pattern, (_, key) => {
return typeof map[key] !== 'undefined' ? map[key] : '';
return typeof mapOrFn[key] !== 'undefined' ? mapOrFn[key] : '';
});

@@ -16,0 +21,0 @@ }

{
"name": "@zodash/format",
"version": "1.1.0-alpha.0",
"version": "1.1.1",
"description": "format string with object values",

@@ -68,3 +68,3 @@ "keywords": [

},
"gitHead": "64874eb0f5ed4a0b664bbdf64e5e1ca6430b14c9",
"gitHead": "101a6993addba080c1e000a510853db38a18566c",
"devDependencies": {

@@ -71,0 +71,0 @@ "@zodash/get": "^1.0.22"

Sorry, the diff of this file is not supported yet

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