mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-04-25 17:32:15 +00:00
fix broken build in osx. remove neon-serde
This commit is contained in:
parent
59dad2ea02
commit
be29571670
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "jsonpath4nodejs"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
authors = ["Changseok Han <freestrings@gmail.com>"]
|
||||
description = "jsonpath_lib bindings for nodejs"
|
||||
keywords = ["library", "jsonpath", "json", "nodejs"]
|
||||
@ -17,7 +17,6 @@ neon-build = "0.2.0"
|
||||
jsonpath_lib = "0.2.2"
|
||||
#jsonpath_lib = { path = "../../" }
|
||||
neon = "0.2.0"
|
||||
neon-serde = "0.1.1"
|
||||
serde_json = { version = "1.0", features = ["preserve_order"] }
|
||||
|
||||
[lib]
|
||||
|
@ -1,27 +1,12 @@
|
||||
extern crate jsonpath_lib as jsonpath;
|
||||
#[macro_use]
|
||||
extern crate neon;
|
||||
extern crate neon_serde;
|
||||
extern crate serde_json;
|
||||
|
||||
use jsonpath::{JsonPathError, Node, Parser, Selector};
|
||||
use neon::prelude::*;
|
||||
use serde_json::Value;
|
||||
|
||||
///
|
||||
/// `neon_serde::from_value` has very poor performance.
|
||||
///
|
||||
fn select(mut ctx: FunctionContext) -> JsResult<JsValue> {
|
||||
let json_val = ctx.argument::<JsValue>(0)?;
|
||||
let json: Value = neon_serde::from_value(&mut ctx, json_val)?;
|
||||
let path = ctx.argument::<JsString>(1)?.value();
|
||||
|
||||
match jsonpath::select(&json, path.as_str()) {
|
||||
Ok(value) => Ok(neon_serde::to_value(&mut ctx, &value)?),
|
||||
Err(e) => panic!("{:?}", e),
|
||||
}
|
||||
}
|
||||
|
||||
fn select_str(mut ctx: FunctionContext) -> JsResult<JsValue> {
|
||||
let json_val = ctx.argument::<JsString>(0)?.value();
|
||||
let path = ctx.argument::<JsString>(1)?.value();
|
||||
@ -276,7 +261,6 @@ register_module!(mut m, {
|
||||
.expect("Selector class error");
|
||||
m.export_class::<JsSelectorMut>("SelectorMut")
|
||||
.expect("SelectorMut class error");
|
||||
m.export_function("select", select)?;
|
||||
m.export_function("deleteValue", delete)?;
|
||||
m.export_function("replaceWith", replace_with)?;
|
||||
m.export_function("selectStr", select_str)?;
|
||||
|
2
nodejs/package-lock.json
generated
2
nodejs/package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jsonpath-rs",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jsonpath-rs",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"description": "It is JsonPath implementation. The core implementation is written in Rust",
|
||||
"author": "Changseok Han <freestrings@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
Loading…
x
Reference in New Issue
Block a user