
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
modli-timestamp
Advanced tools
This module provides auto-generation functionality for specificly formatted timestamps based on the CRUD operation assigned.
npm install modli-timestamp --save
This module extends Modli functionality by appending on the configuration to the model object.
import { model, adapter, Joi, use } from 'modli';
import { nedb } from 'modli-nedb';
// IMPORTANT: Include the timestamp module
import timestamp from 'modli-timestamp';
// Create a model
model.add({
name: 'testModel',
version: 1,
schema: {
content: Joi.string(),
created: Joi.date().format('MM/DD/YYYY'),
modified: Joi.date().format('MM/DD/YYYY')
},
// IMPORTANT: Extends on the model by adding a 'timestamp' object
timestamp: {
// The 'created' property will be assigned when 'create' is called
created: [ 'create' ],
// The 'modified' property will be assigned when 'create' or 'update' are called
modified: [ 'create', 'update' ]
}
});
// Add adapter using NeDB
model.add({
name: 'testNEDB',
source: nedb
config: {
inMemoryOnly: true
}
});
const testModli = use('testModel', 'testNEDB');
// IMPORTANT: Apply the extension by calling the function and supplying the Modli instance
timestamp(testModli);
A Makefile
is included for managing build and install tasks. The commands are
then referenced in the package.json
scripts
if that is the preferred
task method:
all
(default) will run all build tasksstart
will run the main scriptclean
will remove the /node_modules
directoriesbuild
will transpile ES2015 code in /src
to /build
test
will run all spec files in /test/src
test-cover
will run code coverage on all testslint
will lint all files in /src
Running make test
will run the full test suite. Since adapters require a data
source if one is not configured the tests will fail. To counter this tests are
able to be broken up.
Test Inidividual File
An individual spec can be run by specifying the FILE
. This is convenient when
working on an individual adapter.
make test FILE=some.spec.js
The FILE
is relative to the test/src/
directory.
Deploys
For deploying releases, the deploy TAG={VERSION}
can be used where VERSION
can be:
<newversion> | major | minor | patch | premajor
Both make {COMMAND}
and npm run {COMMAND}
work for any of the above commands.
Modli-NeDB is licensed under the MIT license. Please see LICENSE.txt
for full details.
Modli-NeDB was designed and created at TechnologyAdvice.
FAQs
Modli extension for auto-generating timestamps
We found that modli-timestamp 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.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.