Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@basekits/core
Advanced tools
Super extensible utility library for javascript apps.
As an alternative to lodash or underscore, basekits is a modular, fast and powerful helper library for javascript apps.
The core package has no utility or helper. Utility and helper functions are provided by kits. A kit, is a group of helper functions. The core allows you to add/update/remove kits.
Through npm:
npm i @basekits/core
Let's create a sample kit that has two functions which are isString
and isUUID
:
const sampleKit = {
name: 'sample',
items: {
isString: function isString(v) {
return typeof v == 'string'
},
isUUID: function isUUID(v) {
return this.regexes.uuid.test(v)
}
},
opts: {
regexes: {
uuid: /[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/g
}
}
}
name
, items
and opts
are the three main properties that creates the kit. Now we are going to see how core eats them:
const kit = require('@basekits/core')
// add kit
kit.addKit(sampleKit)
// all valid items registered
kit.isString('some string') // returns true
kit.isString(12) // returns false
kit.isUUID('109156be-c4fb-41ea-b1b4-efe1671c5836') // returns true
As you see above, all items registered as a property for kit
and ready to use. regexes
property in opts indicates that the kit is going to need some regular expressions in order to work. core stores regular expressions in its regexes
property and they can be accessible in this.regexes
property as you can see above in isUUID
.
If you would like to add, update or remove an item in the sample kit:
kit.sample.removeItem('isString')
// kit.isString is not available anymore
kit.sample.addItem('isString', function isString() {/*...*/})
kit.isString('') // returns true
// replace existing function with the new one
kit.sample.updateItem('isString', function isString() {/**/})
No one needs to write its own kit unless there is a special need. There are many kits written already and anyone can start using it right away:
Clone this repo and run test:
npm run test
Run builds:
npm run builds
Make a pull request.
FAQs
Super extensible utility library for javascript apps.
The npm package @basekits/core receives a total of 0 weekly downloads. As such, @basekits/core popularity was classified as not popular.
We found that @basekits/core 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.