Match - 测试JSON数据的JavaScript库


MIT
跨平台
JavaScript

软件简介

Match是一个可以通过使用一些良好的性能去测试JSON数据的JavaScript库。

安装:

npm install @ozkxr/match

用法:

比较基元

// Numbers
match(3.1415, 3.1415) // => true
//Strings
match('Uno Dos Tres', 'Uno Dos Tres') // => true
// Booleans
match(false, false) // => true
// And with undefined and null values
match(undefined, undefined) // => true
match(null, null)  // => true

结构(对象和数组):

match({ name: 'Link', color: 'green' }, { name: 'Link', color: 'green' }) // => true
match([ 'deku', 'goron', 'zora' ], [ 'deku', 'goron', 'zora' ]) // => true