Skip to content

浮点型Key字典容器。A dictionary container using float key.

License

Notifications You must be signed in to change notification settings

SimaBenteng/FloatKeyDictionary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Import

  • Install the library
npm install floatkeydictionary --save
  • Import
const FloatKeyDictionary = require('floatkeydictionary');

Create

  • Create a empty dictionary
const dic = FloatKeyDictionary.Create();
  • Create with key-value object.Key must be Number.
const dic = FloatKeyDictionary.CreateWithData({1: 'anyValue', 1.1: 'anyValue', 5.0: 'anyValue'...});

Getter functions

  • getCloseKeyUp(keyNumber)
  • getCloseKeyDown(keyNumber)

Example

const dic = FloatKeyDictionary.CreateWithData({1: 'value1', 1.1: 'value1.1', 5.0: 'value5.0'});
const v1 = dic.getCloseKeyUp(1.1);
const v2 = dic.getCloseKeyDown(1.1);
const v3 = dic.getCloseKeyUp(1.2);
const v4 = dic.getCloseKeyDown(1.2);
const v5 = dic.getCloseKeyDown(1);
console.info({v1, v2, v3, v4, v5});
// result ->
// {
// 	v1: 'value1.1',
// 	v2: 'value1.1',
// 	v3: 'value5.0',
// 	v4: 'value1.1',
// 	v5: 'value1'
// }

About

浮点型Key字典容器。A dictionary container using float key.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages