
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
typescript-string-operations
Advanced tools
Simple lightweight string operation library for Typescript
var id = String.Empty;
var id = image.GetId();
if(String.IsNullOrWhiteSpace(id))
return image;
var id = image.GetId()
String.Format("image_{0}.jpg", id)
output: "file_2db5da20-1c5d-4f1a-8fd4-b41e34c8c5b5.jpg";
Specifier available!
var value = String.Format("{0:L}", "APPLE"); //output "apple"
value = String.Format("{0:U}", "apple"); // output "APPLE"
value = String.Format("{0:d}", "2017-01-23 00:00"); //output "21.01.2017"
value = String.Format("{0:s}", "21.03.2017 22:15:01") //output "2017-01-23T21:15:01"
value = String.Format("{0:n}", 1000000);
//output "1.000.000"
Specifier | Result |
---|---|
L | LowerCase |
U | UpperCase |
d | ShortDatePatter |
s | SortableDateTimePattern |
n | Thousand seperator |
var value = String.Join("; ", "Apple", "Banana");
//output: "Apple; Banana";
var array = ['Apple', 'Banana']
var value = String.Join("; ", array);
//output: "Apple; Banana";
source.js
in your project.<script type="text/javascript" src="scripts/typescript-string-format.js"></script>
Method | Type | Description | Parameter |
---|---|---|---|
Empty | Property | simply returns "" . | |
IsNullOrWhiteSpace | Method | returns true value if given parameter is either null, empty or undefined. | format , args |
Format | Method | Converts the value of objects to strings based on the formats specified and inserts them into another string. | format , args |
Join | Method | Combines arguments delimited by given seperator. | delimiter ,args |
Join | Method | Combines arguments delimited by given seperator from array. | delimiter ,array |
make sure to include sf
namespace!
Usage without Typescript: Take source.js and simply call Methods with namespace.
e.g.
var value = sf.String.Empty;
FAQs
Simple lightweight string operation library for Typescript, works with Angular
The npm package typescript-string-operations receives a total of 99,772 weekly downloads. As such, typescript-string-operations popularity was classified as popular.
We found that typescript-string-operations demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.