Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Cookies Management in the browser (document.cookie) which supports complex data structure (objects) not only Strings
An Javascript Client-side API that handles adding, getting & removing cookies to/from document.cookie
.
It handles also complex data structure. Indeed, You can persist not only String
but also Objects
in document.cookie
.
npm install chocolata --save;
import {getItem, setItem, removeItem} from 'chocolata';
setItem('token', '1234');
// document.cookie ==> "token=1234"
setItem('otherToken', '5678')
// document.cookie ==> "token=1234; otherToken=5678"
//--- Handle Objects ---
setItem('userInfo', {
firstName: 'Ahmed',
lastName: 'Toumi',
});
// "token=1234; otherToken=5678; userInfo={"firstName":"Ahmed","lastName":"Toumi"}"
const {firstName, lastName} = getItem('userInfo');
console.log(`Welcome back ${firstName} ${lastName} !`)
In this case you need to import the script as CDN.
Also, examples above are still valid. However , instead of import ..
, window.Chocolata
is the namespace of this library:
<script src="https://cdn.rawgit.com/abdennour/chocolata/39513fa4/cdn/chocolata-latest.min.js"></script>
<script>
Chocolata.setItem('userInfo', {
firstName: 'Ahmed',
lastName: 'Toumi',
});
// "token=1234; otherToken=5678; userInfo={"firstName":"Ahmed","lastName":"Toumi"}"
const {firstName, lastName} = Chocolata.getItem('userInfo');
console.log(
`Welcome back ${firstName} ${lastName} !`
)
</script>
MIT .
FAQs
Cookies Management in the browser (document.cookie) which supports complex data structure (objects) not only Strings
The npm package chocolata receives a total of 2 weekly downloads. As such, chocolata popularity was classified as not popular.
We found that chocolata demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.