Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Built with ❤︎ by Hiukky
Chork is a minimal library for checking data types in javascript.
Typeof typeof
works well, but only for variables of the primitive type and not for structures like Array, Date and others. Chork solves this by bringing the real type of past value.
npm i chork
yarn add chork
Currently, chork has two test functions which are check
and checkAll
.
It receives only one argument of any kind.
import { check } from 'chork'
check(1) // 'number'
check('foo') // 'string'
check([1, 'foo']) // 'array'
check({ key: 1 }) // 'object'
check(new Date()) // 'date'
The checkAll
function works in the same way as check
, the only difference is that it returns an object with a key
being its own value and a value
being the result with the type of data tested.
import { check } from 'chork'
checkAll(1) // { '1': 'number' }
checkAll('foo') // { foo: 'string' }
checkAll([1, 'foo']) // { '1': 'number', foo: 'string' }
checkAll({ key: 1 }) // { key: 'number' }
checkAll(new Date()) // { 'Sat Feb 06 2021 12:35:41 GMT-0300 (Brasilia Standard Time)': 'date' }
Chork is in an initial version without many features yet, but you can feel free to send your suggestion or open a PR.
FAQs
Minimalist JS data type checking utility.
The npm package chork receives a total of 27 weekly downloads. As such, chork popularity was classified as not popular.
We found that chork 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.