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

resources-tsk

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resources-tsk - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

6

CHANGELOG.md

@@ -104,1 +104,7 @@ # Changelog

- Types was refactoring
## [2.1.0] — 2022-01-18
### Added
- Function for replace key params into text was added.

2

lib/index.d.ts

@@ -12,2 +12,4 @@ export declare class Resources {

getWithParams(resourceName: string, params: Record<string, string>, language?: string): string;
static replaceParams(text: string, params: Record<string, string>): string;
private static applyPattern;
}

14

lib/index.js

@@ -83,2 +83,10 @@ "use strict";

}
return Resources.applyPattern(resource, params);
}
static replaceParams(text, params) {
if (!text || !params)
return null;
return Resources.applyPattern(text, params);
}
static applyPattern(text, params) {
const keys = Object.keys(params);

@@ -88,9 +96,9 @@ keys.forEach((key) => {

const regex = RegExp(pattern);
while (regex.test(resource)) {
resource = resource.replace(`{{${key}}}`, params[key]);
while (regex.test(text)) {
text = text.replace(`{{${key}}}`, params[key]);
}
});
return resource;
return text;
}
}
exports.Resources = Resources;
{
"name": "resources-tsk",
"version": "2.0.1",
"version": "2.1.0",
"description": "resource tool for use with or without NodeTskeleton template project",

@@ -5,0 +5,0 @@ "repository": {

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