Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Curated collection of useful Javascript snippets that you can understand in 30 seconds or less.
Curated collection of useful Javascript snippets that you can understand in 30 seconds or less.
anagrams
works in O(n!)
time.The version number of this package does not hold any special meaning. The package is updated regularly and depends upon the author. If you want a package which has more meaningful version numbers or is updated regularly(weekly) then you should use the official package.
Install globally
npm i tsoc -g
Install as a dependency
npm i tsoc --save
Using
var tsoc = require('tsoc'); //The variable name can be anything even, `_` or `$` ;)
tsoc.sum(1,2,3); //returns 6
tsoc.scrollToTop(); //Browser snippets are excluded from the node package so this will give a error `scrollToTop` is not a function.
tsoc.isTravisCI(); //This works
Add the following in the head tag of your html document and place the tsoc.js
file in the same directory as your html document
<script src ="tsoc.js">
Or if you want to use CDN :-
<script src = "unpkg.com/tsoc">
Now you can use the snippets in your document by using TSOC.snippetName
TSOC.sum(1,2,3); //returns 6
TSOC.isTravisCI(); //Node snippets are excluded from the browser package so this will give a error `isTravisCI` is not a function.
TSOC.scrollToTop(); //This will work
You can also use your favorite variable by doing :-
var _ = TSOC.
_.sum(1,2,3); //Returns 6
The tsoc.js
file is same for node and browser and is UMD. The node snippet and browser snippets are differentiated by doing the following :-
if(typeof window !== "undefined"){
var functionName = function functionName(args){
//Code
}
window.tsoc.functionName = functionName;
}
if (typeof module !== "undefined"){
var functionName = function functionName(args){
//Code
}
exports.functionName = functionName;
}
FAQs
Curated collection of useful Javascript snippets that you can understand in 30 seconds or less.
The npm package tsoc receives a total of 1 weekly downloads. As such, tsoc popularity was classified as not popular.
We found that tsoc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.