npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

clay-entity

v2.1.11

Published

Entity class for ClayDB

Downloads

140

Readme

Build Status npm Version JS Standard

Entity class for ClayDB

Installation

$ npm install clay-entity --save

Usage

'use strict'

const clayEntity = require('clay-entity')

{
  let entity01 = clayEntity({
    title: 'Wonderful Banana'
  })
  console.log(entity01)
}

API

[email protected]

Entity class for ClayDB

Functions

create(args) -> Entity

Create a Entity instance

| Param | Type | Description | | ----- | --- | -------- | | args | * | |

decorate(decorate) -> DecoratedEntity

Decorate an entity

| Param | Type | Description | | ----- | --- | -------- | | decorate | Entity | |

isEntity(obj) -> boolean

Detect a instance is entity or not

| Param | Type | Description | | ----- | --- | -------- | | obj | * | Object to check |

DecoratedEntity Class

new DecoratedEntity(entity)

Constructor of DecoratedEntity class

| Param | Type | Description | | ----- | --- | -------- | | entity | Entity | Entity to decorate |

entity.get(name) -> *

Get entity attribute.

| Param | Type | Description | | ----- | --- | -------- | | name | string | Name of attribute |

entity.set(name, value) -> DecoratedEntity

Set value

| Param | Type | Description | | ----- | --- | -------- | | name | string | Name of attribute to set | | value | * | Value to set |

entity.set(attributes, options) -> DecoratedEntity

Set values

| Param | Type | Description | | ----- | --- | -------- | | attributes | Object | Attributes to set | | options | Object | Optional settings | | options.allowReserved | boolean | Allow to set reserved |

entity.at(at) -> DecoratedEntity

Set $$at attribute

| Param | Type | Description | | ----- | --- | -------- | | at | Date | Date data set at |

entity.at() -> Date

Get $$at attribute

entity.by(by) -> DecoratedEntity

Set $$by attribute

| Param | Type | Description | | ----- | --- | -------- | | by | string | Lump id |

entity.by() -> string

Get $$by attribute

entity.seal(privateKey) -> DecoratedEntity

Seal this entity

| Param | Type | Description | | ----- | --- | -------- | | privateKey | string | Private key to seal |

entity.seal() -> string

Get seal

entity.as(as) -> DecoratedEntity

Set resource name as as

| Param | Type | Description | | ----- | --- | -------- | | as | string | As |

entity.as() -> string

Get as

entity.num(num) -> DecoratedEntity

Set entity number as num

| Param | Type | Description | | ----- | --- | -------- | | num | string | As |

entity.num() -> string

Get num

entity.verify(publicKey) -> boolean

Verify the entity with public key

| Param | Type | Description | | ----- | --- | -------- | | publicKey | string | |

entity.toValues() -> Object

Convert into value object

License

This software is released under the Apache-2.0 License.

Links