krakenthing

1.0.68 • Public • Published

kraken_thing

Main library for thing that includes all sub libraries

  • kraken_schema
  • kraken_html
  • kraken_record
  • kraken_data
  • kraken_api
  • kraken_db

Running tests

node --experimental-vm-modules node_modules/.bin/jest

Publish

npm adduser
npx parcel build
npm publish

How to use


import { KrThing } from 'https://tactik8.github.io/kraken_thing_js/dist/main.js';

let t = new KrThing();


Key concepts

Thing

Monitor changes (addEventListener)

eventType:

  • all (all events)
  • add
  • delete
  • replace

thing.addEventListener(eventType, callbackFn)


Conditions: propertyValueSpecification

Filter


// Initialize new things
let things = new KrThings()

// Populate with 3 thing objects

let thing1 = new KrThing();
thing1.setProperty('name', 'bob1s')
var i = things.add(thing1, 'id1')

let thing2 = new KrThing();
thing2.setProperty('name', 'bob2s')
var i = things.add(thing2, 'id2')

let thing3 = new KrThing();
thing3.setProperty('name', 'bob3s')
var i = things.add(thing3, 'id3')

// Initialize KrPropertyValueSpecification
let t = new KrPropertyValueSpecification();
t.propertyID = 'name'
t.setEndsWith('3s')

// Filter (gives a new things object)
let thingsFiltered = things.filter([t])

console.log(thingsFiltered.items.length)

Readme

Keywords

none

Package Sidebar

Install

npm i krakenthing

Weekly Downloads

60

Version

1.0.68

License

ISC

Unpacked Size

4.87 MB

Total Files

52

Last publish

Collaborators

  • schapleau2