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.
commodo-fields-date
Advanced tools
A simple date field, used with the Commodo "withFields" higher order function.
A simple date field, used with the Commodo withFields
higher order function.
npm install --save commodo-fields-date
Or if you prefer yarn:
yarn add commodo-fields-date
import { compose } from "ramda";
import { withFields, string } from "@commodo/fields";
import { date } from "commodo-fields-date";
const Company = compose(
withFields({
name: string(),
foundedOn: date(), // Use it to store a single date.
topMoments: date({ list: true }) // Or use it to store a list of dates.
// Other fields you might need...
}),
// Other higher order functions (HOFs) you might need...
)();
const company = new Company();
company.name = "Acme Corporation";
// The date field can accept a Date object...
company.foundedOn = new Date();
company.topMoments = [new Date(), new Date()];
// ...or an ISO 8601 formatted date/time string.
company.foundedOn = "2020-04-18T15:50:44.205Z";
company.topMoments = [
"2020-04-18T15:50:44.205Z",
"2020-04-10T00:00:00.000Z",
new Date()
];
// The following will throw the WithFieldsError error.
company.foundedOn = "2020-04-18";
company.topMoments = ["2020-04-18", new Date()];
Note: alternatively, you could've also used the populate
method to assign the data:
const company = new Company();
company.populate = {
foundedOn: new Date(),
topMoments: [
"2020-04-18T15:50:44.205Z",
"2020-04-10T00:00:00.000Z",
new Date()
]
};
Thanks goes to these wonderful people (emoji key):
Adrian Smijulj 💻 📖 💡 👀 ⚠️ |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
A simple date field, used with the Commodo "withFields" higher order function.
We found that commodo-fields-date 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.